Blender bake settings to prevent seams on Ambient Occlusion map

My setup has a blender mesh of a room(with submeshes per wall) that I export to glb with no materials. I also export a baked flat texture for each of the submesh walls that I use as ligtmap in the babylon materials. I then load the glb, lightmaps from blender in babylon and manually create the materials.

I do this since it gives me flexibility to dynamically change the albedo/diffuse of the walls as compared to baking the textures upfront.

Everything’s working fine - except for one thing. I see these nasty seams. This indicates to me that there is an issue with the way I’m setting the UVs or they way I’m baking.

Attaching the settings in screenshots. What am I doing wrong?





Maybe @PatrickRyan or @PirateJC would know ?

@evidanary is there a way you can share the Blender file with us so we can take a look? It can be in a private message if you can’t share it publicly.

1 Like

@evidanary, I found the problem in your UV seams. And this is easier to see than explain. This is how the triangles are laid out in UV space:

The triangles that share an edge in the middle of the wall are placed into different locations in UV space where you would normally want them right next to each other. What happens here is that you have an actual UV seam right in the middle of the wall. This is magnified by the fact that the UV edges are sharing texture space with a different shell from a different part of the wall.

UVs islands assume that there is some amount of color spread past the UV seam. This padding is there so when the texture is mipped - the pixels are averaged when the texture size is reduced - you will not see any bleed of colors belonging to another UV island. Since your seams are right on top of another island, there is no color spread to account for any mipping.

To fix this you have two options. The first is to lay out your UVs again to make sure that you only have seams in areas you can hide like the corners avoiding any seams in the middle of the wall. The second is to give you UV islands more space in between each island to allow for color spread when baking your AO texture. Ideally, you do both, which will produce the best results.

I hope this helps explain what you are seeing, but please feel free to ping back with any questions.

2 Likes

This helps a lot . Thanks Patrick!

I solved this by manually grabbing and moving the UV island such that adjacent edges in model are indeed next to and touching each other and located in the correct place. The seams went away.

2 Likes