r.HeterogeneousVolumes.OrthoGrid.ShadingRate
r.HeterogeneousVolumes.OrthoGrid.ShadingRate
#Overview
name: r.HeterogeneousVolumes.OrthoGrid.ShadingRate
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The voxelization rate (Default = 4.0)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HeterogeneousVolumes.OrthoGrid.ShadingRate is to control the voxelization rate for heterogeneous volumes in the rendering system of Unreal Engine 5. This setting variable is specifically used for the orthographic grid in the heterogeneous volumes rendering pipeline.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, specifically within the heterogeneous volumes subsystem. It’s defined and used in the HeterogeneousVolumesVoxelGridPipeline.cpp file, which suggests it’s an integral part of the voxel grid pipeline for heterogeneous volumes.
The value of this variable is set as a console variable with a default value of 4.0. It can be modified at runtime through the console or configuration files.
This variable interacts directly with its associated variable CVarHeterogeneousVolumesOrthoGridShadingRate. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the voxelization rate of the orthographic grid in heterogeneous volumes. A higher value will result in a coarser voxelization, while a lower value will produce a finer voxelization. This can have implications for both rendering quality and performance.
Best practices when using this variable include:
- Adjusting it based on the specific needs of your scene and the desired balance between quality and performance.
- Testing different values to find the optimal setting for your particular use case.
- Being mindful of the performance impact when setting very low values, as this could significantly increase the voxelization resolution.
Regarding the associated variable CVarHeterogeneousVolumesOrthoGridShadingRate:
This is a TAutoConsoleVariable of type float, which means it’s a console variable that can be adjusted at runtime. It’s defined with the same name as the setting variable (“r.HeterogeneousVolumes.OrthoGrid.ShadingRate”), the same default value (4.0), and the same description.
The purpose of this associated variable is to provide a programmatic way to access and modify the shading rate setting within C++ code. It’s used in the GetShadingRateForOrthoGrid() function, where its value is retrieved using the GetValueOnRenderThread() method. This function ensures that the returned value is never less than 0.1, providing a safeguard against potentially problematic very low values.
When working with this associated variable, developers should:
- Use the GetValueOnRenderThread() method when accessing its value from render thread code.
- Be aware that changes to this variable will directly affect the r.HeterogeneousVolumes.OrthoGrid.ShadingRate setting.
- Consider the thread safety implications, as indicated by the ECVF_RenderThreadSafe flag used in its declaration.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:66
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarHeterogeneousVolumesOrthoGridShadingRate(
TEXT("r.HeterogeneousVolumes.OrthoGrid.ShadingRate"),
4.0,
TEXT("The voxelization rate (Default = 4.0)"),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesOrthoGridVoxelizationMode(
#Associated Variable and Callsites
This variable is associated with another variable named CVarHeterogeneousVolumesOrthoGridShadingRate
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:65
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<float> CVarHeterogeneousVolumesOrthoGridShadingRate(
TEXT("r.HeterogeneousVolumes.OrthoGrid.ShadingRate"),
4.0,
TEXT("The voxelization rate (Default = 4.0)"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:322
Scope (from outer to inner):
file
namespace HeterogeneousVolumes
function float GetShadingRateForOrthoGrid
Source code excerpt:
float GetShadingRateForOrthoGrid()
{
return FMath::Max(CVarHeterogeneousVolumesOrthoGridShadingRate.GetValueOnRenderThread(), 0.1);
}
int32 GetMaxBottomLevelMemoryInMegabytesForOrthoGrid()
{
return FMath::Max(CVarHeterogeneousVolumesOrthoGridMaxBottomLevelMemoryInMegabytes.GetValueOnRenderThread(), 1);
}