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.