Assertion failed: InShadingModel < MSM_NUM (crash when building lighting)

One of my maps crashes every time I try to build lighting, with the error message “Assertion failed: InShadingModel < MSM_NUM”.

I was wondering if anyone else has run into this issue or has a solution. I’m not sure what this error message means.

‘MSM_NUM’ means number of unique shading models, so I thought maybe recompiling shaders might fix it, but that’s not the solution. I also tried switching RHI from DX12 to 11 and vulkan, but that didn’t fix it either.

GPU lightmass still works, but it gives me different results than the traditional static light build, so I’m stuck. I’m on 5.0.2.

Here’s the full crash message below

Assertion failed: InShadingModel < MSM_NUM [File:D:\build++UE5\Sync\Engine\Source\Runtime\Engine\Classes\Engine\EngineTypes.h] [Line: 609]
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll

Facing same issue, from my logs it looks like some lightmass issue. I’ve not been able to resolve it yet. Help appreciated!

I had this crash here when building light, maybe what I did will help you:

  1. Open your project .sln and start unreal by pressing play on Local Debug NANANA
  2. Build light so it crashes
  3. On the callstack, look for FMaterial::BeginCompileShaderMap(…) (search from bottom to top on callstack) and double click it
  4. On the “Autos” tab, look for This->FLightMassMaterialProxy->Material . There you’ll find a material name thats involved in the crash.

Other function that I looked into was on the callstack on FMaterialAttributeDefintion::CompileDefaultValue(…) (search from top to bottom on callstack) which indicated this line:
if (Property == MP_SubsurfaceColor && Compiler->GetMaterialShadingModels().HasShadingModel(MSM_TwoSidedFoliage))

So, with that info I went to the material pointed and changed the shading model to lit instaed of TwoSidedFoliage. I don’t know why that problem happened but that worked for me.