r.Substrate.SpecularProfile.Resolution
r.Substrate.SpecularProfile.Resolution
#Overview
name: r.Substrate.SpecularProfile.Resolution
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The resolution of the specular profile texture.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Substrate.SpecularProfile.Resolution is to control the resolution of the specular profile texture in Unreal Engine’s rendering system. This setting variable is crucial for managing the quality and performance of specular reflections in the engine’s materials and shaders.
The Unreal Engine subsystem that relies on this setting variable is the rendering system, specifically the specular profile texture management. This can be seen in the file “SpecularProfile.cpp” which is part of the Engine’s rendering module.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 64, but can be changed at runtime or through configuration files.
The associated variable CVarSpecularProfileResolution interacts directly with r.Substrate.SpecularProfile.Resolution. They share the same value and purpose, with CVarSpecularProfileResolution being the actual C++ variable used in the code to access the setting.
Developers must be aware that changing this variable affects the resolution of the specular profile texture, which in turn impacts both the visual quality of specular reflections and the performance of the rendering system. A higher resolution will provide more detailed specular reflections but at the cost of increased memory usage and potentially lower performance.
Best practices when using this variable include:
- Balancing quality and performance based on the target hardware and project requirements.
- Testing different resolutions to find the optimal setting for your specific use case.
- Considering the impact on memory usage, especially on platforms with limited resources.
- Using it in conjunction with other specular and reflection settings for a cohesive look.
Regarding the associated variable CVarSpecularProfileResolution:
The purpose of CVarSpecularProfileResolution is to provide a programmatic interface to the r.Substrate.SpecularProfile.Resolution setting within the C++ code of Unreal Engine.
This variable is used directly in the rendering system, specifically in the FSpecularProfileTextureManager class, to determine the resolution of the specular profile texture atlas.
The value of CVarSpecularProfileResolution is set through the CVar system, mirroring r.Substrate.SpecularProfile.Resolution.
It interacts with the rendering system by defining the dimensions of the texture atlas used for specular profiles. This affects how the engine manages and renders specular reflections.
Developers should be aware that this variable is accessed on the render thread (GetValueOnRenderThread()), which is important for thread safety in rendering operations.
Best practices for using CVarSpecularProfileResolution include:
- Accessing it only on the render thread to avoid race conditions.
- Considering its impact on texture memory when allocating resources.
- Using it consistently throughout the rendering pipeline where specular profile resolution is needed.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Rendering/SpecularProfile.cpp:20
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarSpecularProfileResolution(
TEXT("r.Substrate.SpecularProfile.Resolution"),
64,
TEXT("The resolution of the specular profile texture.\n"),
ECVF_RenderThreadSafe
);
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
#Associated Variable and Callsites
This variable is associated with another variable named CVarSpecularProfileResolution
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Rendering/SpecularProfile.cpp:19
Scope: file
Source code excerpt:
///////////////////////////////////////////////////////////////////////////////////////////////////
static TAutoConsoleVariable<int32> CVarSpecularProfileResolution(
TEXT("r.Substrate.SpecularProfile.Resolution"),
64,
TEXT("The resolution of the specular profile texture.\n"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Rendering/SpecularProfile.cpp:320
Scope (from outer to inner):
file
function IPooledRenderTarget* FSpecularProfileTextureManager::GetAtlasTexture
Source code excerpt:
// Each row of the texture contains SSS parameters, followed by 3 precomputed kernels. Texture must be wide enough to fit all data.
const uint32 Resolution = CVarSpecularProfileResolution.GetValueOnRenderThread();
check(LayerCount);
// 1. Create atlas texture
FPooledRenderTargetDesc Desc(FPooledRenderTargetDesc::Create2DArrayDesc(FIntPoint(Resolution, Resolution), PF_FloatR11G11B10, FClearValueBinding::None, TexCreate_None, TexCreate_UAV | TexCreate_ShaderResource, false, LayerCount));
GRenderTargetPool.FindFreeElement(RHICmdList, Desc, GSpecularProfileTextureAtlas, TEXT("SpecularProfileTexture"));