Some Trouble with depth texture

yes, I read the pbr.vertex.fx, customPBRMaterial use gl_Position.w to calculate depth, gl_Position is calculated by worldPos, worldPos is calculated by positionUpdated. I add code in Vertex_Before_PositionUpdated where positionUpdated is defined but worldPos isn’t defined.

In this order, I change positionUpdated, gl_Position is changed correctly, but depth not change.

This picture is draw with a screen space postprocess Effect, It samplers depth map, calculate world position for each fragment, then output worldposition mod 100.(I think it is best way to show depthMap than linear gray 0-1)
image

1 Like