Can Shadows From Baked GI Ever Be Crisp?

URP project created in 2021.1.16f1

No matter what I try, I can’t get the shadows from baked lights to be as crisp as when I change the light to realtime.

Realtime light:

Baked light:

Things I’ve tried that haven’t helped:

  • Increasing every single option in the Lightmapping Settings panel to hundreds above what they started on (then baking again)
  • Increasing the shadow resolution to max (4k) in the URP rendering object, although I get the impression this only affects realtime light shadows anyway

Is this to be expected with baked lights and the only way to get crisp shadows is with realtime lights?

Thanks

Only if you use insane values for texel size and atlas resolution.

Yup.

Thanks for the quick reply.

Yeah funnily enough just this very minute I started playing around with the “scale in lightmap” option on my ground plane and yeah that does get me much crisper shadows but I assume that’s the equivalent of increasing the lightmap resolution (just on a per object bassis).

So, probably a stupid question but… is there any way to “bake” a realtime shadow? It seems crazy to me that we can compute these real nice sharp shadows every single frame at runtime but yet there’s no way to bake that in to static objects even with minutes of baking :S

That’s exactly right.

There do exist methods where unless something is moving inside the light’s influence area, the shadow map is re-used. Maybe HDRP does this? I am not sure. I think there are assets that do it (like Next-Gen Soft-Shadows 2).

If you modify the shader to SDF then it pretty much gets you crisp shadows out of the box for free. It’s a nice trick for basically free. Since it exploits the gradient you get with lower resolution source samples.

This is fine for baked, but would be a bit messy for dynamic. It would only be useful for baked shadows.

I don’t think Unity exposes this directly so you’d have to hack into built-in or SRP, or make a shader that samples the lightmap yourself.

I had a deja vu and found this thread : Sharp lightmap ? :slight_smile:

I don’t actually know what you mean though. Treating the lightmap as if it’s SDF? That could work, but without GI at all, right? (because the many resulting gradients from indirect light will probably mess up SDF)

Correct, I touched on it, you’d need to be baking shadow not GI. But the picture above looks pretty much like that.

If it is a problem, what we can do with this is either bake shadows in other textures, and sample those, or just bake the bounce lighting into vert cols. There’s a lot of roads here but when I did my tests for a comic book baked rendering a while ago, I was able to pick great hard smooth edges from a shadow source texture just like you would SDF (same technique actually) and it works absolutely fine.

The problem is just what choices to make.

2 Likes