I want to render the depth of a scene into a SubViewport. How can I do that?
I put this shader into a ShaderMaterial, make that ShaderMaterial every object’s surface override material, and render it with a camera. The viewport remains all black and I don’t understand why. Forward+ renderer btw.
Right, thank you for your response, but I’m not just getting unexpected values, I’m getting literally zero. It’s black, completely, but the geometry close to the near plane should be red. Could this be a bug?
My goal here is just to write the nonlinear depth values (i.e. 0.0 to 1.0) directly to the colour channel. I don’t need to undo the perspective divide or multiply by the inverse projection matrix here.