I’m trying to render the scene depth to a render target. I have this working but the depth resolution is poor, see graph below (scene is a sphere, so should be smooth curve).
precision get worse with range. I need this to work at long range with small field of view.
I have compiled the engine with the “DEPTH_32_BIT_CONVERSION=1” define and this reduced z fighting issues but made no difference to final result rendered in render target.
Any help much appreciated
2m sphere at ~70m range
I’m using SceneCapture2D and the following postprocess material (replacing tonemapper)
Render target settings
You may have to change the far clipping plane, unfortunately I don’t think that’s easily exposed.
thanls for suggestion, but changing near or far clipping plane made no difference, maybe its just the 16bit float textures used by gbuffer ?
Most likely depth buffer is 16bit, 32 is really an overkill for most of the cases. If changing far and near plane doesn’t work then I suggest changing the way how vertices are transformed in vertex shader and doing reverse transformation of depth in the next step that you do on saved image. Another thing to try is remove compression from texture when you save it.
try entering in r.gbufferformat 5 perhaps.
Do you really want DXT compression on this RT?