r.CameraShake.LegacyPostProcessBlending

r.CameraShake.LegacyPostProcessBlending

#Overview

name: r.CameraShake.LegacyPostProcessBlending

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.CameraShake.LegacyPostProcessBlending is to control how camera shake post-process settings are blended in relation to the main camera’s settings in Unreal Engine 5.

This setting variable is primarily used in the camera system, specifically for camera shake functionality. It is part of the Engine module, as evidenced by its location in the Engine/Source/Runtime/Engine directory.

The Unreal Engine subsystem that relies on this setting variable is the camera system, particularly the camera shake component. This can be seen from its usage in the UCameraShakeBase class.

The value of this variable is set through a console variable (CVar) named GCameraShakeLegacyPostProcessBlending. It is initialized with a default value of false, meaning by default, camera shake post-process settings are blended over the main camera’s settings.

This variable interacts with the ApplyResult function of the UCameraShakeBase class. When the variable is true, it changes the blending order of the camera shake post-process settings.

Developers must be aware that changing this variable will affect how camera shake post-process effects are applied in relation to the main camera’s settings. When set to true, it will use the legacy blending method, which blends the camera shake post-process settings under the main camera instead of over it.

Best practices when using this variable include:

  1. Consider the visual impact of changing this setting, as it can significantly alter the appearance of camera shake effects.
  2. Test thoroughly with both true and false settings to ensure desired visual results across different scenarios.
  3. Document any changes to this setting in your project, as it may affect the work of both programmers and artists.

Regarding the associated variable GCameraShakeLegacyPostProcessBlending:

The purpose of GCameraShakeLegacyPostProcessBlending is to provide a runtime-accessible way to control the r.CameraShake.LegacyPostProcessBlending setting.

This variable is used in the Engine module, specifically within the camera shake system.

The value of this variable is set through the console variable system, allowing it to be changed at runtime.

It directly interacts with the r.CameraShake.LegacyPostProcessBlending setting, effectively controlling its behavior.

Developers should be aware that this variable can be changed at runtime, potentially affecting the visual output of camera shakes during gameplay.

Best practices for using this variable include:

  1. Use GetValueOnGameThread() when accessing its value to ensure thread-safe operations.
  2. Consider exposing this setting in debug menus or configuration files for easier testing and tweaking.
  3. Be cautious when changing this value during runtime, as it may cause sudden visual changes in camera shake effects.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Camera/CameraShakeBase.cpp:16

Scope: file

Source code excerpt:


TAutoConsoleVariable<bool> GCameraShakeLegacyPostProcessBlending(
	TEXT("r.CameraShake.LegacyPostProcessBlending"),
	false,
	TEXT("Blend camera shake post process settings under the main camera instead of over it"));

UCameraShakeBase::UCameraShakeBase(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
	, bSingleInstance(false)

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Camera/CameraShakeBase.cpp:15

Scope: file

Source code excerpt:

DECLARE_CYCLE_STAT(TEXT("CameraShakeUpdateShake"), STAT_UpdateShake, STATGROUP_Game);

TAutoConsoleVariable<bool> GCameraShakeLegacyPostProcessBlending(
	TEXT("r.CameraShake.LegacyPostProcessBlending"),
	false,
	TEXT("Blend camera shake post process settings under the main camera instead of over it"));

UCameraShakeBase::UCameraShakeBase(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Camera/CameraShakeBase.cpp:470

Scope (from outer to inner):

file
function     void UCameraShakeBase::ApplyResult

Source code excerpt:

		if (ApplyParams.CameraManager.IsValid())
		{
			EViewTargetBlendOrder CameraShakeBlendOrder = GCameraShakeLegacyPostProcessBlending.GetValueOnGameThread() ? VTBlendOrder_Base : VTBlendOrder_Override;
			ApplyParams.CameraManager->AddCachedPPBlend(TempResult.PostProcessSettings, TempResult.PostProcessBlendWeight, CameraShakeBlendOrder);
		}
		else
		{
			InOutPOV.PostProcessSettings = TempResult.PostProcessSettings;
			InOutPOV.PostProcessBlendWeight = TempResult.PostProcessBlendWeight;