r.VolumetricLightmap.VisualizationRadiusScale
r.VolumetricLightmap.VisualizationRadiusScale
#Overview
name: r.VolumetricLightmap.VisualizationRadiusScale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Scales the size of the spheres used to visualize volumetric lightmap samples.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VolumetricLightmap.VisualizationRadiusScale is to control the size of the spheres used to visualize volumetric lightmap samples in Unreal Engine 5’s rendering system. This setting variable is specifically related to the visualization of volumetric lightmaps, which are an important component of the engine’s global illumination system.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, particularly the volumetric lightmap visualization feature. This can be inferred from the file location (VisualizeVolumetricLightmap.cpp) and the function name (FDeferredShadingSceneRenderer::VisualizeVolumetricLightmap) where it’s used.
The value of this variable is set through the console variable system. It’s initialized with a default value of 0.01f and can be modified at runtime using the console command “r.VolumetricLightmap.VisualizationRadiusScale”.
The variable interacts directly with GVolumetricLightmapVisualizationRadiusScale, which is the actual float variable storing the value. It’s also used in conjunction with GVolumetricLightmapVisualizationMinScreenFraction, another visualization-related variable.
Developers should be aware that this variable affects only the visualization of volumetric lightmaps, not their actual computation or rendering. It’s a debug/visualization tool rather than a performance or quality setting.
Best practices when using this variable include:
- Use it primarily for debugging and inspecting volumetric lightmap behavior.
- Adjust the value to get the most clear visualization of lightmap samples without obscuring other scene elements.
- Remember to reset it to the default value (0.01f) when not actively using the visualization feature to avoid any potential performance impact.
Regarding the associated variable GVolumetricLightmapVisualizationRadiusScale:
This is the actual float variable that stores the radius scale value. It’s directly modified by the console variable system when r.VolumetricLightmap.VisualizationRadiusScale is changed.
The purpose of GVolumetricLightmapVisualizationRadiusScale is to provide a quick access point for the rendering code to retrieve the current visualization radius scale value. It’s used in the FDeferredShadingSceneRenderer::VisualizeVolumetricLightmap function to set up the visualization parameters.
Developers should not modify this variable directly in code. Instead, they should use the console variable system to change r.VolumetricLightmap.VisualizationRadiusScale, which will automatically update GVolumetricLightmapVisualizationRadiusScale.
Best practices for this associated variable include:
- Treat it as read-only in most code contexts.
- If needed in other parts of the rendering code, access it directly rather than going through the console variable system for performance reasons.
- Be aware that its value can change at runtime, so don’t cache it for long periods if precise control is needed.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VisualizeVolumetricLightmap.cpp:29
Scope: file
Source code excerpt:
float GVolumetricLightmapVisualizationRadiusScale = .01f;
FAutoConsoleVariableRef CVarVolumetricLightmapVisualizationRadiusScale(
TEXT("r.VolumetricLightmap.VisualizationRadiusScale"),
GVolumetricLightmapVisualizationRadiusScale,
TEXT("Scales the size of the spheres used to visualize volumetric lightmap samples."),
ECVF_RenderThreadSafe
);
float GVolumetricLightmapVisualizationMinScreenFraction = .001f;
#Associated Variable and Callsites
This variable is associated with another variable named GVolumetricLightmapVisualizationRadiusScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VisualizeVolumetricLightmap.cpp:27
Scope: file
Source code excerpt:
#include "PrecomputedVolumetricLightmap.h"
float GVolumetricLightmapVisualizationRadiusScale = .01f;
FAutoConsoleVariableRef CVarVolumetricLightmapVisualizationRadiusScale(
TEXT("r.VolumetricLightmap.VisualizationRadiusScale"),
GVolumetricLightmapVisualizationRadiusScale,
TEXT("Scales the size of the spheres used to visualize volumetric lightmap samples."),
ECVF_RenderThreadSafe
);
float GVolumetricLightmapVisualizationMinScreenFraction = .001f;
FAutoConsoleVariableRef CVarVolumetricLightmapVisualizationMinScreenFraction(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VisualizeVolumetricLightmap.cpp:130
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::VisualizeVolumetricLightmap
Source code excerpt:
PassParameters->Common.View = View.ViewUniformBuffer;
PassParameters->Common.VisualizationRadiusScale = GVolumetricLightmapVisualizationRadiusScale;
PassParameters->Common.VisualizationMinScreenFraction = GVolumetricLightmapVisualizationMinScreenFraction;
{
FVector3f DiffuseColorValue(.18f, .18f, .18f);
if (!ViewFamily.EngineShowFlags.Materials)
{