r.VolumetricRenderTarget.UvNoiseSampleAcceptanceWeight

r.VolumetricRenderTarget.UvNoiseSampleAcceptanceWeight

#Overview

name: r.VolumetricRenderTarget.UvNoiseSampleAcceptanceWeight

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.VolumetricRenderTarget.UvNoiseSampleAcceptanceWeight is to control the acceptance of noisy cloud samples in volumetric rendering based on their similarities. It is specifically used when the Volumetric Render Target upsampling mode is set to a mode that uses jitter.

This setting variable is primarily used in the rendering system, specifically for volumetric rendering and cloud rendering. Based on the callsites, it appears to be part of the Renderer module in Unreal Engine 5.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 20.0f, but can be changed at runtime through console commands or project settings.

The variable interacts with the upsampling mode of the Volumetric Render Target. It’s particularly relevant when the upsampling mode uses jittering techniques.

Developers should be aware that:

  1. A higher value for this variable means that large differences between samples will be less accepted for blending, potentially resulting in sharper but potentially noisier volumetric effects.
  2. This variable is marked as render thread safe and scalable, meaning it can be adjusted for different quality settings without causing thread safety issues.

Best practices when using this variable include:

  1. Experimenting with different values to find the right balance between noise reduction and detail preservation in volumetric effects.
  2. Considering performance implications when adjusting this value, as it may affect the complexity of the blending calculations.

Regarding the associated variable CVarVolumetricRenderTargetUvNoiseSampleAcceptanceWeight:

This is the actual console variable that stores and manages the value of r.VolumetricRenderTarget.UvNoiseSampleAcceptanceWeight. It’s defined using the TAutoConsoleVariable template, which is a part of Unreal Engine’s configuration system.

The purpose of this associated variable is to provide a way to access and modify the UvNoiseSampleAcceptanceWeight value at runtime. It’s used in the GetUvNoiseSampleAcceptanceWeight() function, which retrieves the current value for use in the rendering code.

Developers should be aware that:

  1. This variable can be accessed and modified through console commands.
  2. Changes to this variable will take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag.

Best practices for using this associated variable include:

  1. Using the GetValueOnRenderThread() method to safely retrieve the value in render thread code.
  2. Considering caching the value if it’s accessed frequently, to avoid potential performance overhead from repeated console variable lookups.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricRenderTarget.cpp:22

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarVolumetricRenderTargetUvNoiseSampleAcceptanceWeight(
	TEXT("r.VolumetricRenderTarget.UvNoiseSampleAcceptanceWeight"), 20.0f,
	TEXT("Used when r.VolumetricRenderTarget.UpsamplingMode is in a mode using jitter - this value control the acceptance of noisy cloud samples according to their similarities. A higher value means large differences will be less accepted for blending."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarVolumetricRenderTargetMode(
	TEXT("r.VolumetricRenderTarget.Mode"), 0,
	TEXT("[0] trace quarter resolution + reconstruct at half resolution + upsample [1] trace half res + reconstruct full res + upsample [2] trace at quarter resolution + reconstruct full resolution (cannot intersect with opaque meshes and forces UpsamplingMode=2 [3] Cinematic mode with tracing done at full reoslution in render target so that clouds can also be applied on translucent.)"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricRenderTarget.cpp:21

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<float> CVarVolumetricRenderTargetUvNoiseSampleAcceptanceWeight(
	TEXT("r.VolumetricRenderTarget.UvNoiseSampleAcceptanceWeight"), 20.0f,
	TEXT("Used when r.VolumetricRenderTarget.UpsamplingMode is in a mode using jitter - this value control the acceptance of noisy cloud samples according to their similarities. A higher value means large differences will be less accepted for blending."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarVolumetricRenderTargetMode(
	TEXT("r.VolumetricRenderTarget.Mode"), 0,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricRenderTarget.cpp:53

Scope (from outer to inner):

file
function     static float GetUvNoiseSampleAcceptanceWeight

Source code excerpt:

static float GetUvNoiseSampleAcceptanceWeight()
{
	return FMath::Max(0.0f, CVarVolumetricRenderTargetUvNoiseSampleAcceptanceWeight.GetValueOnRenderThread());
}

static bool ShouldPipelineCompileVolumetricRenderTargetShaders(EShaderPlatform ShaderPlatform)
{
	return GetMaxSupportedFeatureLevel(ShaderPlatform) >= ERHIFeatureLevel::SM5;
}