This goes well on perspective camera.
But get no effect on orthographic camera.
Is there any different?
This goes well on perspective camera.
But get no effect on orthographic camera.
Is there any different?
I get the right effect like this.
So the depthMap for perspective camera and orthographic camera is different?
Yes, the projection matrix is different between perspective and orthographic mode, so the depth values are different too. In the orthographic case, the z values in clip/NDC space are in the [-1,+1] range, so your fix is the right one.
And the range is [0,+1] in WebGPUEngine ?
Yes. You can refer to this page for the maths. It’s for shadow generation, but the orthographic/perspective matrices are the same for cameras:
Thank you so much!