r.VolumetricCloud.SoftBlendingDistanceOnTranslucent

r.VolumetricCloud.SoftBlendingDistanceOnTranslucent

#Overview

name: r.VolumetricCloud.SoftBlendingDistanceOnTranslucent

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.VolumetricCloud.SoftBlendingDistanceOnTranslucent is to control the soft blending distance in kilometers used to blend volumetric clouds over translucent objects from the evaluated start depth.

This setting variable is primarily used in the rendering system, specifically for volumetric cloud rendering and its interaction with translucent objects. It is part of Unreal Engine’s volumetric cloud rendering subsystem.

The value of this variable is set through the console variable CVarVolumetricCloudSoftBlendingDistanceOnTranslucent. It is defined in the TranslucentRendering.cpp file and has a default value of 0.5 kilometers.

The variable interacts with the BasePassParameters struct, specifically the SoftBlendingDistanceKm member. Its value is used in the CreateTranslucentBasePassUniformBuffer function to set up rendering parameters for translucent objects.

Developers should be aware that:

  1. The value is clamped to a minimum of 0.0001 kilometers to prevent potential division by zero issues.
  2. This setting affects the visual quality of the transition between volumetric clouds and translucent objects.
  3. It is marked as render thread safe and scalable, meaning it can be adjusted at runtime and may be affected by scalability settings.

Best practices when using this variable include:

  1. Adjusting it carefully to achieve the desired visual effect without introducing artifacts.
  2. Testing different values in various lighting conditions and with different types of translucent objects.
  3. Considering performance implications when increasing the blending distance, as it may affect render times.

Regarding the associated variable CVarVolumetricCloudSoftBlendingDistanceOnTranslucent:

The purpose of this variable is to provide a console-accessible way to modify the r.VolumetricCloud.SoftBlendingDistanceOnTranslucent setting. It is defined as a TAutoConsoleVariable, allowing it to be changed at runtime through the console or configuration files.

This variable is part of the rendering system, specifically the volumetric cloud rendering subsystem. It is defined in the same file (TranslucentRendering.cpp) and is used to set the value for the r.VolumetricCloud.SoftBlendingDistanceOnTranslucent setting.

The value of this variable is set when it is defined, with a default of 0.5. It can be modified through the Unreal Engine console or configuration files.

Developers should be aware that:

  1. Changes to this variable will immediately affect the rendering of volumetric clouds over translucent objects.
  2. It is marked as render thread safe and scalable, allowing for runtime adjustments and potential automated scaling based on performance settings.

Best practices for using this variable include:

  1. Using it for quick iterations and testing of different soft blending distances during development.
  2. Documenting any specific values found to work well for your project’s visual style.
  3. Considering exposing this setting to artists or technical artists for fine-tuning the appearance of volumetric clouds in different scenes.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentRendering.cpp:88

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarVolumetricCloudSoftBlendingDistanceOnTranslucent(
	TEXT("r.VolumetricCloud.SoftBlendingDistanceOnTranslucent"), 0.5,
	TEXT("The soft blending in distance in kilometer used to soft blend in cloud over translucent from the evaluated start depth."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

int32 GSeparateTranslucencyUpsampleMode = 1;
static FAutoConsoleVariableRef CVarSeparateTranslucencyUpsampleMode(
	TEXT("r.SeparateTranslucencyUpsampleMode"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentRendering.cpp:87

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe | ECVF_Default);

static TAutoConsoleVariable<float> CVarVolumetricCloudSoftBlendingDistanceOnTranslucent(
	TEXT("r.VolumetricCloud.SoftBlendingDistanceOnTranslucent"), 0.5,
	TEXT("The soft blending in distance in kilometer used to soft blend in cloud over translucent from the evaluated start depth."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

int32 GSeparateTranslucencyUpsampleMode = 1;
static FAutoConsoleVariableRef CVarSeparateTranslucencyUpsampleMode(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentRendering.cpp:896

Scope (from outer to inner):

file
function     TRDGUniformBufferRef<FTranslucentBasePassUniformParameters> CreateTranslucentBasePassUniformBuffer

Source code excerpt:

		}

		BasePassParameters.SoftBlendingDistanceKm = FMath::Max(0.0001f, CVarVolumetricCloudSoftBlendingDistanceOnTranslucent.GetValueOnRenderThread());
		BasePassParameters.ApplyVolumetricCloudOnTransparent = 0.0f;
		BasePassParameters.VolumetricCloudColor = nullptr;
		BasePassParameters.VolumetricCloudDepth = nullptr;
		BasePassParameters.VolumetricCloudColorSampler = TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
		BasePassParameters.VolumetricCloudDepthSampler = TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
		if (IsVolumetricRenderTargetEnabled() && View.ViewState && ShouldRenderVolumetricCloud(Scene, View.Family->EngineShowFlags))