r.Lumen.Visualize.HardwareRayTracing.GroupCount

r.Lumen.Visualize.HardwareRayTracing.GroupCount

#Overview

name: r.Lumen.Visualize.HardwareRayTracing.GroupCount

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Lumen.Visualize.HardwareRayTracing.GroupCount is to determine the active group count when dispatching the raygen shader in Lumen’s hardware ray tracing visualization system. This setting variable is part of Unreal Engine 5’s rendering system, specifically within the Lumen global illumination solution.

This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. It’s referenced in the LumenVisualizeHardwareRayTracing.cpp file, which suggests it’s specifically used for visualizing hardware ray tracing in Lumen.

The value of this variable is set as a console variable with a default value of 4096. It can be modified at runtime through the console or through configuration files.

This variable interacts with CVarLumenVisualizeHardwareRayTracingThreadCount to determine the total number of rays to be traced. The product of the group count (set by this variable) and the thread group size is used to calculate the total ray count.

Developers should be aware that this variable directly affects the performance and quality of the ray tracing visualization. A higher value will result in more detailed visualization but at the cost of performance.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of the scene and the available hardware resources.
  2. Balancing it with other ray tracing settings to achieve optimal performance and visual quality.
  3. Testing different values to find the sweet spot for your specific use case.

Regarding the associated variable CVarLumenVisualizeHardwareRayTracingGroupCount:

This is the actual console variable object that stores and manages the r.Lumen.Visualize.HardwareRayTracing.GroupCount setting. It’s created using the TAutoConsoleVariable template class, which allows for easy creation and management of console variables.

The purpose of this variable is the same as r.Lumen.Visualize.HardwareRayTracing.GroupCount - to control the group count for ray tracing visualization in Lumen.

This variable is used in the rendering subsystem, specifically in the Lumen module for hardware ray tracing visualization.

The value is set when the variable is created, with a default of 4096. It can be changed at runtime through console commands.

This variable is used to retrieve the current value of the setting in the code, using the GetValueOnRenderThread() method.

Developers should be aware that changes to this variable will take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag.

Best practices include using the GetValueOnRenderThread() method to retrieve the current value, as this ensures thread-safe access to the variable’s value.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualizeHardwareRayTracing.cpp:53

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLumenVisualizeHardwareRayTracingGroupCount(
	TEXT("r.Lumen.Visualize.HardwareRayTracing.GroupCount"),
	4096,
	TEXT("Determines the active group count when dispatching raygen shader (default = 4096"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarLumenVisualizeHardwareRayTracingRetraceHitLighting(

#Associated Variable and Callsites

This variable is associated with another variable named CVarLumenVisualizeHardwareRayTracingGroupCount. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualizeHardwareRayTracing.cpp:52

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarLumenVisualizeHardwareRayTracingGroupCount(
	TEXT("r.Lumen.Visualize.HardwareRayTracing.GroupCount"),
	4096,
	TEXT("Determines the active group count when dispatching raygen shader (default = 4096"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualizeHardwareRayTracing.cpp:595

Scope: file

Source code excerpt:

	// NOTE: GroupCount for emulated indirect-dispatch of raygen shaders dictates the maximum allocation size if GroupCount > MaxTileCount
	uint32 RayGenThreadCount = CVarLumenVisualizeHardwareRayTracingThreadCount.GetValueOnRenderThread();
	uint32 RayGenGroupCount = CVarLumenVisualizeHardwareRayTracingGroupCount.GetValueOnRenderThread();
	uint32 RayCount = FMath::Max(MaxTileCount, RayGenGroupCount) * FLumenVisualizeCreateRaysCS::GetThreadGroupSize1D();

	// Create rays within tiles
	FRDGBufferRef RayAllocatorBuffer = GraphBuilder.CreateBuffer(FRDGBufferDesc::CreateBufferDesc(sizeof(uint32), 1), TEXT("Lumen.Visualize.RayAllocator"));
	AddClearUAVPass(GraphBuilder, GraphBuilder.CreateUAV(RayAllocatorBuffer, PF_R32_UINT), 0);