Jagged shadow edges on Low Poly models using URP Baked Lighting

@AlienBoyGames Thanks for you post. I think that the jaggies that you are seeing are due to sub-optimal UV unwraps. My guess is that your object is authored in such a way that the two faces on either side of the jagged edge points to the same charts/island in the UV unwrap. This is a problem because that means pixels being shaded near that edge will potentially sample from both sides of the light/shadow part of the island/chart in the baked lightmap. Therefore shadow/light bleeds across the edge even though that is not what you want

I’d say that the best way to solve this is to make sure that faces which ought to looked faceted have their own separate chart/island in the UV unwrap of the object. In the clip below I show how you can achieve this using Unity’s built-in auto unwrapper:
6531524--737765--jaggies.gif

By setting “Hard Angle” to a small value, you ask the unwrapper to treat most faces as having a sharp edge. This is typically what you want in low-poly style games. Of course, you don’t have to use Unity’s unwrapper to achieve this.

Another solution to your problem is to not bake direct light into your lightmap. The reason the jaggies are so significant is because you have very bright direct light on one side of the edge and relatively weak indirect light on the other. If you only bake indirect light (and apply direct light with realtime techniques instead), then you would not have that problem. I show this solution in this clip:
6531524--737771--jaggies2.gif

As you can see in the video, the problem becomes much less significant by not having direct light in the lightmap.
Note that this is not a perfect solution since there is still some “texel bleeding” across the edge. It is just less visible because it is “only” indirect light. Therefore, I’d recommend the first solution that I mentioned above over this second solution.

Regarding the “white smudges” that you see I am less certain of what is going on. I suspect this is due to texel bleeding across separate lightmap charts. Are you getting “There are X objects in the Scene with overlapping UV’s.” warnings in the console? If so you can solve this by increasing the resolution or increasing the spacing between your charts as explained here. Generally, I recommend you use Unity’s unwrapper’s new feature Auto Pack Margin .

2 Likes