EDIT 2 : SOLVED. The RenderTexture had a depth of 1 instead of 24. I thought it was 3Dtexture depth, but it was zbuffer depth instead.
EDIT : after a few more tests, it appears that depth buffer do not work at all when I call Camera.Render() with 2 objects, the one behind is drawn in front without reason.
Hi,
I use manual rendering with rendertexture. I want to make a render. Then a second render without clearing the depth buffer between the 2.
I try with clearFlags set to Nothing, but the camera still clears the depth buffer.
Does someone have an idea on how to make sure that camera.render() or camera.RenderDontRestore() does not ?
If i call Graphics.DrawMeshNow twice in a row, the depth buffer is cleared too between them, even if the camera has clearFlags set to colorbuffer Nothing -_-.
I make my call from OnPostRender (and I make sure to avoid infinite call btw). Is this a limit in Unity I should have foreseen?
(I am on Unity3.5.7, but if you got a hint for Unity4 it’s ok I should switch this year.).
(Another solution for me would have been to share the window depth buffer with the render texture depth buffer, but this one seems it is a real limit inside Unity, so ok I won’t use it).
Best regards,
Pierre