r.Translucent.UsesRectLights

r.Translucent.UsesRectLights

#Overview

name: r.Translucent.UsesRectLights

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.Translucent.UsesRectLights is to enable or disable rectangular light support for translucent surfaces in the rendering system. This setting variable is part of Unreal Engine’s rendering subsystem and affects how translucent materials interact with rectangular lights.

Based on the Callsites section, this variable is primarily used in the RenderCore module of Unreal Engine. It is defined and used within the RenderUtils.cpp file, which is responsible for various rendering utility functions.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 0, meaning rectangular light support for translucent surfaces is disabled by default. The value can be changed at runtime through console commands or configuration files.

The associated variable CVarRectLighTranslucent directly interacts with r.Translucent.UsesRectLights. They share the same value and purpose.

Developers must be aware of the following when using this variable:

  1. Enabling this feature (setting the value to 1 or higher) will add an extra sampler to the pixel shader.
  2. There is a limitation of 16 samplers on DirectX 11-based systems, so enabling this feature may impact shader complexity and performance.
  3. This setting is marked as ECVF_ReadOnly and ECVF_RenderThreadSafe, meaning it should not be changed frequently and is safe to read from the render thread.

Best practices when using this variable include:

  1. Only enable it when rectangular light support for translucent surfaces is necessary for your project’s visual requirements.
  2. Consider the performance impact, especially on DirectX 11 systems, due to the additional sampler.
  3. Test thoroughly after enabling to ensure it doesn’t negatively impact overall rendering performance or cause issues with shader complexity.

Regarding the associated variable CVarRectLighTranslucent:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1672

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarRectLighTranslucent(
	TEXT("r.Translucent.UsesRectLights"),
	0,
	TEXT("Enable rect light support for translucent surfaces. When enabled, it will add an extrat sampler to the pixel shader (limited to 16 on dx11 based system)"),
	ECVF_ReadOnly | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarIESProfileTranslucent(
	TEXT("r.Translucent.UsesIESProfiles"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1671

Scope: file

Source code excerpt:

	ECVF_ReadOnly | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarRectLighTranslucent(
	TEXT("r.Translucent.UsesRectLights"),
	0,
	TEXT("Enable rect light support for translucent surfaces. When enabled, it will add an extrat sampler to the pixel shader (limited to 16 on dx11 based system)"),
	ECVF_ReadOnly | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarIESProfileTranslucent(

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1712

Scope (from outer to inner):

file
function     bool GetTranslucentUsesLightRectLights

Source code excerpt:

bool GetTranslucentUsesLightRectLights()
{
	return CVarRectLighTranslucent.GetValueOnAnyThread() > 0;
}

bool GetTranslucentUsesLightIESProfiles()
{
	return CVarIESProfileTranslucent.GetValueOnAnyThread() > 0;
}