# Problem with build lighting and UV overlap

**URL:** <https://forums.unrealengine.com/t/problem-with-build-lighting-and-uv-overlap/1822996>\
**Category:** Rendering\
**Tags:** overlap, unreal-engine, Lighting\
**Created:** [April 26, 2024, 3:00pm UTC](https://forums.unrealengine.com/t/problem-with-build-lighting-and-uv-overlap/1822996 "2024-04-26T15:00:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![vincenzocas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vincenzocas](https://forums.unrealengine.com/u/vincenzocas)\
**Post date:** [April 26, 2024, 3:00pm UTC](https://forums.unrealengine.com/t/problem-with-build-lighting-and-uv-overlap/1822996/1 "2024-04-26T15:00:20Z")

</div>

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:

 ![Screenshot 2024-04-26 124539](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/7/6/37676f9d941dea10f59d14adb579aa79bc4ebdd6.jpeg)  
And this is the result with the lighting build:  
 ![Screenshot 2024-04-26 125351](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/a/f/baffea13c2d0f99db7c371eb1aa9993b00c5d13a.jpeg)  
How can I solve without adjust the UV map?

---

<div class="post-metadata">

**Author:** ![useronym](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@useronym](https://forums.unrealengine.com/u/useronym)\
**Post date:** [April 26, 2024, 5:46pm UTC](https://forums.unrealengine.com/t/problem-with-build-lighting-and-uv-overlap/1822996/2 "2024-04-26T17:46:31Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![vincenzocas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vincenzocas](https://forums.unrealengine.com/u/vincenzocas)\
**Post date:** [April 27, 2024, 2:49pm UTC](https://forums.unrealengine.com/t/problem-with-build-lighting-and-uv-overlap/1822996/3 "2024-04-27T14:49:07Z")

</div>

This after or before baking the lights?

---

<div class="post-metadata">

**Author:** ![vincenzocas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vincenzocas](https://forums.unrealengine.com/u/vincenzocas)\
**Post date:** [April 27, 2024, 2:56pm UTC](https://forums.unrealengine.com/t/problem-with-build-lighting-and-uv-overlap/1822996/4 "2024-04-27T14:56:34Z")

</div>

I did it but the same happens,

 ![Screenshot 2024-04-27 165622](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/7/8/978af26d2ace3a88a8b304e20e3da78878ade59c.png)

---

<div class="post-metadata">

**Author:** ![useronym](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@useronym](https://forums.unrealengine.com/u/useronym)\
**Post date:** [April 29, 2024, 4:24pm UTC](https://forums.unrealengine.com/t/problem-with-build-lighting-and-uv-overlap/1822996/5 "2024-04-29T16:24:03Z")

</div>

Make sure that the resolution of the lightmap is at least as high as the resolution you told Unreal to generate the UV maps for

---

<div class="post-metadata">

**Author:** ![vincenzocas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vincenzocas](https://forums.unrealengine.com/u/vincenzocas)\
**Post date:** [April 30, 2024, 9:51am UTC](https://forums.unrealengine.com/t/problem-with-build-lighting-and-uv-overlap/1822996/6 "2024-04-30T09:51:13Z")

</div>

These are the settings about the lightmaps

 ![Screenshot 2024-04-30 114821](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/a/c/1acea041ae6ee683c4c0307e7c038bd21b547c02.png)  
and this is like the lightmap appears:  
 ![Screenshot 2024-04-30 114831](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/e/42e8ebc1c55691c42ac2b1b57b6ae4253241b4b5.jpeg)

My scene has a unique big mesh with a unique very very big atlas texture (about 16kx16k dimensions).  
How can i solve this? I’m going crazy.

---

<div class="post-metadata">

**Author:** ![useronym](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@useronym](https://forums.unrealengine.com/u/useronym)\
**Post date:** [April 30, 2024, 1:08pm UTC](https://forums.unrealengine.com/t/problem-with-build-lighting-and-uv-overlap/1822996/7 "2024-04-30T13:08:43Z")

</div>

Did you forget to update the lightmap coordinate index?

![Screenshot 2024-04-30 150805](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/3/9/5393f622631b7f8e62a8519fdc968c11db6dcd04.png)

---

<div class="post-metadata">

**Author:** ![vincenzocas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vincenzocas](https://forums.unrealengine.com/u/vincenzocas)\
**Post date:** [May 2, 2024, 8:45am UTC](https://forums.unrealengine.com/t/problem-with-build-lighting-and-uv-overlap/1822996/8 "2024-05-02T08:45:36Z")

</div>

No, I didn’t. I only forgot to include it in the image

---

<div class="post-metadata">

**Author:** ![useronym](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@useronym](https://forums.unrealengine.com/u/useronym)\
**Post date:** [May 3, 2024, 10:44am UTC](https://forums.unrealengine.com/t/problem-with-build-lighting-and-uv-overlap/1822996/9 "2024-05-03T10:44:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![useronym](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@useronym](https://forums.unrealengine.com/u/useronym)\
**Post date:** [May 29, 2024, 12:01pm UTC](https://forums.unrealengine.com/t/problem-with-build-lighting-and-uv-overlap/1822996/10 "2024-05-29T12:01:09Z")

</div>

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.
