# GPU lightmass doesn't cast shadow (stationary light, static geometry)

**URL:** <https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447>\
**Category:** Rendering\
**Tags:** Shadows, gpu-lightmass, unreal-engine, question\
**Created:** [July 6, 2023, 4:40pm UTC](https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447 "2023-07-06T16:40:07Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![kolja\_k1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kolja\_k1](https://forums.unrealengine.com/u/kolja_k1)\
**Post date:** [July 6, 2023, 4:40pm UTC](https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447/1 "2023-07-06T16:40:07Z")

</div>

Hi, I’m having this section in my level where GPU lightmass doesn’t want to cast any shadow at all from my stationary spotlights. It works perfectly fine with the “standard” lighting build, though. (UE 5.2.1)

I’ve played with all options I could think of, put a big fat cube in the light cone, created a new spotlight in place of the old one, changed the light to static, but nothing helps.

Any ideas why the behavior is so different here? I would love to stick with GPU lightmass, because it produces much nicer shadows in other areas of my map.

Here’s what it looks like after a normal llighting build:

 ![baked-cpu2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/6/2/06244e09dea0051be478662fbbc1640d6d8097d7.jpeg)

And this is with GPU lightmass - as if the walls aren’t there:

 ![baked-gpu2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/0/f/80f5b986c4faf244083e072c65513c1340d0f300.jpeg)

---

<div class="post-metadata">

**Author:** ![brianegreen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@brianegreen](https://forums.unrealengine.com/u/brianegreen)\
**Post date:** [July 27, 2023, 11:43pm UTC](https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447/2 "2023-07-27T23:43:54Z")

</div>

I am experiencing some similar issues with shadows not casted when using gpu lightmass with 5.2.1. The non gpu lightmass appears to work fine, but gpu lightmass indiscriminately seems to cast shadows from some objects but not from others. I am just in the process of porting my demo project to the 5.2.1 version of unreal.

---

<div class="post-metadata">

**Author:** ![PabloNajurieta](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PabloNajurieta](https://forums.unrealengine.com/u/PabloNajurieta)\
**Post date:** [August 9, 2023, 1:08pm UTC](https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447/3 "2023-08-09T13:08:48Z")

</div>

Same issue here with 5.2.1, some meshes cast shadows, some don’t and nothing seems to fix it.

---

<div class="post-metadata">

**Author:** ![Kettenotter](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kettenotter/32/620822_2.png) [@Kettenotter](https://forums.unrealengine.com/u/Kettenotter)\
**Post date:** [August 14, 2023, 11:35pm UTC](https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447/4 "2023-08-14T23:35:15Z")

</div>

Same for me. It feels very random. Sometimes the whole level, sometimes half of it.

It’s as if for some materials the cast ray traced shadows where unticked even though they are not.

I have skipped to 5.3 for now and it looks like the problems are mostly gone. (But some new ones are there)

Tried a lot of different things in 5.2.1 but couldn’t find a reliable cause. Could also be something with Nvidia, DX12…  
A static mesh would cast shadows but a duplicate of it might not.

---

<div class="post-metadata">

**Author:** ![PabloNajurieta](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PabloNajurieta](https://forums.unrealengine.com/u/PabloNajurieta)\
**Post date:** [August 21, 2023, 6:51am UTC](https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447/5 "2023-08-21T06:51:13Z")

</div>

I noticed it is some setting in my DefaultEngine.ini (I don’t know which setting), when I use a DefaultEngine.ini from a new project it works well.

---

<div class="post-metadata">

**Author:** ![Kettenotter](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kettenotter/32/620822_2.png) [@Kettenotter](https://forums.unrealengine.com/u/Kettenotter)\
**Post date:** [August 31, 2023, 2:14pm UTC](https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447/6 "2023-08-31T14:14:45Z")

</div>

Okay I finally found the problem and fix:  
The shaders wouldn’t compile correctly and use an outdated cache.

Changing the material will fix it because it will compile a new shader cache. But what helped was setting a local shader cache path so that new clean shaders would be compiled.  
Here is where you can change the setting:

 ![UnrealEditor_898](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/3/8/a38e8f49f2d82279d874b38db94e5ec85ce1fc42.png)

---

<div class="post-metadata">

**Author:** ![ProletarianX](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ProletarianX](https://forums.unrealengine.com/u/ProletarianX)\
**Post date:** [September 14, 2023, 2:55pm UTC](https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447/7 "2023-09-14T14:55:13Z")

</div>

Great! Thank you so much, that fixed it.

---

<div class="post-metadata">

**Author:** ![Henri\_arforia](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Henri\_arforia](https://forums.unrealengine.com/u/Henri_arforia)\
**Post date:** [September 28, 2023, 9:19am UTC](https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447/8 "2023-09-28T09:19:39Z")

</div>

The cache solution above is working, but it breaks after a few tweaks so i have to rebuild my shaders very often and its a very long process… Is there any other way we could fix this permanently ? Thx

---

<div class="post-metadata">

**Author:** ![LEIT](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/leit/32/1069506_2.png) [@LEIT](https://forums.unrealengine.com/u/LEIT)\
**Post date:** [January 27, 2024, 5:31am UTC](https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447/9 "2024-01-27T05:31:50Z")

</div>

You are the hero of the day. I’ve been mowing through settings hundreds of times, with no results that were acceptable. It was a shader directory ref. How, did you figure this one out?

---

<div class="post-metadata">

**Author:** ![LEIT](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/leit/32/1069506_2.png) [@LEIT](https://forums.unrealengine.com/u/LEIT)\
**Post date:** [January 27, 2024, 5:34am UTC](https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447/10 "2024-01-27T05:34:55Z")

</div>

If this is still a problem, the post said that just the landscape material could have the shaders reloaded. If that’s true, you should only have change the landscape material to refresh, instead of the entire project.

---

<div class="post-metadata">

**Author:** ![Kettenotter](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kettenotter/32/620822_2.png) [@Kettenotter](https://forums.unrealengine.com/u/Kettenotter)\
**Post date:** [February 2, 2024, 11:11am UTC](https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447/11 "2024-02-02T11:11:43Z")

</div>

From the behavior: once a material didn’t cast shadows anymore it would stay this way for this configuration. So I thought it had something to do with how shaders are generated and cached.  
Like the material only compiles shader for what is required. So if there is no need for static shadows it would not compile it for it. But when later a need for it arises it would not trigger the correct recompile I think.

Changing the directory would provide a clean place to recompile the shaders properly. Deleting the shader’s from the shared directory should also work.

---

<div class="post-metadata">

**Author:** ![Kettenotter](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kettenotter/32/620822_2.png) [@Kettenotter](https://forums.unrealengine.com/u/Kettenotter)\
**Post date:** [February 2, 2024, 11:13am UTC](https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447/12 "2024-02-02T11:13:06Z")

</div>

Okay for everybody having still problems you can look into this one for a fix:

> [@GPU Lightmass not working on Landscape](https://forums.unrealengine.com/t/gpu-lightmass-not-working-on-landscape/1371174/17):
>
> Hi @hieblertom , @brisck1 @glitchered @Matthew.Ivey @motorsep @Miguel1900 , There appear to be a fix to this problem, according to the above link. This is a commit for 5.4, but its been quite easy to convert to 5.3.2 I have put the replacement binary dll file in a new repository along with the updated source. [EpicGPULightMass Landscape 5.3.2 Patch/README.md](https://github.com/jimshalo10/EpicGPULightMassPatch/blob/main/README.md) This has been built to work with 5.3.2 The only was this can be tested is by the people highlighted Therefore please can you report …

Supposedly they fixed it in 5.4 and someone ported the fix to 5.3.

---

<div class="post-metadata">

**Author:** ![Kettenotter](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kettenotter/32/620822_2.png) [@Kettenotter](https://forums.unrealengine.com/u/Kettenotter)\
**Post date:** [February 2, 2024, 11:15am UTC](https://forums.unrealengine.com/t/gpu-lightmass-doesnt-cast-shadow-stationary-light-static-geometry/1221447/13 "2024-02-02T11:15:21Z")

</div>

Look into the solution above:  
@LEIT @ProletarianX @PabloNajurieta @kolja_k1 @Henri_arforia @brianegreen

Edit:  
Another solution which might work:

> [@Epic's GPUlightmass](https://forums.unrealengine.com/t/epics-gpulightmass/139357/555):
>
> So, it’s a witchcraft… GPULM has its own mind I guess. Changed nothing, except I ticked on SM6 for DX12 and Vulcan RHIs. Got all the shadows now building. Not complaining, but…
