We have a tile based game, each level is described by a scriptable object, we have an editor and inspector to allow us to build a flat 3D world from icons that are translated into prefabs and real geometry.
To reduce the draw calls I am baking the static geometry down to a combined mesh by using the CombineChildren in 4x4 groups, so 16+ draw calls down to 1.
The CombineChildren script doesn’t do anything with UV2 set so I am calling Unwrapping.GenerateSecondaryUVSet() which appears to work to a degree, however, we have two issues:
Firstly: presumably because of the way the UVs are baked, and perhaps because the combined meshes have a lot of open edges, geometry that isn’t adjacent receives the edge of light bleeding in from the lightmap for another triangle.
Secondly: Similarly, because we are baking tiles into combined meshes, where one group of tiles has been baked together and then abuts another group, the edges tend towards black. This broadly look like filtering, but even if I select point for the map, then 1 texel of resolution down the edge is being lightmapped from the map that belongs to different part of the mesh, nowehere near the triable in questions.
I’ve tried a lot of fixes for this, changing settings that sound as if they ought to impact the mesh, but none seem to have the desired effect.
I should say that I’ve checked, by occluding the offending part of the mesh, and the light is not leaking through the room, but bleeding from adjacent lightmap pixels.
My questions are therefore:
- What is at fault here - do I need to back my own UVs to avoid this sort of thing?
- Otherwise, is there some option for lightmapping,for the CombineChildren script, or in the beast XML that should resolve this for me?
I’ll add a few pictures
Help much appreciated!
Picture showing first issues:
Second issue shows the hard edge between ‘tiles’