# GPU Lightmass Bake Breaks After Encoding (Instanced Static Mesh)

**URL:** <https://forums.unrealengine.com/t/gpu-lightmass-bake-breaks-after-encoding-instanced-static-mesh/247540>\
**Category:** Rendering\
**Tags:** General, unreal-engine, UE4-26\
**Created:** [August 27, 2021, 2:12am UTC](https://forums.unrealengine.com/t/gpu-lightmass-bake-breaks-after-encoding-instanced-static-mesh/247540 "2021-08-27T02:12:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Albarnie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Albarnie](https://forums.unrealengine.com/u/Albarnie)\
**Post date:** [August 27, 2021, 2:12am UTC](https://forums.unrealengine.com/t/gpu-lightmass-bake-breaks-after-encoding-instanced-static-mesh/247540/1 "2021-08-27T02:12:38Z")

</div>

When baking lighting using GPU Lightmass, the lighting converges and reaches a pretty good point. no noticable baking errors, etc.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/8/f/8fb988ef229f141c6603be8289c44f96b36da0a8.jpeg)  
However, when the bake completes and is encoded, lighting on objects becomes warped and offset, as if it is being read from the wrong UVs in the atlas.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/b/1/b18b9e7cba84dc078cf80eec76cc47da4b3aa5ae.jpeg)

All the objects in the scene are modular and use instanced static meshes, the UVs are not overlapping and use a mostly consistent texel density.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/7/4/74b736d41072a71ba53a6bc77ccbaed12d0e84b0.jpeg)

Anyone know why this is happening? is there a limit to the scene lightmap size that i am running into?

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [August 27, 2021, 4:19am UTC](https://forums.unrealengine.com/t/gpu-lightmass-bake-breaks-after-encoding-instanced-static-mesh/247540/2 "2021-08-27T04:19:37Z")

</div>

very possible the ladder’s UVs are bad.  
Did you make the light-map yourself or was it engine generated?

And it seems like the last block above the ladder is a separate mesh that’s got some light bleed to it. Hard to say without actually looking at it, but I would guess that’s the reason why it’s lighting beyond the wall maybe?

Start with the UV first.  
Check the model after - make sure they intersect or are at exact zeroed-out coordinates.

---

<div class="post-metadata">

**Author:** ![Albarnie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Albarnie](https://forums.unrealengine.com/u/Albarnie)\
**Post date:** [August 27, 2021, 6:46am UTC](https://forums.unrealengine.com/t/gpu-lightmass-bake-breaks-after-encoding-instanced-static-mesh/247540/3 "2021-08-27T06:46:18Z")

</div>

That wouldn’t explain why it looks fine during the bake. The previews shown above that use the in-progress data are fine. CPU lighting bakes look fine (but less accurate than GPU bakes). UVs are made by me but packed by the engine for lightmaps. All the mesh positions are generated through code and they are exact and not overlapping.

EDIT: Here is a cpu bake of the same scene  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/2/3/23dae7b87b505fe852fff677ecf5aba3bf96f809.jpeg)

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [August 27, 2021, 8:40am UTC](https://forums.unrealengine.com/t/gpu-lightmass-bake-breaks-after-encoding-instanced-static-mesh/247540/4 "2021-08-27T08:40:58Z")

</div>

That doesn"look fine" it looks better but there’s still a light bleed on the steps is there not?

There must be _some_ issue with the geometry somewhere for light to bleed trough - or at the very least the UV is bad and overlapping, but you would get errors on that one.

What is the other side of cube thing / isolate that model.

---

<div class="post-metadata">

**Author:** ![Albarnie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Albarnie](https://forums.unrealengine.com/u/Albarnie)\
**Post date:** [August 28, 2021, 7:42am UTC](https://forums.unrealengine.com/t/gpu-lightmass-bake-breaks-after-encoding-instanced-static-mesh/247540/5 "2021-08-28T07:42:40Z")

</div>

Either way that would not explain why the lightmaps get offset after being encoded. There is definitely no UV issues on the mesh.  
Unreal Engine would log a warning if there were overlapping lightmaps, and we would be seeing details repeated on the same tile, not the inter-tile offsets we see here.  
The lighting issue on the CPU bake went away when I rebuilt with production quality. We can see clearly here it is not an issue with the UVs or meshes  
CPU

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/d/9/d9be865ac60a3db0ff6561cfa0f80d608566c1d1.jpeg)  
GPU  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/c/9/c9e70b1b7e15f1b8fa0ac78fef0d14de93ee32b6.jpeg)

EDIT: Something that might show what I’m talking about is here

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/f/b/fbe9f3e7f44a72e86e79447a4a1e0319506da121.jpeg)  
The lightmaps seem to have been offset so that the shadow from some other area has been projected onto another

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [August 28, 2021, 8:24am UTC](https://forums.unrealengine.com/t/gpu-lightmass-bake-breaks-after-encoding-instanced-static-mesh/247540/6 "2021-08-28T08:24:13Z")

</div>

Very wierd indeed.  
Build a project to share and submit a bug report - doubt it’ll do any good, but its worth a shot…

---

<div class="post-metadata">

**Author:** ![emreaser1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@emreaser1](https://forums.unrealengine.com/u/emreaser1)\
**Post date:** [March 1, 2022, 11:19am UTC](https://forums.unrealengine.com/t/gpu-lightmass-bake-breaks-after-encoding-instanced-static-mesh/247540/7 "2022-03-01T11:19:19Z")

</div>

I’m having the exact same problem with instanced static meshes when building with GPULightmass. Did you find any solution?

---

<div class="post-metadata">

**Author:** ![Albarnie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Albarnie](https://forums.unrealengine.com/u/Albarnie)\
**Post date:** [April 17, 2022, 8:19am UTC](https://forums.unrealengine.com/t/gpu-lightmass-bake-breaks-after-encoding-instanced-static-mesh/247540/8 "2022-04-17T08:19:53Z")

</div>

not yet. I think it may be due to components not having unique names, but was unable to come to any conclusions there.
