Landscape renders incorrectly on packaged Game

The landscape appears “chunky” on packaged build & StandAlone game but it looks fine in the editor.

Do you know what could be wrong here ?
This happens in 5.0 and 5.1, how could I fix this ? I tried to rebuild the Landscape a few times.

Things I tried:

  • Deleting DDC/Intermediate folder
  • Building All Landscape
  • Changing Scaling parameters
  • Tweaking Landscape LOD settings
  • Deleting Game/Engine/Editor Configs

1 Like

Also experiencing this problem.

The hack I came up with to “fix” this is to call, this function for a few frames at the beginning of the game.


void UGKSharedBlueprint::FixLandscape(UObject* WorldCtx) {

    for (auto* LandscapeComponent : TObjectRange<ULandscapeComponent>(RF_ClassDefaultObject | RF_ArchetypeObject, true, EInternalObjectFlags::Garbage))
    {
        LandscapeComponent->MarkRenderStateDirty();
    }
}

On my side I firmly believe this is an engine bug.

Background

I came up with this hack when I noticed that running r.LandscapeLOD0DistributionScale 1 seemed to fix the issue.

Nevertheless, calling this inside a Shipping build does nothing, so I deduced that what fixed the rendering was the delegate that gets called on non-shipping builds when the distribution scale gets modified.

#if !UE_BUILD_SHIPPING
static void OnLODDistributionScaleChanged(IConsoleVariable* CVar)
{
	for (auto* LandscapeComponent : TObjectRange<ULandscapeComponent>(RF_ClassDefaultObject | RF_ArchetypeObject, true, EInternalObjectFlags::Garbage))
	{
		LandscapeComponent->MarkRenderStateDirty();
	}
}
#endif

float GLandscapeLOD0DistributionScale = 1.f;
FAutoConsoleVariableRef CVarLandscapeLOD0DistributionScale(
	TEXT("r.LandscapeLOD0DistributionScale"),
	GLandscapeLOD0DistributionScale,
	TEXT("Multiplier for the landscape LOD0DistributionSetting property"),
#if !UE_BUILD_SHIPPING
	FConsoleVariableDelegate::CreateStatic(&OnLODDistributionScaleChanged),
#endif
	ECVF_Scalability
);