Broken Cull Distance on foliage shadows (and strange 10 factor multiplier)

When I set a max cull distance on foliage, the instances in main view properly cull away father than that. However shadows of those instances are still visible.

Steps to Reproduce
Open the map and move around.

And if you look at the foliage properties, Cull Distance is set to 400 (so 4 meters), however it seems to be set to 4000.

Hello,

Thank you for reaching out.

I’ve been assigned this issue, and we will be looking into the cull distance on the foliage for you.

Hello,

The first issue you mentioned (shadows not culling at the same distance) is related to VSM shadow caching.

You could solve this issue by setting the “Shadow Cache Invalidation Behavior” to “Always”, but this would have performance implications. Alternatively, you can use various art-directed controls, such as disabling shadow on the foliage, controlling shadows in the Material, or using foliage draw distances large enough it isn’t noticeable.

We were unable to reproduce the second issue (the distance being wrong). When checking your test project, the distance the foliage culled at was 400 units. Is the issue resolved if you reload the level after setting the culling distance?

Please let us know if this helps.

I understood the shadow issue.

I tried reloading the map but the issue persisted: the cubes are culled after 4000 units, not 400. I checked some cvars that may have scaled up the value but everything is set to 1.

It seems that I cannot even use foliage.CullDistanceScale anymore (even If I enabled "Enable Cull Distance Scaling in the foliage type)

Hello,

Are you able to reproduce this issue in vanilla? We have not been able to.

What value are you trying to set “foliage.CullDistanceScale” to?

Keep in mind that “foliage.CullDistanceScale” is clamped to the range [0,1]. For more information, please see the usage of “CVarFoliageCullDistanceScale” in “FFoliageStaticMesh::UpdateComponentSettings(…)” from InstancedFoliage.cpp.

Yes: I reproduced this on vanilla. If you can’t with the attached project, maybe is some custom user property on my PC?

I tried to check foliage.CullDistanceScale value (it was 1.0).

If I enable “enable cull distance scaling” on the foliage type and I set foliage.CullDistanceScale = 0.1, I see the correct behavior (so the instances are culled after the specified distance of 4 meters).

The issue persisted even if I create a new map, a new foliage type, using a standard mesh.

Hello,

Can you please try clearing your DDC? It is possible some stale data is causing the issue.

You can clear the DDC by renaming / deleting the folder “DerivedDataCache” in your project directory and the engine directory.

If this does not work, can you please try reproducing the issue on another workstation (if available)?

I cleared project’s and engine’s DerivedDataCache folders: the issue persisted.

This is just an issue with my local machine: a coworker of mine can’t reproduce the issue with the attached project zip file.

I even tried to delete the project’s folder and reextract it from the zip file: I am the only one with the issue.

Hello,

Thank you for confirming this.

Have you checked if this happens on other versions of Unreal Engine as well, or is it just 5.6?

It is possible that an editor setting is affecting the behavior. To isolate this, can you try deleting / renaming the “Saved” directory in both the engine and project folders?

If that do not work, please try also deleting / renaming “C:/Users/<user>/AppData/Local/UnrealEngine/”. This directory contains settings for installed engine versions and settings shared across all engines.

If that does not work, can you try with a clean build? If you are using an installed version for vanilla tests, this would be a clean install. If you are using Perforce or other revision control system and building from source, you can check if any files might have been modified unintentionally.

If none of that works, your best option might be to debug the HISM CPU culling code (with Nanite disabled on the mesh), to determine why the value is multiplied by 10. Please let us know if you need additional guidance to navigate this code.

Please let us know if this helps.