r.OIT.SortedPixels.MaxSampleCount
r.OIT.SortedPixels.MaxSampleCount
#Overview
name: r.OIT.SortedPixels.MaxSampleCount
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Max sample count.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.OIT.SortedPixels.MaxSampleCount is to control the maximum sample count for Order Independent Transparency (OIT) in the rendering system. This setting variable is used to determine the number of samples per pixel when implementing sorted pixel-based OIT.
This setting variable is primarily used in the Renderer module of Unreal Engine, specifically in the OIT (Order Independent Transparency) subsystem. It’s referenced in the file “OIT.cpp”, which suggests it’s a core part of the OIT implementation.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 4, but can be changed at runtime through console commands or programmatically.
The associated variable CVarOIT_SortedPixels_SampleCount directly interacts with r.OIT.SortedPixels.MaxSampleCount. They share the same value and purpose.
Developers must be aware that this variable affects the quality and performance of transparent object rendering. A higher sample count can improve the quality of transparency effects but may also increase memory usage and rendering time.
Best practices when using this variable include:
- Balancing between quality and performance based on the target hardware.
- Testing different values to find the optimal setting for your specific use case.
- Considering the impact on memory usage, especially on platforms with limited resources.
Regarding the associated variable CVarOIT_SortedPixels_SampleCount:
The purpose of CVarOIT_SortedPixels_SampleCount is the same as r.OIT.SortedPixels.MaxSampleCount - to control the maximum sample count for Order Independent Transparency.
This variable is used in the Renderer module, specifically in the OIT implementation. It’s defined and used in the same “OIT.cpp” file.
The value of CVarOIT_SortedPixels_SampleCount is set when the console variable is initialized, but can be changed at runtime using the console variable system.
CVarOIT_SortedPixels_SampleCount directly interacts with r.OIT.SortedPixels.MaxSampleCount, as they represent the same setting.
Developers should be aware that this variable is used to clamp the sample count between 1 and 16, and its value is used to calculate the maximum side samples per pixel and the total maximum samples per pixel.
Best practices for using CVarOIT_SortedPixels_SampleCount include:
- Understanding its relationship with r.OIT.SortedPixels.MaxSampleCount.
- Being aware of its impact on OIT quality and performance.
- Considering its use in conjunction with other OIT-related settings for optimal results.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/OIT/OIT.cpp:67
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarOIT_SortedPixels_SampleCount(
TEXT("r.OIT.SortedPixels.MaxSampleCount"),
4,
TEXT("Max sample count."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarOIT_SortedPixels_Debug(
TEXT("r.OIT.SortedPixels.Debug"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarOIT_SortedPixels_SampleCount
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/OIT/OIT.cpp:66
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarOIT_SortedPixels_SampleCount(
TEXT("r.OIT.SortedPixels.MaxSampleCount"),
4,
TEXT("Max sample count."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarOIT_SortedPixels_Debug(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/OIT/OIT.cpp:946
Scope (from outer to inner):
file
class class FOITSortTriangleIndex_WriteOutCS : public FGlobalShader
Source code excerpt:
{
// Round sample to be square to store them into square tile
uint32 MaxSamplePerPixel = FMath::Clamp(CVarOIT_SortedPixels_SampleCount.GetValueOnRenderThread(), 1, 16);
uint32 MaxSideSamplePerPixel = FMath::FloorToInt(FMath::Sqrt(float(MaxSamplePerPixel)));
MaxSamplePerPixel = MaxSideSamplePerPixel * MaxSideSamplePerPixel;
Out.MaxSideSamplePerPixel = MaxSideSamplePerPixel;
Out.MaxSamplePerPixel = MaxSamplePerPixel;
Out.Method = FMath::Clamp(CVarOIT_SortedPixels_Method.GetValueOnRenderThread(), 0, 1);