landscape.RenderNanite
landscape.RenderNanite
#Overview
name: landscape.RenderNanite
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Render Landscape using Nanite.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of landscape.RenderNanite is to control whether landscapes are rendered using Nanite, Unreal Engine’s virtualized geometry system. This setting is primarily used for the rendering system, specifically for landscape rendering.
The Unreal Engine subsystem that relies on this setting variable is the Landscape module, as evidenced by its usage in the Landscape.cpp and LandscapeSubsystem.cpp files.
The value of this variable is set through a console variable (CVar) named “landscape.RenderNanite”. It is initialized with a default value of 1, indicating that Nanite rendering for landscapes is enabled by default.
The associated variable GRenderNaniteLandscape interacts directly with landscape.RenderNanite. They share the same value, and GRenderNaniteLandscape is used in the C++ code to check whether Nanite rendering should be applied to landscapes.
Developers must be aware that this variable affects the rendering method of landscapes. When enabled, it uses Nanite for landscape rendering, which can significantly impact performance and visual quality. The variable is marked with ECVF_Scalability and ECVF_RenderThreadSafe flags, indicating that it’s related to scalability settings and is safe to modify from the render thread.
Best practices when using this variable include:
- Consider performance implications when enabling or disabling Nanite for landscapes.
- Test the impact on different hardware configurations, as Nanite performance can vary.
- Be aware that changing this value at runtime will trigger updates in the LandscapeSubsystem.
Regarding the associated variable GRenderNaniteLandscape:
The purpose of GRenderNaniteLandscape is to provide a C++ accessible boolean flag for whether Nanite should be used for landscape rendering.
It is used within the Landscape module, specifically in the ALandscapeProxy::UpdateRenderingMethod function to determine if Nanite should be active for landscape rendering.
The value of GRenderNaniteLandscape is set through the landscape.RenderNanite console variable.
GRenderNaniteLandscape interacts directly with the landscape.RenderNanite console variable, sharing its value.
Developers should be aware that this variable is used in performance-critical rendering code and should be careful when modifying it directly.
Best practices for GRenderNaniteLandscape include:
- Avoid modifying this variable directly; instead, use the landscape.RenderNanite console command.
- When reading this variable in performance-critical code, consider caching its value to avoid frequent checks.
- Be aware that changes to this variable will affect all landscapes in the scene.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/Landscape.cpp:220
Scope: file
Source code excerpt:
int32 GRenderNaniteLandscape = 1;
FAutoConsoleVariableRef CVarRenderNaniteLandscape(
TEXT("landscape.RenderNanite"),
GRenderNaniteLandscape,
TEXT("Render Landscape using Nanite."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
extern int32 GGrassEnable;
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeSubsystem.cpp:174
Scope (from outer to inner):
file
function void ULandscapeSubsystem::Initialize
Source code excerpt:
}
static IConsoleVariable* LandscapeNaniteEnabledCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("landscape.RenderNanite"));
if (LandscapeNaniteEnabledCVar && !LandscapeNaniteEnabledCVar->OnChangedDelegate().IsBoundToObject(this))
{
LandscapeNaniteEnabledCVar->OnChangedDelegate().AddUObject(this, &ULandscapeSubsystem::OnNaniteEnabledChanged);
}
TextureStreamingManager = new FLandscapeTextureStreamingManager();
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeSubsystem.cpp:228
Scope (from outer to inner):
file
function void ULandscapeSubsystem::Deinitialize
Source code excerpt:
}
static IConsoleVariable* LandscapeNaniteEnabledCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("landscape.RenderNanite"));
if (LandscapeNaniteEnabledCVar)
{
LandscapeNaniteEnabledCVar->OnChangedDelegate().RemoveAll(this);
}
Scalability::OnScalabilitySettingsChanged.Remove(OnScalabilityChangedHandle);
#Associated Variable and Callsites
This variable is associated with another variable named GRenderNaniteLandscape
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/Landscape.cpp:218
Scope: file
Source code excerpt:
#endif // WITH_EDITOR
int32 GRenderNaniteLandscape = 1;
FAutoConsoleVariableRef CVarRenderNaniteLandscape(
TEXT("landscape.RenderNanite"),
GRenderNaniteLandscape,
TEXT("Render Landscape using Nanite."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
extern int32 GGrassEnable;
extern int32 GGrassMapUseRuntimeGeneration;
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/Landscape.cpp:6693
Scope (from outer to inner):
file
function void ALandscapeProxy::UpdateRenderingMethod
Source code excerpt:
bool bNaniteActive = false;
if ((GRenderNaniteLandscape != 0) && HasNaniteComponents())
{
bNaniteActive = UseNanite(GShaderPlatformForFeatureLevel[GEngine->GetDefaultWorldFeatureLevel()]);
#if WITH_EDITOR
if (ALandscape* LandscapeActor = GetLandscapeActor())
{
if (UWorld* World = LandscapeActor->GetWorld())