For testing purposes I have disabled the SRP batched and the GPU instancing. I tested changing the
Camera.main.opaqueSortMode to OpaqueSortMode.FrontToBack, but whatever value I use, the sorting doesn’t change.
I also wonder why I shouldn’t use the FrontToBack sorting an any time.
Ok thank you. I am not sure why without any batching enabled it shouldn’t work, seems very suspicious, but probably relying on sorting is not a great idea so another question if you don’t mind: how can I enable a depth prepass to prime the z buffer using the depth pass before the actual rendering?
// Depth prepass is generated in the following cases:
// - We resolve shadows in screen space
// - Scene view camera always requires a depth texture. We do a depth pre-pass to simplify it and it shouldn't matter much for editor.
// - If game or offscreen camera requires it we check if we can copy the depth from the rendering opaques pass and use that instead.
I am back from holiday and tested this immediately. If I hack the code and force the requiresDepthPrepass to be true it works fine, but I am not sure how to force it otherwise. I wish to not support a custom LWRP just to force this.
edit: setting the requiredDepthPrepass to true alone is not enough as the standard pipeline doesn’t use the default render target for it, while instead obviously I need the depth pre pass to work on the default render target.
Your suggestion is to have custom LWRP pipeline just to prime the depth buffer then? If it helps my case, I could do it, but how can I do it without modifying your package?
I don’t think this is a correct way to do this. If something relies on depth prepass populating m_DepthTexture, it will not have the data there.
I suppose you need to add another pass to populate the backbuffer contents and enqueue it separately.