Nanite Landscape never fully excluded from GI even with r.DisableLandscapeNaniteGI enabled

It seems that the CVar r.DisableLandscapeNaniteGI is not working as intended. Its value is only evaluated inside FLandscapeNaniteSceneProxy constructor (LandscapeRenderer.cpp), and if it is 1 (default) four booleans related to GI are correctly set to false. The problem is that, despite this CVar, the Nanite Landscape is never fully excluded from GI.

In fact, in LumenSceneCardCapture.cpp (around line 750), the code iterates over SceneInfoPrimitives (array of FPrimitiveSceneInfo) and for each of them it evaluates if the related proxy should “AffectDynamicIndirectLighting”, but the proxy here, if it is a landscape has type FLandscapeComponentSceneProxy, which is NOT related to FLandscapeNaniteSceneProxy. The result is that the four booleans set in FLandscapeNaniteSceneProxy are not properly taken into account. So every FLandscapeComponentSceneProxy will be marked as “AffectsDynamicIndirectLighting”, that allows it to enter the if; once in it, rasterization of cards will happen, either with Nanite pipeline or with standard pipeline, even though GI should be disabled (according to r.DisableLandscapeNaniteGI).

Here is the code snippet of where the bug is (LumenSceneCardCapture.cpp around line 750 in 5.6).

for (const FPrimitiveSceneInfo* PrimitiveSceneInfo : SceneInfoPrimitives)
{
	if (PrimitiveSceneInfo
		&& PrimitiveSceneInfo->Proxy->AffectsDynamicIndirectLighting()
		&& WorldSpaceCardBox.Intersect(PrimitiveSceneInfo->Proxy->GetBounds().GetBox()))
	{
		Resterization of cards...
	}
}

We tried a fix that resolved the problem: in LandscapeRender.cpp inside the constructor of FLandscapeComponentSceneProxy we’ve add this code just below the call to UpdateVisibleInLumenScene:

if (bNaniteActive && GDisableLandscapeNaniteGI != 0)
{
	bVisibleInLumenScene = false;
	bSupportsDistanceFieldRepresentation = false;
	bAffectDynamicIndirectLighting = false;
	bAffectDistanceFieldLighting = false;
}

With this code we override whatever value has been set in UpdateVisibileInLumenScene and we avoid any landscape lumen card capturing, since they contribute to GI that should be disabled for Landscape.

Steps to Reproduce

  • Have a map with a Nanite Landscape
  • Have Lumen enabled
  • Have r.DisableLandscapeNaniteGI enabled (1)
  • Toggle r.LumenScene.SurfaceCache.RecaptureEveryFrame to have Lumen Card captures every frame
  • Observe that in GPU landscape cards are always captured

Hello,

Thank you for reaching out.

I’ve been assigned this issue, and we will be looking into Lumen GI using Nanite Landscape when “r.DisableLandscapeNaniteGI” is enabled for you.

Hello,

The behavior you are observing is expected.

When “r.DisableLandscapeNaniteGI” is enabled, it will fall back to using the heightfield for GI, distance fields, and ray tracing.

The description of the CL that added this (CL: 20660048) reads:

Disabled Nanite landscape representation from GI, distance fields, and ray tracing in favor of non-Nanite heightfield versions

Please let us know if this helps.

Hi,

Thanks for the answer!

So, is there a way to completely exclude Landscape from GI, so that it has no contribution to GI and Lumen Cards are not rasterized and shaded?

Hello,

Are you able to disable the “Affect Dynamic Indirect Lighting” checkbox on the Landscape Actor within the Details panel in the editor?

Hello,

Sorry for the late answer.

I cannot uncheck “Affect Dynamic Indirect Lighting” because it is greyed out, since “Cast Shadow” is false (as stated in the checkbox tooltip). Despite being greyed out and ignored, i still see Lumen card rasterization in GPU captures.

Hello,

“Affect Dynamic Indirect Lighting” is not controlled by “Cast Shadow”.

[Image Removed]Are you possibly confusing it with the similarly named “Affect Distance Field Lighting” right above that is controlled by “Cast Shadow”?

Please also make sure you are checking on the Landscape Actor itself, not the Landscape Proxies. The Landscape Proxies use an override system (two checkboxes per property) and only affect that proxy actor, not the entire Landscape.

Please let us know if this helps.

Hello,

My bad, i’ve confused those two flags. Using “Affect Distance Field Lighting” correctly disables Landscape contribution to GI. I have not verified if Lumen cards are still computed for the landscape in that situation.

Thansk for the support!

Hello,

Thank you for the reply.

Can we close your case? You can always re-open it if you need additional assistance for the same issue.