Hello,
I am looking into upgrading my project from Unity 2022.3 LTS to Unity 6, and there is one annoying issue I’m having with rendering. I have a water shader that uses scene depth for various effects like shore foam. It is based on this video: https://www.youtube.com/watch?v=78WCzTVmc28
In Unity 6 there is artifacting around the trees where they are over the water:
This is not present in 2022.3:
This seems to be because in Unity 6 Depth Priming Mode is forced disabled when MSAA is enabled. When I turn off MSAA and ensure Depth Priming is enabled, the problem goes away (but without MSAA things look terrible). In 2022.3 both could be enabled.
Is there a different way in Unity 6 to fix these artifacts? I found some earlier discussions about issues with MSAA and Depth Priming, but nothing seemed relevant to this particular issue.
Thanks!
Hello!
Yup Depth Priming + MSAA has been disabled in U6, it was a really bug prone configuration that didn’t really provide any value.
That being said, Depth Priming is purely a performance thing, it should not affect how things look at all. Would you be able to share your shader so I can take a look? Additionally, maybe a screen shot of the Rendering Debugger with the pass that renders your water shader selected?
Thanks!
Mikkel
Edit: Also, have you tried setting the Depth Texture Mode to Force Prepass?
Thanks for the reply! Sure, Here is the shader graph, plus a required subgraph:
Water Shader Graph.zip (32.5 KB)
Like I mentioned, it is based on this shader graph If you want a second shader to test with: Video-Files/Shader Graph at main · Flaroon/Video-Files · GitHub
Here’s a screenshot of the debugger too, I wasn’t sure what information specifically to include:
I have tried setting Depth Texture Mode to Force Prepass, but it doesn’t seem to make a difference.
I would love to see which textures are bound when you’re rendering the shader, specifically the depth texture that’s bound for sampling.
MSAA can be a really good AA solution, and it can be really bad, depending on what you’re trying to do. It does not play nice with effects like SSAO that need to do convolution. Maybe you can try and toggle some of these effects on/off and see if the issue disappears? I would also be curious to see what the Frame Debugger shows on 2022.3 with Depth Priming enabled.
Aha, I could have sworn I had tried disabling all of the renderer features, but it seems that having either the SSAO or Decal feature enabled with MSAA causes the artifacts.
Right now neither of these are strictly required in the specific place in my game where the artifacting is happening, but I could see the problem re-emerging later in areas where those features are needed. As far as the AA itself goes, for my project MSAA is by far the best looking (at least out of the ones included by default in Unity), so I can’t really move away from it.
Also I realized I botched the upload of my shader graph in my previous post. It’s fixed now, but for simplicity I just made a very basic Unity 6 project to show the issue:
Water Shader Test.zip (117.8 KB)