r.PathTracing.Denoiser.NormalSpace
r.PathTracing.Denoiser.NormalSpace
#Overview
name: r.PathTracing.Denoiser.NormalSpace
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The space normal is in\n0: World space (default)\n1: Camera space. Some denoisers require camera space normal\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PathTracing.Denoiser.NormalSpace is to control the space in which normals are represented for the path tracing denoiser in Unreal Engine 5’s rendering system. It allows developers to choose between world space and camera space for normal representations.
This setting variable is primarily used in the rendering system, specifically in the path tracing and denoising subsystem of Unreal Engine 5. Based on the callsites, it’s utilized in the PathTracingSpatialTemporalDenoising module.
The value of this variable is set through a console variable (CVar) system. It’s defined as a TAutoConsoleVariable with an initial value of 0, which corresponds to world space normals.
The associated variable CVarPathTracingDenoiserNormalSpace directly interacts with r.PathTracing.Denoiser.NormalSpace. They share the same value and are used interchangeably in the code.
Developers must be aware that:
- The variable accepts two values: 0 for world space (default) and 1 for camera space.
- Some denoisers specifically require camera space normals, so changing this value may affect denoiser compatibility and performance.
- This setting is marked as ECVF_RenderThreadSafe, meaning it can be changed safely on the render thread.
Best practices when using this variable include:
- Consider the requirements of the specific denoiser being used in your project.
- Test both world space and camera space settings to determine which provides better results for your specific use case.
- Be consistent in using either the r.PathTracing.Denoiser.NormalSpace console command or the CVarPathTracingDenoiserNormalSpace variable in C++ code.
- When changing this setting, ensure to test thoroughly as it may impact the visual quality and performance of the path tracing denoiser.
Regarding the associated variable CVarPathTracingDenoiserNormalSpace:
- Its purpose is identical to r.PathTracing.Denoiser.NormalSpace, serving as the C++ accessible version of the console variable.
- It’s used in the same PathTracingSpatialTemporalDenoising module.
- The value is set through the TAutoConsoleVariable constructor and can be accessed using the GetValueOnRenderThread() method.
- It’s used in the ShouldDenoiseWithNormalInCameraSpace() function to determine the normal space for denoising.
- Developers should be aware that changes to this variable will immediately affect the behavior of the path tracing denoiser.
- Best practices include using this variable for runtime checks and potential dynamic adjustments of the denoiser’s normal space setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracingSpatialTemporalDenoising.cpp:37
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<int32> CVarPathTracingDenoiserNormalSpace(
TEXT("r.PathTracing.Denoiser.NormalSpace"),
0,
TEXT("The space normal is in\n")
TEXT("0: World space (default)\n")
TEXT("1: Camera space. Some denoisers require camera space normal\n"),
ECVF_RenderThreadSafe
);
#Associated Variable and Callsites
This variable is associated with another variable named CVarPathTracingDenoiserNormalSpace
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracingSpatialTemporalDenoising.cpp:36
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
);
TAutoConsoleVariable<int32> CVarPathTracingDenoiserNormalSpace(
TEXT("r.PathTracing.Denoiser.NormalSpace"),
0,
TEXT("The space normal is in\n")
TEXT("0: World space (default)\n")
TEXT("1: Camera space. Some denoisers require camera space normal\n"),
ECVF_RenderThreadSafe
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracingSpatialTemporalDenoising.cpp:261
Scope (from outer to inner):
file
function static bool ShouldDenoiseWithNormalInCameraSpace
Source code excerpt:
static bool ShouldDenoiseWithNormalInCameraSpace()
{
int NormalSpace = CVarPathTracingDenoiserNormalSpace.GetValueOnRenderThread();
return NormalSpace != 0;
}
enum class ESpatialDenoiserType : int32
{
NONE = -1,