Can somebody explain me how exactly the zOffset is added to the final depth? I had a look at the documentation but it’s not described and I also couldn’t find it in your code (basically stuck at
First I thought that the zOffset is defined in screenspace so I was expecting that it will either be added to the shader as an additional uniform which is added to the screenspace depth or that the projection matrix is being modified accordingly by multiplying a translation matrix with the zOffset as a z-translation onto it - but like I said I couldn’t find anything in the code. After some search I found in some other answer that it’s defined between zMin and zMax.
In order to achieve the rendering effect I’m seeking for I need to modify the screenspace depth. I can do this perfectly fine in my custom shader but I have other objects in the scene which I would like to render with the standardmaterial and there I saw that I could use the zOffset.
For this to be exactly the same like in my custom shader I need to understand how the zOffset is applied internally - so please help me out whoever knows how this works.