r.FastVRam.DistanceFieldIrradiance

r.FastVRam.DistanceFieldIrradiance

#Overview

name: r.FastVRam.DistanceFieldIrradiance

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.FastVRam.DistanceFieldIrradiance is to control the allocation of fast VRAM for distance field irradiance textures in Unreal Engine’s rendering system. This setting variable is part of the engine’s optimization strategy for managing GPU memory usage and performance.

The Unreal Engine subsystem that relies on this setting variable is primarily the rendering system, specifically the components dealing with global illumination and distance field techniques. It’s used within the FFastVramConfig structure, which is part of the renderer module.

The value of this variable is set using the FASTVRAM_CVAR macro, which likely creates a console variable (CVar) that can be adjusted at runtime. In the provided code, it’s initially set to 0.

This variable interacts with several other FastVRam settings, all of which are part of the same configuration system for optimizing VRAM usage. It’s directly associated with the DistanceFieldIrradiance variable, which is of type ETextureCreateFlags.

Developers must be aware that changing this variable will affect how the engine allocates memory for distance field irradiance textures. Setting it to 1 (or true) will likely prioritize these textures for fast VRAM, potentially improving performance but at the cost of using more of this limited resource.

Best practices when using this variable include:

  1. Only enable it if distance field irradiance is a critical feature in your game and you’re experiencing performance issues.
  2. Monitor VRAM usage when enabling this feature to ensure you’re not causing memory pressure elsewhere.
  3. Test performance with and without this setting enabled to determine if it provides a meaningful benefit for your specific use case.

Regarding the associated variable DistanceFieldIrradiance:

The purpose of DistanceFieldIrradiance is to store the texture creation flags for distance field irradiance textures. It’s used within the FFastVramConfig structure to maintain the current state of the fast VRAM allocation for these textures.

This variable is part of the renderer module and is used in conjunction with the r.FastVRam.DistanceFieldIrradiance console variable to update the texture creation flags when the fast VRAM configuration is updated.

The value of this variable is set in the FFastVramConfig::Update function, which uses the UpdateTextureFlagFromCVar function to synchronize the value with the corresponding console variable.

DistanceFieldIrradiance interacts primarily with r.FastVRam.DistanceFieldIrradiance and other members of the FFastVramConfig structure.

Developers should be aware that this variable directly affects how distance field irradiance textures are created and allocated in GPU memory. Changes to this variable will impact rendering performance and memory usage.

Best practices for using this variable include:

  1. Avoid modifying it directly; instead, use the r.FastVRam.DistanceFieldIrradiance console variable to control its behavior.
  2. Consider the impact on overall rendering performance and memory usage when adjusting related fast VRAM settings.
  3. Use profiling tools to measure the impact of changes to this setting on your specific project.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:486

Scope: file

Source code excerpt:

FASTVRAM_CVAR(DistanceFieldAODownsampledBentNormal, 1); 
FASTVRAM_CVAR(DistanceFieldAOBentNormal, 0); 
FASTVRAM_CVAR(DistanceFieldIrradiance, 0); 
FASTVRAM_CVAR(DistanceFieldShadows, 1);
FASTVRAM_CVAR(Distortion, 1);
FASTVRAM_CVAR(ScreenSpaceShadowMask, 1);
FASTVRAM_CVAR(VolumetricFog, 1);
FASTVRAM_CVAR(SeparateTranslucency, 0); 
FASTVRAM_CVAR(SeparateTranslucencyModulate, 0);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:486

Scope: file

Source code excerpt:

FASTVRAM_CVAR(DistanceFieldAODownsampledBentNormal, 1); 
FASTVRAM_CVAR(DistanceFieldAOBentNormal, 0); 
FASTVRAM_CVAR(DistanceFieldIrradiance, 0); 
FASTVRAM_CVAR(DistanceFieldShadows, 1);
FASTVRAM_CVAR(Distortion, 1);
FASTVRAM_CVAR(ScreenSpaceShadowMask, 1);
FASTVRAM_CVAR(VolumetricFog, 1);
FASTVRAM_CVAR(SeparateTranslucency, 0); 
FASTVRAM_CVAR(SeparateTranslucencyModulate, 0);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:686

Scope (from outer to inner):

file
function     void FFastVramConfig::Update

Source code excerpt:

	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldAODownsampledBentNormal, DistanceFieldAODownsampledBentNormal);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldAOBentNormal, DistanceFieldAOBentNormal);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldIrradiance, DistanceFieldIrradiance);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldShadows, DistanceFieldShadows);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_Distortion, Distortion);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_ScreenSpaceShadowMask, ScreenSpaceShadowMask);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_VolumetricFog, VolumetricFog);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_SeparateTranslucency, SeparateTranslucency);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_SeparateTranslucencyModulate, SeparateTranslucencyModulate);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.h:2836

Scope: file

Source code excerpt:

	ETextureCreateFlags DistanceFieldAODownsampledBentNormal;
	ETextureCreateFlags DistanceFieldShadows;
	ETextureCreateFlags DistanceFieldIrradiance;
	ETextureCreateFlags DistanceFieldAOConfidence;
	ETextureCreateFlags Distortion;
	ETextureCreateFlags ScreenSpaceShadowMask;
	ETextureCreateFlags VolumetricFog;
	ETextureCreateFlags SeparateTranslucency;
	ETextureCreateFlags SeparateTranslucencyModulate;