Fix for stationary spotlights with GPU Lightmass w/o VSMs (UE-291212)

This is a potential fix for UE-291212 (Unreal Engine Issues and Bug Tracker (UE-291212)) to fix stationary spotlights and other issues with stationary lights when using GPU Lightmass to build lighting in projects that don’t use virtual shadow maps.

The primary issue is that the FLightShaderConstants struct in C++ (Lights.h) does not match the FLightShaderConstants in the shader (LightmapPathTracing.usf). Specifically, UE 5.5 broke this when the DiffuseScale parameter was added to the wrong place in the C++ struct.

A secondary issue is that the FLightRenderParameters struct in C++ has no default constructor, and GPU Lightmass’s GetLightShaderParameters() functions do not initialize all the values in those structs, which can result in garbage from random memory being sent to the GPU, leading to indeterminate results.

This is the diff of my changes against UE 5.5; we’re not on 5.6 yet but it doesn’t look like GPU Lightmass has changed significantly so it should be straightforward to make these changes even if the line numbers don’t exactly match up.

I don’t know what the protocol here is, should I make a pull request on Github?

1 Like

If you are interested in community efforts of further development/maintenance of GPULM, see: Epic's GPUlightmass - #668 by yujiang.wang. Your original issue was resolved in the community fork at https://github.com/AlanIWBFT/UnrealEngine/commit/0b682c7c26557de72a9ae3eab9ac98beb9d0d666.