r.Bloom.WarnKernelResolution

r.Bloom.WarnKernelResolution

#Overview

name: r.Bloom.WarnKernelResolution

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.Bloom.WarnKernelResolution is to control whether warnings are emitted when the resolution of the bloom convolution kernel is unnecessarily high. This setting is part of Unreal Engine’s rendering system, specifically related to the post-processing bloom effect.

This setting variable is primarily used in the Renderer module, particularly in the post-processing subsystem for bloom effects. It’s referenced in the PostProcessFFTBloom.cpp file, which handles Fast Fourier Transform-based bloom processing.

The value of this variable is set through the console variable system, with a default value of 1. It can be changed at runtime using console commands or through configuration files.

The associated variable CVarBloomWarnKernelResolution directly interacts with r.Bloom.WarnKernelResolution. They share the same value and purpose.

Developers should be aware that this variable has three possible values: 0: Warnings are disabled 1: Warnings are emitted only on console platforms (default) 2: Warnings are emitted on all platforms

The variable is used in the InitDomainAndGetKernel function to determine whether to log a warning about the bloom convolution texture’s resolution. This warning suggests that the texture’s resolution could be lowered to save memory.

Best practices when using this variable include:

  1. Keep it at the default value (1) during development on console platforms to catch potential performance issues.
  2. Consider setting it to 2 during development on all platforms if you want to optimize bloom performance across the board.
  3. Set it to 0 in release builds to avoid unnecessary log spam.
  4. Use the warnings as a guide to optimize your bloom convolution textures, potentially reducing their resolution to save memory without noticeably impacting visual quality.

Regarding the associated variable CVarBloomWarnKernelResolution:

The purpose of CVarBloomWarnKernelResolution is identical to r.Bloom.WarnKernelResolution. It’s the actual C++ variable that implements the console variable functionality.

This variable is defined and used within the Renderer module, specifically in the PostProcessFFTBloom.cpp file.

The value of CVarBloomWarnKernelResolution is set when the console variable r.Bloom.WarnKernelResolution is initialized or changed.

It directly interacts with the r.Bloom.WarnKernelResolution console variable, effectively serving as its C++ representation.

Developers should be aware that this is an internal variable and should not be modified directly in code. Instead, they should use the r.Bloom.WarnKernelResolution console variable to change its value.

Best practices for CVarBloomWarnKernelResolution include:

  1. Use GetValueOnRenderThread() to safely access its value from the render thread.
  2. Don’t modify this variable directly; use the console variable system instead.
  3. Be aware of its thread safety implications, as it’s marked with ECVF_RenderThreadSafe.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessFFTBloom.cpp:29

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> CVarBloomWarnKernelResolution(
	TEXT("r.Bloom.WarnKernelResolution"), 1,
	TEXT("Whether to emit a warning when the resolution of the kernel is unecessary to high.\n")
	TEXT(" 0: Disabled;\n")
	TEXT(" 1: Emit the warning on consoles (default);\n")
	TEXT(" 2: Emit the warning on all platforms;\n"),
	ECVF_RenderThreadSafe);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessFFTBloom.cpp:28

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

TAutoConsoleVariable<int32> CVarBloomWarnKernelResolution(
	TEXT("r.Bloom.WarnKernelResolution"), 1,
	TEXT("Whether to emit a warning when the resolution of the kernel is unecessary to high.\n")
	TEXT(" 0: Disabled;\n")
	TEXT(" 1: Emit the warning on consoles (default);\n")
	TEXT(" 2: Emit the warning on all platforms;\n"),
	ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessFFTBloom.cpp:641

Scope (from outer to inner):

file
function     void InitDomainAndGetKernel

Source code excerpt:

			}

			if (RecommendedKernelDownsscale > 1 && (CVarBloomWarnKernelResolution.GetValueOnRenderThread() > 1 || (CVarBloomWarnKernelResolution.GetValueOnRenderThread() == 1 && FDataDrivenShaderPlatformInfo::GetIsConsole(View.GetShaderPlatform()))))
			{
				UE_LOG(LogRenderer, Warning, TEXT("The FPostProcessSettings::BloomConvolutionTexture could have it's resolution lowered by a factor of %d to save memory."), RecommendedKernelDownsscale);
			}
		}

		// Final resize the kernel for Fourier transformation