r.Shading.FurnaceTest
r.Shading.FurnaceTest
#Overview
name: r.Shading.FurnaceTest
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable/disable furnace for shading validation.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Shading.FurnaceTest is to enable or disable the furnace test for shading validation in Unreal Engine’s rendering system. This setting variable is part of the shading energy conservation system and is used for debugging and validating shading models.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, specifically within the shading and lighting components. This can be seen from the file location “Engine/Source/Runtime/Renderer/Private/ShadingEnergyConservation.cpp”.
The value of this variable is set through a console variable (CVarShadingFurnaceTest) with a default value of 0 (disabled). It can be changed at runtime using console commands or through engine configuration files.
This variable interacts with other related variables, such as CVarShadingFurnaceTest_SampleCount, which likely controls the number of samples used in the furnace test when it’s enabled.
Developers must be aware that enabling this variable (setting it to a value greater than 0) will activate the furnace test for shading validation. This may impact performance and should primarily be used for debugging and development purposes, not in production builds.
Best practices when using this variable include:
- Only enable it when actively debugging shading issues or validating shading models.
- Be aware of potential performance impacts when enabled.
- Use in conjunction with other shading-related debug tools and variables for comprehensive testing.
- Disable it in production builds to avoid unnecessary performance overhead.
Regarding the associated variable CVarShadingFurnaceTest:
The purpose of CVarShadingFurnaceTest is to provide a programmatic way to control the r.Shading.FurnaceTest setting within the C++ code. It’s an instance of TAutoConsoleVariable
This variable is used directly in the Renderer module to determine whether to run the furnace test. For example, in the Debug function, it checks the value of CVarShadingFurnaceTest to decide whether to add the ShadingFurnacePass to the render graph.
The value of CVarShadingFurnaceTest is set when the variable is initialized, with a default value of 0. It can be changed at runtime through console commands or engine configuration.
Developers should be aware that changes to CVarShadingFurnaceTest will immediately affect the behavior of the shading system, potentially impacting performance and visual output.
Best practices for using CVarShadingFurnaceTest include:
- Use GetValueOnAnyThread() when accessing the value, as shown in the provided code snippet.
- Consider the threading implications when modifying or reading this value, as it’s marked as ECVF_RenderThreadSafe.
- Use this variable in conjunction with other debugging tools and variables in the shading system for comprehensive testing and validation.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadingEnergyConservation.cpp:29
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarShadingFurnaceTest(
TEXT("r.Shading.FurnaceTest"),
0,
TEXT("Enable/disable furnace for shading validation."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarShadingFurnaceTest_SampleCount(
TEXT("r.Shading.FurnaceTest.SampleCount"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarShadingFurnaceTest
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadingEnergyConservation.cpp:28
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarShadingFurnaceTest(
TEXT("r.Shading.FurnaceTest"),
0,
TEXT("Enable/disable furnace for shading validation."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarShadingFurnaceTest_SampleCount(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadingEnergyConservation.cpp:366
Scope (from outer to inner):
file
function namespace ShadingEnergyConservation { bool IsEnable
function void Debug
Source code excerpt:
void Debug(FRDGBuilder& GraphBuilder, const FViewInfo& View, FSceneTextures& SceneTextures)
{
if (CVarShadingFurnaceTest.GetValueOnAnyThread() > 0)
{
RDG_EVENT_SCOPE(GraphBuilder, "ShadingEnergyConservation::FurnaceTest");
AddShadingFurnacePass(GraphBuilder, View, SceneTextures.UniformBuffer, SceneTextures.Color.Target);
}
}