r.ReflectionEnvironmentLightmapMixing

r.ReflectionEnvironmentLightmapMixing

#Overview

name: r.ReflectionEnvironmentLightmapMixing

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.ReflectionEnvironmentLightmapMixing is to control whether indirect specular reflections from reflection captures are mixed with indirect diffuse lighting from lightmaps for rough surfaces in the rendering system.

This setting variable is primarily used in the Renderer module of Unreal Engine, specifically in the reflection environment subsystem. It affects how the engine handles lighting and reflections for materials with varying degrees of roughness.

The value of this variable is set through the Unreal Engine console variable system. It is initialized with a default value of 1 (enabled) and can be changed at runtime using console commands or through project settings.

The associated variable GReflectionEnvironmentLightmapMixing directly interacts with r.ReflectionEnvironmentLightmapMixing. They share the same value and are used interchangeably in the code.

Developers should be aware that this variable affects the visual quality and performance of reflections in the scene. When enabled (set to 1), it provides more accurate lighting for rough surfaces by combining information from reflection captures and lightmaps. When disabled (set to 0), it may result in less realistic lighting for rough surfaces but could potentially improve performance.

Best practices when using this variable include:

  1. Testing the visual impact and performance implications of enabling or disabling this feature in your specific project.
  2. Considering the target hardware and performance requirements when deciding whether to enable this feature.
  3. Using this in conjunction with other reflection and lighting settings to achieve the desired visual quality and performance balance.

Regarding the associated variable GReflectionEnvironmentLightmapMixing:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ReflectionEnvironment.cpp:48

Scope: file

Source code excerpt:

int32 GReflectionEnvironmentLightmapMixing = 1;
FAutoConsoleVariableRef CVarReflectionEnvironmentLightmapMixing(
	TEXT("r.ReflectionEnvironmentLightmapMixing"),
	GReflectionEnvironmentLightmapMixing,
	TEXT("Whether to mix indirect specular from reflection captures with indirect diffuse from lightmaps for rough surfaces."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

int32 GReflectionEnvironmentLightmapMixBasedOnRoughness = 1;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ReflectionEnvironment.cpp:46

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe | ECVF_Scalability);

int32 GReflectionEnvironmentLightmapMixing = 1;
FAutoConsoleVariableRef CVarReflectionEnvironmentLightmapMixing(
	TEXT("r.ReflectionEnvironmentLightmapMixing"),
	GReflectionEnvironmentLightmapMixing,
	TEXT("Whether to mix indirect specular from reflection captures with indirect diffuse from lightmaps for rough surfaces."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

int32 GReflectionEnvironmentLightmapMixBasedOnRoughness = 1;
FAutoConsoleVariableRef CVarReflectionEnvironmentLightmapMixBasedOnRoughness(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ReflectionEnvironment.cpp:115

Scope (from outer to inner):

file
function     FVector GetReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight

Source code excerpt:

	float RoughnessMixingRange = 1.0f / FMath::Max(GReflectionEnvironmentEndMixingRoughness - GReflectionEnvironmentBeginMixingRoughness, .001f);

	if (GReflectionEnvironmentLightmapMixing == 0)
	{
		return FVector(0, 0, GReflectionEnvironmentLightmapMixLargestWeight);
	}

	if (GReflectionEnvironmentEndMixingRoughness == 0.0f && GReflectionEnvironmentBeginMixingRoughness == 0.0f)
	{