Hello,
I have a shadow problem that I can’t solve. The problem appeared when I switched to the Universal Render Pipeline. The fact is that defects appear at the edges and they can be removed either by turning off the shadows, or by increasing the Depth Bias at least to 3.
If we look closely, we will see defects. Now they are poorly visible, tk. I smooth out the shadows. But if I turn off anti-aliasing:
This is your basic shadow acne. This isn’t unique to the URP, it happened exactly the same way in the built in pipelines. You just may not have been looking for it.
Here are two screenshots from the editor. One of these is using the built in forward pipeline. One is using the URP. Can you guess which is which?
The URP is the first image, the one with the bluish skybox and darker ground shadow.
Oh, and since I forgot to offer any solutions, increasing the bias (depth and / or normal) is basically the only solution. The other one is to change the angle of the light slightly so it’s less obvious. This is how they fix it on AAA games too. Sometime’s it’s someone’s primary job to just go through the levels and tweak geometry / light positions to hide these artifacts.
Sorry to resurrect an old post, but I have the same shadow setup in both 2022.3 URP and built-in with the same depth bias and normal bias values and same light direction, same model, etc. And for some reason my URP project has terrible shadow acne and built-in has none at all.
Left is the default URP/Lit shader
Right is Default built-in surface shader
Any attempt to fix it in URP by increasing normal bias any further causes horrible light bleeding in the shadows of low poly models that 2-sided shadows doesn’t even fix.
While built-in doesn’t have either issue with the default bias values.
What would be causing the difference between them if all the values appear to be the same?
The difference between them is because the BIRP and URP don’t use the same math or exactly the same shadow technique, so the specifics of how much bias you need will be different.
If no variation of bias setting in the URP asset fixes it, would a custom shader potentially provide more granular control of how shadows are applied to the object that could maybe alleviate it more?
Or is there any way to change how URP does its shadows to make it similar to BiRP?
You can look to adjust the shadow quality in your URP Renderer Pipeline Asset and see if that makes it better. And technically yes you can adjust it with a custom shader, but that potentially requires replacing a significant chunk of the code as the shadow code is buried deep in the URP lighting model code.