Hello, I’ve a problem with lights build, unfortunatly I have a mesh with UV map overlaps and I can’t fix it manually in any way, so when I perform the lighting build obviously lights appear where they should not.
This is the situation without build the lights:
The only solution is to use non-overlapping UVs for the lightmap.
You can have UE generate these for you. Open the static mesh, and under build settings, enable generate lightmap UVs. Make sure to set a high minimum UV resolution for your usecase. Then, still in the static mesh window, make sure you’re using the correct UV index for lightmapping (the one you just generated).
It could be that Unreal is struggling to generate correct lightmap UVs for your case I suppose. Have you looked at the generated UVs? The mesh editor has UV preview functionality where you can visualize the UVs. I don’t know if it’s possible in your case with this huge mesh, but normally you would want to make sure there’s no overlapping triangles, and that there is enough padding around the edges to prevent any bleeds.
Alternatively you could try to generate your lightmap UVs in a different software to see if that helps with the issue (e.g. Blender)
Btw you did save the mesh asset before building lighting, right? You also have to click the “apply changes” button in the build settings to generate the lgihtmaps.
Well wouldn’t you know it I got the same problem myself when dealing with 3D scans. I have a solution that should work for most cases.
Background: The underlying issues is that the automatic lightmap UV generation that Unreal performs, is always based on a pre-existing UV channel. In the case of a mesh with very a very large amount of UV islands, the system will most likely break, as it will try to fit too many UV islands into the lightmap UVs.
Instead, the better solution is to generate brand new UVs which have fewer UV islands. For my usecase, I used the modeling plugin in Unreal.
1 .Firstly, disable automatioc lightmap UV generation in your mesh
2. Select your mesh in a Level and in the Modeling tool, launch the UV editor.
3. Add a new UV channel
4. Use the AutoUV tool to generate a new UV channel. I like the PatchBuilder algorithm, as it’s very fast and gives okay results. Tweak the settings so that you get okay-looking UVs.
5. Most importantly, select your target lightmap resolution
6. Let the UVs generate, click Apply, hit Save
7. Go back to your mesh. Specify to use the UV channel you just generated to be used as lightmap, and input the texture resolution from step (5) as lightmap resolution.
If you mesh is unable to have good enough UVs through the above approach, you most likely need to either fix it or split it into multiple smaller meshes that fit into lightmaps.