Foliage Causing Lag from Lighting

I’m trying to figure out how to light the foliage in my scene. Currently, the foliage is set to movable. When I set my directional light to movable, the scene runs very smoothly. However, if I put it to stationary and bake for static meshes, the foliage seems to become extremely heavy and cause a lot of lag. Why would this happen if it works well with pure dynamic lighting?

Light cost is always based on amount of tris being lit x number of lights.
this means: more meshes = less performance.

There could be tons of legitimate reasons why you have performance issues in one way vs the other, to start usually early z pass and transparency overdraw.

For anyone to help you we need the engine version and your light settings for static.
also, is there a skylight in the scene?

And are you sure the issue is the foliage? If you hide the foliage with the appropriate flag (even freeze rendering then turn around would work to check fps in a pinch) do you get at least the same performance you would with dynamic lighting and no foliage? Look at ms counts for this, since fps would likely be above 120

I’m almost entirely sure it’s the foliage. My profiling Max MS numbers with each mobility type for the directional light: Movable - 24 Stationary - 70 Static - 16. When I turn off the “Dynamic Shadows” flag, it clearly changes all of the foliage shadows and the Stationary numbers reduce to be in line with the others. My overdraw visualization is all blue to green, no red or pink.

This is in 4.25.3. The shadows that the foliage casts in Movable is different than Stationary. I thought that Stationary applies Movable dynamic shadows to dynamic objects and baked lighting to static objects, so I don’t understand why the two result in different shadows from the foliage. With fully dynamic or fully static lighting I have no performance issues, only stationary. All other settings remain the same in each case, including same skylight and all meshes are the same.

Usually vegetaion is movable because of vertex animation wind, so it isn’t exactly common to set it to stationary as far as my development goes.

Also, 25.4 should be out. Maybe it could potentially fix that?

If not.
then I suppose you need to check if the foliage affects volumetric lighting and if that is set up and working with stationary toggled… about the only thing I can think of at the moment based on what you described…

https://forums.unrealengine.com/core/create-content/text/

The vegetation is movable. It’s the directional light that is stationary. I don’t understand why a movable directional light is performant, but a stationary one isn’t. Nothing else is changing other than the directional light mobility settings in my tests.

The different modes on the light will light things diffently / they all have different specific settings.

The extra hit could be caused by something like LightMass settings having use area shadows enabled.

The mode also uses distance field.

Also from the docs (which I didn’t know either):
Direct Shadowing
Realtime shadowing of light sources has a major performance cost. A fully dynamic light with shadows will often cost twenty times (20x) as much to render than a dynamic light without shadows. For this reason, stationary lights have the ability to have static shadowing on static objects, but with some limitations.

My guess given that, is that the shadow options on the foliage are set to be fully dynamic.
Changing to static ignores all of that. Changing to dynamic costs less, and going with stationary would have the highest cost - I believe.

Hi,

AFAIK when you have many movable objects, then stationary lightning gets more heavy than a movable light, but I never used a stationary light myself, so to cite the documentation:

https://docs.unrealengine.com/en-US/Engine/Rendering/LightingAndShadows/LightMobility/StationaryLights/index.html

What you could do is set the foliage to “static” instead. Then set the dynamic shadow distance of your directional light to something like 4000, so that you get dynamic shadows up to that distance and can see the foliage shadows move with the vertex animation and for further than those 4000cm you will get static shadows.

https://forums.unrealengine.com/core/create-content/text/

Thank you guys for the help. The shadow distance adjustments seem to have helped a lot for now.