Jagged edges around the model

Hi there,
In my project, jagged edges are coming around some models like this…


Any idea in how to resolve this?
Thanks in advance.

That looks like those are shadows? You could use higher shadow map resolution, or smaller shadow distances, or even shadow cascades in that case.

@mvaligursky, thanks for the reply.
There was some glittering kind of effect around these models in immersive VR. Is this caused because of shadow maps?

@mvaligursky, one more question. does the performance go down in VR if we increase the lightmap size for the models? Also what is the optimal size for best quality and performance?

Try to disable shadows on the light to confirm those are shadows.
Performance - better quality usually means more higher cost, and so all this is always balancing act between performance and quality. Try playing with resolution and see what impact it has on quality vs performance, and find the best setting for your project on the devices you support.

we’ve turned off shadows on the light and also removed receive shadows for the model, but we can still see those jagged edges around the model.

when the lightmap size is 8192


when the lightmap size is 4096

render properties

light properties

I don’t think we can use 8K in project, since our scene is a heavy scene.
how can we resolve this issue. It is present for many models in our scene.

First thing would be to understand what are those lines there. You say you have no shadow casting lights … so not shadows. Are you able to create a new project with one of those meshes (without textures even) and a light to reproduce it?

I’m not able to reproduce the same in another project.
https://playcanvas.com/editor/scene/1306287
I’ve kept the mesh and removed receive shadows, cast shadows and removed cast shadows for lights.

Not an ideal solution, but seems to help. Create a script with this code in initialize function:

this.app.scene.lightmapFilterEnabled = true;
this.app.scene.lightmapFilterRange = 10;
this.app.scene.lightmapFilterSmoothness = 0.2;

and attach it to the root. This basically blurs the lightmap. Note that it has other side effects, so test it out. And maybe play with the parameters.

1 Like

I’ve tried this. But this is also not working.

What does the UV1 map look like on the model? Can you show a screenshot of the UV unwrap please?

I’m wrong. This worked for lightmapFilterRange = 40. Thanks a lot @mvaligursky. This took us a whole day.

1 Like

Note that blurring the lightmap is really just a hack for this - I suspect better solution could be done by better unwrapping of the UV1 as @yaustar is hinting - by introducing and edge along those pixelated edges. But I don’t know much about unwrapping tools to see what kind of control they expose.

Yeah, I’m wondering how much ‘area’ of the UV1 map that this model is taking up. If it’s a small section in the corner, than the lightmap texture resolution needs to be much higher or the UV map needs to be better spaced across the whole map.

Here we are sharing UV unwrap screenshots , Please check them.



It’s not as small as I thought it would be :thinking: Odd that it requires such a high resolution lightmap to look ‘good’. I think I tried it at 8K and there were still noticable jagged edges up close

what could we possibly do in this case for the proper fix other than the lightmapFilter hack?

This answer is likely the solution here, as I hinted above:
https://forum.unity.com/threads/jagged-shadows-in-baked-lightmaps-unity-5.317150/#post-2289056

Your unwrapping seems to be ignoring the hard edges … it needs to split the lightmap islands along those.

3 Likes