r.OIT.SortedPixels
r.OIT.SortedPixels
#Overview
name: r.OIT.SortedPixels
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable OIT rendering (project settings, can\'t be changed at runtime)
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.OIT.SortedPixels is to enable Order Independent Transparency (OIT) rendering in Unreal Engine 5. This setting variable is specifically used for controlling the sorted pixels approach in OIT.
Key points about r.OIT.SortedPixels:
-
It’s part of the rendering system, specifically for handling transparent objects.
-
The Unreal Engine rendering subsystem relies on this variable to determine whether to use sorted pixels for OIT.
-
The value of this variable is set through a console variable (CVar) system, allowing it to be changed at runtime or set in project settings.
-
It interacts with another variable, CVarOIT_SortedPixels_Enable_Project, which shares the same value but is read-only and set at the project level.
-
Developers must be aware that this setting is platform-dependent. The code checks if the platform supports OIT before applying the setting.
-
Best practices include:
- Only enabling this feature on platforms that support OIT
- Considering performance implications, as OIT can be resource-intensive
- Testing thoroughly with and without this feature enabled to ensure proper rendering of transparent objects
Regarding the associated variable CVarOIT_SortedPixels_Enable_Project:
-
Its purpose is to enable OIT rendering at the project settings level.
-
It’s a read-only variable that can’t be changed at runtime.
-
It’s used in conjunction with r.OIT.SortedPixels to determine if sorted pixels OIT should be enabled.
-
Developers should set this in project settings if they want OIT to be enabled by default for the project.
-
When using this variable, developers should ensure that all target platforms for the project support OIT to avoid unexpected behavior.
Both variables work together to provide flexibility in enabling OIT at both the project and runtime levels, allowing developers to fine-tune transparency rendering based on their specific needs and target platforms.
#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:49
Scope: file
Source code excerpt:
// Referenced in RendererSettings.h, as it is a project settings
static TAutoConsoleVariable<int32> CVarOIT_SortedPixels_Enable_Project(
TEXT("r.OIT.SortedPixels"),
0,
TEXT("Enable OIT rendering (project settings, can't be changed at runtime)"),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarOIT_SortedPixels_Enable_Runtime(
TEXT("r.OIT.SortedPixels.Enable"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8566
Scope (from outer to inner):
file
function void GlobalBeginCompileShader
Source code excerpt:
{
const bool bSupportOIT = FDataDrivenShaderPlatformInfo::GetSupportsOIT(EShaderPlatform(Target.Platform));
static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.OIT.SortedPixels"));
const bool bOIT = CVar && CVar->GetInt() != 0;
SET_SHADER_DEFINE(Input.Environment, PROJECT_OIT, (bSupportOIT && bOIT) ? 1 : 0);
}
{
static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Material.EnergyConservation"));
#Associated Variable and Callsites
This variable is associated with another variable named CVarOIT_SortedPixels_Enable_Project
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/OIT/OIT.cpp:48
Scope: file
Source code excerpt:
// Referenced in RendererSettings.h, as it is a project settings
static TAutoConsoleVariable<int32> CVarOIT_SortedPixels_Enable_Project(
TEXT("r.OIT.SortedPixels"),
0,
TEXT("Enable OIT rendering (project settings, can't be changed at runtime)"),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarOIT_SortedPixels_Enable_Runtime(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/OIT/OIT.cpp:823
Scope: file
Source code excerpt:
{
//const bool bMSAAEnabled = GetDefaultAntiAliasingMethod(GetMaxSupportedFeatureLevel(InPlatform)) != EAntiAliasingMethod::AAM_MSAA;
const bool bPixelOIT = CVarOIT_SortedPixels_Enable_Project.GetValueOnAnyThread() > 0 && FDataDrivenShaderPlatformInfo::GetSupportsOIT(EShaderPlatform(InPlatform));
return bPixelOIT;
}
bool InternalIsSortedPixelsEnabled(EShaderPlatform InPlatform, bool bMSAA)
{
return IsSortedPixelsEnabledForProject(InPlatform) && GRHISupportsRasterOrderViews && !!CVarOIT_SortedPixels_Enable_Runtime.GetValueOnRenderThread() && !bMSAA;