r.LocalFogVolume.ApplyOnTranslucent

r.LocalFogVolume.ApplyOnTranslucent

#Overview

name: r.LocalFogVolume.ApplyOnTranslucent

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.LocalFogVolume.ApplyOnTranslucent is to enable or disable the application of local fog volumes on translucent objects in the rendering pipeline.

This setting variable is primarily used by the Renderer subsystem in Unreal Engine 5. It affects how local fog volumes interact with translucent geometry during the rendering process.

The value of this variable is set through a console variable (CVar) system, which allows it to be changed at runtime or through configuration files.

This variable interacts closely with the bSupportLocalFogVolumes flag, which determines whether local fog volumes are supported at all. The combination of these two variables determines whether local fog volumes will be applied to translucent objects.

Developers should be aware that enabling this feature may have performance implications, especially in scenes with many translucent objects or complex fog volumes. It may also affect the visual appearance of translucent objects in the presence of local fog.

Best practices when using this variable include:

  1. Only enable it when necessary for the desired visual effect.
  2. Consider the performance impact on target platforms, especially mobile devices.
  3. Test thoroughly with various combinations of translucent objects and fog volumes to ensure the desired visual results are achieved.
  4. Be aware that changing this setting may require recompilation of shaders that depend on it.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/RendererSettings.h:619

Scope (from outer to inner):

file
class        class URendererSettings : public UDeveloperSettings

Source code excerpt:


	UPROPERTY(config, EditAnywhere, Category=Translucency, meta=(
		ConsoleVariable="r.LocalFogVolume.ApplyOnTranslucent",
		ToolTip="Allow translucency to be rendered to a separate render targeted and composited after depth of field. Prevents translucency from appearing out of focus."))
	uint32 bLocalFogVolumeApplyOnTranslucent:1;

	UPROPERTY(config, EditAnywhere, Category = VR, meta = (
		ConsoleVariable = "xr.VRS.FoveationLevel", DisplayName = "Stereo Foveation Level (Experimental)",
		ToolTip = "Set the level of foveation to apply when generating the Variable Rate Shading attachment. This feature is currently experimental.\nThis can yield some fairly significant performance benefits on GPUs that support Tier 2 VRS.\nLower settings will result in almost no discernible artifacting on most HMDs; higher settings will show some artifacts towards the edges of the view."))

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LocalFogVolumeRendering.cpp:38

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLocalFogVolumeApplyOnTranslucent(
	TEXT("r.LocalFogVolume.ApplyOnTranslucent"), 0,
	TEXT("Project settings enabling the sampling of local fog volumes on translucent elements."),
	ECVF_ReadOnly | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarLocalFogVolumeTilePixelSize(
	TEXT("r.LocalFogVolume.TilePixelSize"), 128,
	TEXT("Tile size on screen in pixel at which we cull the local fog volumes."),

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8449

Scope (from outer to inner):

file
function     void GlobalBeginCompileShader

Source code excerpt:


	{
		static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.LocalFogVolume.ApplyOnTranslucent"));
		const bool bLocalFogVolumesApplyOnTranclucent = CVar && CVar->GetInt() > 0;
		SET_SHADER_DEFINE(Input.Environment, PROJECT_LOCALFOGVOLUME_APPLYONTRANSLUCENT, ((bSupportLocalFogVolumes && bLocalFogVolumesApplyOnTranclucent) ? 1 : 0));
	}

	bool bSupportSkyAtmosphere = false;
	{

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/Shader.cpp:1975

Scope (from outer to inner):

file
function     void ShaderMapAppendKeyString

Source code excerpt:


	{
		static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.LocalFogVolume.ApplyOnTranslucent"));
		const bool bLocalFogVolumesApplyOnTranclucent = CVar && CVar->GetInt() > 0;
		if (bSupportLocalFogVolumes && bLocalFogVolumesApplyOnTranclucent)
		{
			KeyString += TEXT("_LFVTRA");
		}
	}