Hi,
I’ve recently stumbled upon a problem with rendering of thin opaque objects in front of the clouds in URP 17. I’m using Enviro asset, which renders clouds with a render pass after the transparents. The problem is that those thin objects on depth texture get really blurred because of MSAA and this causes the clouds to be rendered in front of some parts of them.
Object rendered with no clouds
Object rendered with clouds, the clouds were drawn in front of the left, more distant parts of the black mesh
Raw depth texture of the previous images, the depth of the mesh was blurred and in some parts even destroyed
One of the simplest solutions to that problem would be enabling depth prepass, instead of copy after opaques, in the renderer asset settings. However, this significantly increases the rendering time, so I would like to avoid this. Turning off the MSAA also helps, but this is obviously not acceptable, since it leaves the whole scene severely jagged.
Object rendered with clouds, depth prepass enabled
Prepassed depth texture
My question is - is it possible to make the antialiasing just affect the color buffer and not write in the depth texture, so the thinner parts don’t disappear? If not, what whould be the most elegant way to copy the depth texture before the antialiasing and then write it back after? Or maybe is there another solution of such problem?