r.LumenScene.UpdateViewOrigin
r.LumenScene.UpdateViewOrigin
#Overview
name: r.LumenScene.UpdateViewOrigin
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to update view origin for voxel lighting and global distance field. Useful for debugging.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.LumenScene.UpdateViewOrigin is to control whether the view origin should be updated for voxel lighting and global distance field in the Lumen scene rendering system. This setting is primarily used for debugging purposes in Unreal Engine’s Lumen global illumination system.
This setting variable is relied upon by the Lumen subsystem within Unreal Engine’s rendering module. Specifically, it’s used in the LumenScene component, which is responsible for managing the scene representation used by Lumen for real-time global illumination calculations.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 1 (enabled) in the C++ code, but can be changed at runtime through console commands or project settings.
The associated variable CVarLumenSceneUpdateViewOrigin directly interacts with r.LumenScene.UpdateViewOrigin. They share the same value and purpose.
Developers must be aware that this variable is primarily intended for debugging. Disabling the view origin update (by setting it to 0) may result in incorrect lighting calculations, as the global illumination system may not properly account for camera movement.
Best practices when using this variable include:
- Leaving it enabled (set to 1) for normal gameplay and development.
- Only disabling it temporarily when debugging specific issues related to view-dependent lighting calculations in Lumen.
- Being cautious when modifying this setting in shipping builds, as it may impact performance or visual quality.
Regarding the associated variable CVarLumenSceneUpdateViewOrigin:
The purpose of CVarLumenSceneUpdateViewOrigin is identical to r.LumenScene.UpdateViewOrigin. It’s the C++ representation of the console variable used within the engine code.
This variable is used directly in the Lumen subsystem of the rendering module. Specifically, it’s checked in the ShouldUpdateLumenSceneViewOrigin() function to determine whether the view origin should be updated.
The value of CVarLumenSceneUpdateViewOrigin is set when the console variable r.LumenScene.UpdateViewOrigin is modified, as they are two representations of the same setting.
CVarLumenSceneUpdateViewOrigin interacts directly with the Lumen scene update logic. When it’s non-zero, the view origin is updated for voxel lighting and global distance field calculations.
Developers should be aware that this variable is accessed on the render thread, so any modifications should be thread-safe and consider potential race conditions.
Best practices for using CVarLumenSceneUpdateViewOrigin include:
- Avoiding direct manipulation of this variable in game code, instead using the console variable system to modify r.LumenScene.UpdateViewOrigin.
- Being mindful of the performance implications when frequently querying this variable’s value, especially in performance-critical sections of rendering code.
- Considering the impact on debugging and profiling tools when this setting is modified, as it may affect how lighting calculations are visualized or measured.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScene.cpp:61
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarLumenSceneUpdateViewOrigin(
TEXT("r.LumenScene.UpdateViewOrigin"),
1,
TEXT("Whether to update view origin for voxel lighting and global distance field. Useful for debugging."),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarLumenSceneSurfaceCacheAtlasSize(
#Associated Variable and Callsites
This variable is associated with another variable named CVarLumenSceneUpdateViewOrigin
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScene.cpp:60
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<int32> CVarLumenSceneUpdateViewOrigin(
TEXT("r.LumenScene.UpdateViewOrigin"),
1,
TEXT("Whether to update view origin for voxel lighting and global distance field. Useful for debugging."),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScene.cpp:127
Scope (from outer to inner):
file
function bool Lumen::ShouldUpdateLumenSceneViewOrigin
Source code excerpt:
bool Lumen::ShouldUpdateLumenSceneViewOrigin()
{
return CVarLumenSceneUpdateViewOrigin.GetValueOnRenderThread() != 0;
}
FVector Lumen::GetLumenSceneViewOrigin(const FViewInfo& View, int32 ClipmapIndex)
{
FVector CameraOrigin = View.ViewMatrices.GetViewOrigin();