r.RayTracing.Geometry.LandscapeGrass
r.RayTracing.Geometry.LandscapeGrass
#Overview
name: r.RayTracing.Geometry.LandscapeGrass
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Include landscapes grass in ray tracing effects (default = 1)
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RayTracing.Geometry.LandscapeGrass is to control the inclusion of landscape grass in ray tracing effects within Unreal Engine 5. This setting variable is part of the ray tracing system and specifically affects the rendering of landscape grass elements.
This variable is primarily used by the Landscape and Rendering subsystems of Unreal Engine. It’s referenced in the Landscape module (LandscapeGrass.cpp), the Engine module (PrimitiveSceneProxy.cpp and NaniteResources.cpp), and the Renderer module (RayTracing.cpp).
The value of this variable is set through a console variable (CVar) system. It’s defined as an integer with a default value of 0, which means landscape grass is not included in ray tracing effects by default.
This variable interacts with other ray tracing-related variables, such as those for static meshes, hierarchical instanced static meshes, and Nanite proxies. It’s often checked alongside these other variables when determining which elements to include in ray tracing.
Developers must be aware that this variable can significantly impact performance and visual quality. Including landscape grass in ray tracing can increase realism but may also increase computational load.
Best practices when using this variable include:
- Consider performance implications before enabling it, especially for large landscapes or scenes with extensive grass coverage.
- Test thoroughly with different values (0 or 1) to balance visual quality and performance.
- Use in conjunction with other ray tracing settings for a cohesive look.
- Be mindful of its impact on different hardware configurations, as ray tracing is computationally expensive.
- Consider exposing this setting to end-users as a high-end graphics option.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeGrass.cpp:205
Scope: file
Source code excerpt:
#if RHI_RAYTRACING
static TAutoConsoleVariable<int32> CVarRayTracingLandscapeGrass(
TEXT("r.RayTracing.Geometry.LandscapeGrass"),
0,
TEXT("Include landscapes grass in ray tracing effects (default = 1)"));
#endif
const TCHAR* GGrassQualityLevelCVarName = TEXT("r.grass.DensityQualityLevel");
const TCHAR* GGrassQualityLevelScalabilitySection = TEXT("ViewDistanceQuality");
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PrimitiveSceneProxy.cpp:1795
Scope (from outer to inner):
file
function ERayTracingPrimitiveFlags FPrimitiveSceneProxy::GetCachedRayTracingInstance
Source code excerpt:
}
static const auto RayTracingLandscapeGrassCVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.RayTracing.Geometry.LandscapeGrass"));
if (bIsLandscapeGrass && RayTracingLandscapeGrassCVar && RayTracingLandscapeGrassCVar->GetValueOnRenderThread() <= 0)
{
return ERayTracingPrimitiveFlags::Exclude;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Rendering/NaniteResources.cpp:1937
Scope (from outer to inner):
file
namespace Nanite
function ERayTracingPrimitiveFlags FSceneProxy::GetCachedRayTracingInstance
Source code excerpt:
}
static const auto RayTracingLandscapeGrassCVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.RayTracing.Geometry.LandscapeGrass"));
if (bIsLandscapeGrass && RayTracingLandscapeGrassCVar && RayTracingLandscapeGrassCVar->GetValueOnRenderThread() <= 0)
{
return ERayTracingPrimitiveFlags::Exclude;
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracing.cpp:107
Scope (from outer to inner):
file
function static void RefreshRayTracingInstancesSinkFunction
Source code excerpt:
static const auto RayTracingHISMCVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.RayTracing.Geometry.HierarchicalInstancedStaticMesh"));
static const auto RayTracingNaniteProxiesCVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.RayTracing.Geometry.NaniteProxies"));
static const auto RayTracingLandscapeGrassCVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.RayTracing.Geometry.LandscapeGrass"));
static int32 CachedRayTracingStaticMeshes = RayTracingStaticMeshesCVar->GetValueOnGameThread();
static int32 CachedRayTracingHISM = RayTracingHISMCVar->GetValueOnGameThread();
static int32 CachedRayTracingNaniteProxies = RayTracingNaniteProxiesCVar->GetValueOnGameThread();
static int32 CachedRayTracingLandscapeGrass = RayTracingLandscapeGrassCVar->GetValueOnGameThread();