FLightPrimitiveInteraction

Hi

I have been profiling our game, and we are hitting slow downs in

UpdateLightTransform_RenderThread

With moving spot/point lights

If I force

const bool bUpdatePrimitiveInteractions

to false

I save 3ms overall, the UpdateLightTransform_RenderThread becomes much much faster

But I notice no visual difference? Shadows still work as well

(We are using VSMs & Nanite)

I am trying to understand FLightPrimitiveInteraction

But I just don’t see what it is actually used for

Something like cached shadow maps, but are these for the old shadow system?

Is this safe to disable?

It’s expensive as our scene is quite large, so the destruction/creation of a new LPI which also does a primitve octtree insertion

It all adds up pretty quick

Thanks

Karl

Hello,

Thank you for reaching out.

I’ve been assigned this issue, and we will be looking into your questions about Light Primitive Interactions for you.

Hello,

Instead of hardcoding “bUpdatePrimitiveInteractions” to false, you can disable the CVar “r.Visibility.LocalLightPrimitiveInteraction” for the same effect.

For more information about this CVar, please see this documentation:

https://dev.epicgames.com/documentation/en\-us/unreal\-engine/megalights\-in\-unreal\-engine\#performance

This will also disable behavior updating the Light Primitive Interactions in other areas in the code. For more information, please see the uses of “DoesPlatformNeedLocalLightPrimitiveInteraction(…)”.

If you are using Megalights with ray tracing for everything, then enabling this CVar is recommended.

While Light Primitive Interactions are primarily focused on Cascaded Shadow Maps and baked lighting, Virtual Shadow Maps will still use the Light Primitive Interactions for some types of geometry. A notable example is Translucent Volumetric Shadows.

Other functionality depends on Light Primitive Interactions, including:

  • “IRendererModule::GetNumDynamicLightsAffectingPrimitive(…)” - This function isn’t used by default, but is an available part of the interface.
  • “FSceneInterface::GetRelevantLights(…)” - Used for various editor utilities, stats readouts, and debug utilities, including the showflag “LightInfluences” and the “Select->Select Relevant Lights” Editor action.

Please let us know if this helps.

This is really helpful thank you

It certainly seems to benefit us with VSM + moving lights in a complex scene

We will test more to make sure no other visual issues caused but seems good so far

Thank you, please close this thread :slight_smile: