r.HeterogeneousVolumes.SparseVoxel.PerTileCulling

r.HeterogeneousVolumes.SparseVoxel.PerTileCulling

#Overview

name: r.HeterogeneousVolumes.SparseVoxel.PerTileCulling

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.HeterogeneousVolumes.SparseVoxel.PerTileCulling is to enable or disable sparse-voxel culling when using tiled rendering in the heterogeneous volumes system. This setting is part of the rendering system, specifically for optimizing the rendering of volumetric effects.

This setting variable is primarily used in the Renderer module of Unreal Engine 5, particularly in the heterogeneous volumes subsystem. It’s referenced in the HeterogeneousVolumes.cpp file, which suggests it’s a core part of the volumetric rendering pipeline.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with a default value of 1 (enabled). Users can modify this value at runtime using console commands or through configuration files.

The associated variable CVarHeterogeneousVolumesSparseVoxelPerTileCulling directly interacts with this setting. It’s used to retrieve the current value of the setting in the engine’s code.

Developers should be aware that this variable affects the performance and visual quality of volumetric rendering. Enabling per-tile culling (the default state) can improve performance by reducing unnecessary computations, but it might have subtle effects on the final rendered image.

Best practices when using this variable include:

  1. Testing the performance impact with and without per-tile culling enabled for your specific use case.
  2. Considering the trade-offs between performance and potential visual artifacts.
  3. Documenting any changes to this setting in your project to ensure consistency across the development team.

Regarding the associated variable CVarHeterogeneousVolumesSparseVoxelPerTileCulling:

The purpose of CVarHeterogeneousVolumesSparseVoxelPerTileCulling is to provide a programmatic interface to the r.HeterogeneousVolumes.SparseVoxel.PerTileCulling setting within the engine’s C++ code.

This variable is used in the Renderer module, specifically in the HeterogeneousVolumes namespace. It’s accessed in the UseSparseVoxelPerTileCulling() function, which likely determines whether the culling should be applied during the rendering process.

The value of this variable is set when the r.HeterogeneousVolumes.SparseVoxel.PerTileCulling console variable is initialized or modified.

This variable directly interacts with the console variable system and is used to retrieve the current setting value in a thread-safe manner on the render thread.

Developers should be aware that this variable is accessed on the render thread, which means any modifications should be done carefully to avoid threading issues.

Best practices when using this variable include:

  1. Always accessing it using the GetValueOnRenderThread() method to ensure thread safety.
  2. Avoiding frequent queries of this value in performance-critical code paths.
  3. Considering caching the value if it’s used frequently in a single frame, to reduce the overhead of repeated calls to GetValueOnRenderThread().

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:162

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesSparseVoxelPerTileCulling(
	TEXT("r.HeterogeneousVolumes.SparseVoxel.PerTileCulling"),
	1,
	TEXT("Enables sparse-voxel culling when using tiled rendering (Default = 1)"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesSparseVoxelRefinement(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:161

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesSparseVoxelPerTileCulling(
	TEXT("r.HeterogeneousVolumes.SparseVoxel.PerTileCulling"),
	1,
	TEXT("Enables sparse-voxel culling when using tiled rendering (Default = 1)"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:445

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     bool UseSparseVoxelPerTileCulling

Source code excerpt:

	bool UseSparseVoxelPerTileCulling()
	{
		return CVarHeterogeneousVolumesSparseVoxelPerTileCulling.GetValueOnRenderThread() != 0;
	}

	int32 GetLightingCacheMode()
	{
		return CVarHeterogeneousVolumesLightingCache.GetValueOnRenderThread();
	}