shader: color white after a precise z-value

hi,

i’m new to unity and it’s difficult to understand shaders :stuck_out_tongue: .
what i want to do is to color a mesh after a precise z-value with 0.5 alpha white.
it seems like a fog but at a precise point, independant from the camera.

i tried with some z-buffer things and depth but it didn’t succeed (z-buffer is more for the camera but i want really uniformely color after the z position 0.5);

can someone tell me how. it will spare me 2-3 days :wink:

thank you!

ok, i did just what i want:

     void surf (Input IN, inout SurfaceOutput o) {
               
                if(IN.worldPos.z>0.5) {
                o.Albedo=tex2D (_MainTex, IN.uv_MainTex).rgb*2; //after 0.5 : 50% white.
                } else{
                o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb; // in front : normal
                }
          
           }
`
`