r.HeterogeneousVolumes.Preshading.MipLevel
r.HeterogeneousVolumes.Preshading.MipLevel
#Overview
name: r.HeterogeneousVolumes.Preshading.MipLevel
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Statically determines the MIP-level when evaluating preshaded volume data (Default = 0)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HeterogeneousVolumes.Preshading.MipLevel is to statically determine the MIP-level when evaluating preshaded volume data in the heterogeneous volumes rendering system. This setting variable is part of Unreal Engine 5’s rendering subsystem, specifically related to the heterogeneous volumes feature.
Based on the callsites, this variable is primarily used within the Renderer module, specifically in the HeterogeneousVolumes.cpp file. This indicates that it’s a part of the rendering pipeline dealing with heterogeneous volumes.
The value of this variable is set through a console variable (CVar) system. It’s defined with a default value of 0 and can be changed at runtime or through configuration files.
This variable interacts with its associated variable CVarHeterogeneousVolumesPreshadingMipLevel. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the MIP-level of preshaded volume data, which can impact rendering quality and performance. Changing this value will affect how detailed the volume data is rendered.
Best practices when using this variable include:
- Understanding the performance implications of different MIP-levels.
- Testing various values to find the optimal balance between quality and performance for your specific use case.
- Considering the target hardware when setting this value, as higher MIP-levels may be more demanding on less powerful systems.
Regarding the associated variable CVarHeterogeneousVolumesPreshadingMipLevel:
This is the actual console variable that stores the value for r.HeterogeneousVolumes.Preshading.MipLevel. It’s defined as a TAutoConsoleVariable of type int32. The GetMipLevel() function in the HeterogeneousVolumes namespace uses this variable to retrieve the current MIP-level value.
Developers should note that this value is accessed on the render thread (GetValueOnRenderThread()), which means changes to this variable will be reflected in the next frame render. This is important for understanding when changes to this setting will take effect.
When modifying this variable, developers should ensure they’re doing so in a thread-safe manner, respecting the ECVF_RenderThreadSafe flag it’s created with. Any changes should be made through the appropriate CVar modification methods to ensure thread safety and proper propagation of the new value throughout the rendering system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:107
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesPreshadingMipLevel(
TEXT("r.HeterogeneousVolumes.Preshading.MipLevel"),
0,
TEXT("Statically determines the MIP-level when evaluating preshaded volume data (Default = 0)"),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesPreshadingVolumeResolutionX(
#Associated Variable and Callsites
This variable is associated with another variable named CVarHeterogeneousVolumesPreshadingMipLevel
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:106
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesPreshadingMipLevel(
TEXT("r.HeterogeneousVolumes.Preshading.MipLevel"),
0,
TEXT("Statically determines the MIP-level when evaluating preshaded volume data (Default = 0)"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:414
Scope (from outer to inner):
file
namespace HeterogeneousVolumes
function int32 GetMipLevel
Source code excerpt:
int32 GetMipLevel()
{
return CVarHeterogeneousVolumesPreshadingMipLevel.GetValueOnRenderThread();
}
uint32 GetSparseVoxelMipBias()
{
// TODO: Clamp based on texture dimension..
return FMath::Clamp(CVarHeterogeneousVolumesSparseVoxelGenerationMipBias.GetValueOnRenderThread(), 0, 10);