Material depthFunction value for "Less or Equal"?

Hi! I’m trying to set the depthFunction within a script.

I found this post: depthFunction (materials) might need a bit of a cleaning in doc and playground

Which Mawa went through the same journy as me today. Trying to change the setting within the 0 - 8 range always returns “Engine Default”

I tried using 519 (as Mawa mentioned) and I also finally got it to change to “Always” In my case I’m trying to use “Less or Equal”

Does anyone know what value I have to use to set the value to Less or Equal ?

Easiest is to ask @RaananW :stuck_out_tongue_closed_eyes: When searching for depthFunction in the API, I still get the 4.7k of useless PGs and still couldn’t find the explanation in the doc.
May be the explanation itself can be given to you by @Evgeni_Popov . I haven’t reused this since my previous attempt, so I have no faen clue. Sorry,

1 Like

Our playground search functionality needs a revamp. I have already made some internal tests to improve it, it’s just a matter of finding the time and implement it.

The values you are searching for are in the Constants file:

    // Depth or Stencil test Constants.
    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */
    public static readonly NEVER = 0x0200;
    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */
    public static readonly ALWAYS = 0x0207;
    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */
    public static readonly LESS = 0x0201;
    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */
    public static readonly EQUAL = 0x0202;
    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */
    public static readonly LEQUAL = 0x0203;
    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */
    public static readonly GREATER = 0x0204;
    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */
    public static readonly GEQUAL = 0x0206;
    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */
    public static readonly NOTEQUAL = 0x0205;

In UMD they would be BABYLON.Constants.WHATEVER_YOU_CHOOSE

2 Likes

LOL. I sort of had the feeling that they might be the same as the stencil (kind of makes sense) but of course lazy me didn’t check it out :face_with_hand_over_mouth:. Thanks a lot @ShaderRig There you go.
Both of you, have a great day :sunglasses:

1 Like

Thank you, worked perfectly.
Also thank you to @mawa for the original post.

1 Like