I think the topic says it already. I got a problem with shadows cast from thin walls.
Unfortunately there’s a little nasty shadow gap showing on the ground, close to the bottom of the wall.
I’m playing around with the URP for the first time and I’m puzzles how to tackle this problem properly.
Here’s a short video showing what I tried…
“Cast shadows: Two Sided” in the mesh renderer
Tweaking the URP shadow quality settings
But it looks like I’m only mitigating the problem but not solving it.
Here are also a few snapshots as the YouTube encoder kills the details a bit:
Pic 1: Problem shown
Pic 2: Problem gone with thicker walls
Pic 3: Problem still slightly visible from high up - after tweaking the URP shadow quality settings
Hey @Matt-Cranktrain .
I actually tried that indirectly - I also played around with the bias setting in my video above.
I just did so in the URP settings - the light source is set to inherit its bias settings from there.
But like the video shows - the result isn’t perfect.
Firstly - the shadow resolution. I notice that in your screenshot even if there was no gap next to the yellow walls the shadows would look pretty bad, especially at the edge, I can see jagged pixel artifacts along the edge, it looks pretty fuzzy and not pleasant. In your Universal Render Pipeline Asset, what is the shadow resolution set to? Your video shows 2048 but I don’t know if that’s just a WIP value as you’re changing things about there.
The nicer shadow edges are welcome but you can see it also brings the gap down (my normal and depth bias is still set to the default 1 there, so there’s still a nasty gap, but you can see the difference).
The second thing you should consider is the units of your game - in Unity a distance of 1 is designed to be 1 meter, so the wall in your video with the thickness of 0.20 is 20cm thick. That might make sense for the scale of the world but if you were to double or quadruple the units everywhere you’ll find the artifacts half or quarter. The higher the units the more whatever your shadow resolution is set at is going to do on your behalf.
If you’ve adjusted the bias down, maxed out the shadow resolution and increased the units of the walls and still have shadow gaps or fuzzier shadows than you want, then bring the URP package into your package cache and add a higher 8192 shadow resolution like this post here describes , it’s literally just adding one line to a file.
Hello again, @Matt-Cranktrain ,
I had the shadow resolution at the default 2k setting and increased it to the 4k setting now.
With that the gaps are gone and yes, the edges not that soft any more.
You’re probably right about the wall thickness. I realized that too but yet I rather wanted to find out how to properly solve this issue. Of course I could just make the wall thicker like I already did in the video but as soon as I want shadow casting from a thin mesh I’d run into the same issue again.
I’m running into the same issue; smaller object shadows are borked. 6cm (0.06 units) tall box casts no shadow at all - need to raise it up off the surface to get any shadow at all. Shadow bias is set to 0, resolution / cascades are a red herring that just determines quality not the complete absence of a shadow. Setting the shadow bias to a negative value; for example -0.032 fixes the problem completely but that causes major visual issues (shadow acne, etc).
I don’t understand exactly why this is happening - seems like 5-6 cms is a pretty massive margin of error for shadows? Bringing the camera in closer (1-2 meters away) doesn’t seem to make any difference either. Are we just supposed to scale everything up 10x to100x to reduce the margin of error? Why is the limit 6 cms and not 0.06 cms? Seems totally arbitrary.
Wait - yeah it’s definitely magic numbers in the shader; see here;