r.HeterogeneousVolumes.Preshading

r.HeterogeneousVolumes.Preshading

#Overview

name: r.HeterogeneousVolumes.Preshading

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.Preshading is to control the evaluation of materials into a canonical preshaded volume before rendering the result in the context of heterogeneous volumes rendering.

This setting variable is primarily used in the rendering system of Unreal Engine 5, specifically in the heterogeneous volumes rendering subsystem. Based on the callsites, it is part of the Renderer module and is used in the HeterogeneousVolumes.cpp file.

The value of this variable is set through a console variable (CVarHeterogeneousVolumesPreshading) with a default value of 0. It can be changed at runtime through the console or programmatically.

The associated variable CVarHeterogeneousVolumesPreshading directly interacts with r.HeterogeneousVolumes.Preshading. They share the same value and purpose.

Developers must be aware that enabling this variable (setting it to a non-zero value) will activate a pre-shading pipeline for heterogeneous volumes. This may have performance implications and affect the rendering process.

Best practices when using this variable include:

  1. Only enable it when necessary, as it may impact performance.
  2. Test thoroughly with both enabled and disabled states to ensure desired visual results.
  3. Consider the performance trade-offs when enabling this feature, especially on less powerful hardware.

Regarding the associated variable CVarHeterogeneousVolumesPreshading:

The purpose of CVarHeterogeneousVolumesPreshading is identical to r.HeterogeneousVolumes.Preshading. It is a TAutoConsoleVariable that allows for runtime control of the preshading feature for heterogeneous volumes.

This variable is part of the Renderer module and is used in the heterogeneous volumes rendering subsystem.

The value is set when the variable is initialized, with a default value of 0. It can be changed at runtime through the console or programmatically.

CVarHeterogeneousVolumesPreshading directly controls whether the material pre-shading pipeline is executed for heterogeneous volumes.

Developers should be aware that this variable is used to make runtime decisions in the rendering code. Changing its value will immediately affect the rendering pipeline for heterogeneous volumes.

Best practices for using CVarHeterogeneousVolumesPreshading include:

  1. Use it for debugging or performance testing purposes.
  2. Document any permanent changes to this variable in project settings or documentation.
  3. Consider exposing this setting through a user interface for advanced users or developers if runtime toggling is desired.

#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:100

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesPreshading(
	TEXT("r.HeterogeneousVolumes.Preshading"),
	0,
	TEXT("Evaluates the material into a canonical preshaded volume before rendering the result (Default = 0)"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesPreshadingMipLevel(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesPreshading(
	TEXT("r.HeterogeneousVolumes.Preshading"),
	0,
	TEXT("Evaluates the material into a canonical preshaded volume before rendering the result (Default = 0)"),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderHeterogeneousVolumes

Source code excerpt:


					// Material baking executes a pre-shading pipeline
					if (CVarHeterogeneousVolumesPreshading.GetValueOnRenderThread())
					{
						RenderWithPreshading(
							GraphBuilder,
							SceneTextures,
							Scene,
							ViewFamily,