r.LocalFogVolume.HalfResolution

r.LocalFogVolume.HalfResolution

#Overview

name: r.LocalFogVolume.HalfResolution

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.LocalFogVolume.HalfResolution is to control the resolution at which local fog volumes are rendered in Unreal Engine 5. Specifically, it allows rendering local fog volumes at half resolution with subsequent upsampling to full resolution, primarily for the mobile rendering path.

This setting variable is utilized by the rendering system, particularly the local fog volume rendering subsystem. Based on the callsites, it’s part of the Renderer module in Unreal Engine 5.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0 and can be changed at runtime.

The associated variable CVarLocalFogVolumeHalfResolution directly interacts with r.LocalFogVolume.HalfResolution. They share the same value and purpose.

Developers must be aware that:

  1. This feature is primarily intended for the mobile rendering path.
  2. Setting this to 1 will render local fog volumes at half resolution, which may impact visual quality but improve performance.
  3. The upsampling process occurs after the half-resolution rendering.

Best practices when using this variable include:

  1. Only enable it (set to 1) when targeting mobile platforms or when performance is a critical concern.
  2. Test thoroughly to ensure the visual quality remains acceptable after enabling half-resolution rendering.
  3. Consider the trade-off between performance gain and potential loss in fog detail.

Regarding the associated variable CVarLocalFogVolumeHalfResolution:

When working with this feature, developers should profile their application to determine if the performance gain from half-resolution rendering justifies any potential loss in visual fidelity.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLocalFogVolumeHalfResolution(
	TEXT("r.LocalFogVolume.HalfResolution"), 0,
	TEXT("Set to one to render local fog volumes at half resoltuion with an upsampling to full resolution later. Only work for the mobile path for now.\n"),
	ECVF_RenderThreadSafe);

// Example of tile setup
//  - 1920x1080 => 15x9 tiles
//  - Allowing max 32 volumes at once => culling list buffer = 15 * 9 * 32 * 1 byte = 4320 bytes = 4.3KB

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarLocalFogVolumeHalfResolution(
	TEXT("r.LocalFogVolume.HalfResolution"), 0,
	TEXT("Set to one to render local fog volumes at half resoltuion with an upsampling to full resolution later. Only work for the mobile path for now.\n"),
	ECVF_RenderThreadSafe);

// Example of tile setup
//  - 1920x1080 => 15x9 tiles

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

Scope (from outer to inner):

file
function     bool IsLocalFogVolumeHalfResolution

Source code excerpt:

bool IsLocalFogVolumeHalfResolution()
{
	return CVarLocalFogVolumeHalfResolution.GetValueOnRenderThread() > 0;
}

DECLARE_GPU_STAT(LocalFogVolumeVolumes);

static const uint32 SizeOfUintVec4 = sizeof(FUintVector4);
static const uint32 UintVec4CountInLocalFogVolumeGPUInstanceData = sizeof(FLocalFogVolumeGPUInstanceData) / SizeOfUintVec4;