r.PostProcessAllowBlendModes

r.PostProcessAllowBlendModes

#Overview

name: r.PostProcessAllowBlendModes

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.PostProcessAllowBlendModes is to control whether blend modes are enabled in post-process materials within the Unreal Engine rendering system.

This setting variable is primarily used by the Renderer module of Unreal Engine, specifically in the post-processing pipeline. It affects how post-process materials are rendered and blended.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, which means blend modes are allowed by default.

The associated variable CVarPostProcessAllowBlendModes directly interacts with r.PostProcessAllowBlendModes. They share the same value and purpose.

Developers must be aware that:

  1. This variable is a binary switch: 0 disables blend modes (using replace instead), while 1 allows blend modes.
  2. It affects all post-process materials in the scene.
  3. Changes to this variable will impact the visual output of post-process effects.

Best practices when using this variable include:

  1. Only disable blend modes if there’s a specific performance concern or visual artifact related to post-process blending.
  2. Be aware that disabling blend modes may significantly change the appearance of your post-process effects.
  3. Test your post-process materials with both settings to ensure they look correct in both cases.

Regarding the associated variable CVarPostProcessAllowBlendModes:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMaterial.cpp:41

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


TAutoConsoleVariable<int32> CVarPostProcessAllowBlendModes(
	TEXT("r.PostProcessAllowBlendModes"),
	1,
	TEXT("Enables blend modes in post process materials.\n")
	TEXT("0: disable blend modes. Uses replace\n")
	TEXT("1: allow blend modes\n")
	);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMaterial.cpp:40

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	);

TAutoConsoleVariable<int32> CVarPostProcessAllowBlendModes(
	TEXT("r.PostProcessAllowBlendModes"),
	1,
	TEXT("Enables blend modes in post process materials.\n")
	TEXT("0: disable blend modes. Uses replace\n")
	TEXT("1: allow blend modes\n")
	);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMaterial.cpp:118

Scope (from outer to inner):

file
namespace    anonymous
function     static bool IsMaterialBlendEnabled

Source code excerpt:

	check(Material);

	return Material->GetBlendableOutputAlpha() && CVarPostProcessAllowBlendModes.GetValueOnRenderThread() != 0;
}

static FRHIBlendState* GetMaterialBlendState(const FMaterial* Material)
{
	static FRHIBlendState* BlendStates[] =
	{