Jagged Shadows in Baked Lightmaps (Unity 5)

EDIT: Can everyone please upvote this bug so we can get a fix faster? Login and vote here:


Hey all,
So I’m having an issue with very jagged shadows in baked lightmaps in Unity 5, and after searching a ton and trying every possible setting adjustment (that I know of!), I’ve decided to post the question here and see if anyone has a solution.

What I’m seeing is very jagged edges in certain places in my shadows:
(Scale: this is a large cliff wall, player being about a 10th of the height.)


Upping the Baked Resolution only makes the jaggedness smaller, but it’s still very harsh. In Unity 4, I remember an option for sampling (or something similar) which smoothed shadow edges without upping the resolution, and it looked great. I’ve tried messing with all different types of samples, direct light quality, etc, but the only thing that seems to really change anything at all is Blur Radius (which actually helps quite a bit, but I’d rather not blur all my shadows if I don’t have to). Also tried the “Default-HighResolution” general GI parameter, but again it changed nothing about the jaggedness.

The burn time for my scene is already between 5-7 hours per bake, which is crazy high if you ask me, and that’s at a fairly low resolution (10 texels per unit). So increasing the resolution is probably not an option at this point (not to mention it doesn’t soften the jaginess when doing test burns on this single object, just makes the jags smaller as I mentioned before).

Is there something I’m missing? I’ve run out of things to try…
Any help would be very much appreciated!

Here are all my settings.

Scene Lighting:

Lightmap Parameters:

Object Settings:

Light Settings (using one single directional light):

Project Quality Settings:

Thanks very much in advance!

Bumpity bump bump.

I’d say it’s the way your UVs are laid out
maybe try to make an unwrap with fewer pieces…

At first I thought that might be it as well, but as you can see above, the UVs are in one piece except for one small triangle.
My guess is that this is more of an anti-aliasing/refinement/quality issue of some sort which I’m either missing or is broken… Any other ideas?

There is also this thing Large Scale Lighting Noise - Unity Engine - Unity Discussions
I know it’s not exactly your issue, but still interesting bug
Have you tried to scale object down?

Could you try shifting the auto UVs to a small number? Like 5? That may help, if I understand the visual style your’re going for…

This could be related, let us know how a scaled down version looks?

Hi! To rule out the scaling as the cause, please try and assign a custom LightmapParameters with a higher pushoff value, that fixes artefacts on large objects.
It could be a charting problem, would you mind filing a bug report so we can take a closer look if your problem persists.
Thanks!

So I don’t think the scale is the issue since the object isn’t very large. I’ve included a default Unity 3d Cube object in the shot for scale.

I’ve assigned a higher pushoff value (from .0001 to .5) and it seems to soften the edge a tiny bit, but it’s still definitely there:

And here’s a before shot (.0001) if you’d like to flip back and forth to see the diff:

I’ll file an issue and post the number in this thread for you.

Bug submitted - Case 689996

Just for fun I burned a comparison shot with Unity 4’s lighting system, and it looks amazingly good!

And this is Unity 5 at the same resolution:

Again, I feel like there’s some fundamental setting that isn’t being considered as far as sampling is concerned, or something like that.

1 Like

im having the same problem. its not an UV or scale issue.
each day working with unity 5 I miss unity 4’s lightmapping more and more lol.

So after doing more tests, it looks like what I was afraid of. The GI anti-aliasing seems to have no effect on the aliasing of the lightmap whatsoever.


If that’s the case, then this is pretty bad… Is someone looking into this on the dev side?

same story


with directional/specular it looks super bad

Can we get a fix for this asap? We can’t get any sort of quality light burns until this is working.

Anyone…?

Same issue here:
2092495--136884--Captura de pantalla 2015-04-30 a las 16.35.13.png

Unity 5 light mapping is slower and gives worst results than Unity’s 4 Beast. I really miss the old system :frowning:

Edit: Just as I wrote this, I noticed that hiding my large ocean plane seems to reduce the distance between the jaggies, making them much less apparent. I’ll try increasing the polygon count on my ocean and see if that helps.

I’m having the same problem, but with realtime shadows. It seems to be related to self-shadowing. As you can see in the first screenshot, it’s not related to shadow resolution in my case, as the other shadows look great.

Bias is set to 0.1 and normal bias 0.4 on the sun directional light using soft shadows, and changing these values only moves the problem rather than hide it. Lowering shadow distance or camera clipping does not seem to make a difference.

This is my biggest issue with realtime shadows at the moment.

I am experiencing a similar problem with shadows when using a large plane for an ocean. This has little to do with lightmapping or geometry.
It seems the effective precision in bit depth of the shadowmap decreases when a large plane is either casting or receiving shadow. Perhaps there is a mistake in the frustum computation that results in a very low near clipping plane or a very large far clipping value?

EDIT: An example of the precision issue, clearly showing it is not a bias issue.
Scene was constructed from an empty scene, with a plane (scale 20.000) at the origin and a box (scale [10, 4, 1]) at position [0, 3, 0].

EDIT 2: Opened a separate thread here, since this seems slightly off topic.

3 Likes

Has any one found a fix for this?