ShowFlag.CameraInterpolation
ShowFlag.CameraInterpolation
#Overview
name: ShowFlag.CameraInterpolation
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Allows to override a specific showflag (works in editor and game, \
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.CameraInterpolation is to control camera interpolation effects in the rendering system, primarily used for motion blur and other rendering features that rely on previous frame data.
This setting variable is primarily used in the Unreal Engine’s rendering subsystem, specifically in the post-processing and viewport rendering modules. It’s also referenced in the nDisplay plugin for multi-display and projection setups.
The value of this variable is typically set in the game or when previewing cinematics, but it’s usually disabled in the editor. It’s controlled through the engine show flags system, which allows for runtime toggling of various rendering features.
The CameraInterpolation variable interacts closely with the ViewFamily.EngineShowFlags structure, which controls various rendering options. It’s often set to 0 (disabled) in editor viewports to prevent certain rendering artifacts.
Developers should be aware that this variable significantly affects motion blur and other frame-to-frame dependent effects. When disabled, it can improve editor performance and prevent certain visual artifacts, but it may not accurately represent the final in-game appearance.
Best practices for using this variable include:
- Keeping it enabled for final gameplay and cinematic previews to ensure accurate motion blur.
- Disabling it in editor viewports for clearer visibility and better performance.
- Being cautious when manually toggling it, as it can affect the visual fidelity of the scene.
Regarding the associated variable CameraInterpolation, it appears to be the same variable, just referenced in different contexts. It’s used in the same way as ShowFlag.CameraInterpolation, controlling the same rendering feature. The usage patterns and considerations mentioned above apply equally to this associated variable.
In the provided code snippets, we can see that CameraInterpolation is often set to 0 in editor viewports, but it’s checked in the motion blur calculation to determine how to compute the previous world-to-clip matrix. This highlights its importance in frame-to-frame dependent effects like motion blur.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:109
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(1, Refraction, SFG_Developer, NSLOCTEXT("UnrealEd", "RefractionSF", "Refraction"))
/** Usually set in game or when previewing cinematics but not in editor, used for motion blur or any kind of rendering features that rely on the former frame */
SHOWFLAG_ALWAYS_ACCESSIBLE(CameraInterpolation, SFG_Hidden, NSLOCTEXT("UnrealEd", "CameraInterpolationSF", "Camera Interpolation"))
/** Post processing color fringe (chromatic aberration) */
SHOWFLAG_FIXED_IN_SHIPPING(1, SceneColorFringe, SFG_PostProcess, NSLOCTEXT("UnrealEd", "SceneColorFringeSF", "Scene Color Fringe"))
/** Post processing filmic tone curve and expand gamut */
SHOWFLAG_ALWAYS_ACCESSIBLE(ToneCurve, SFG_PostProcess, NSLOCTEXT("UnrealEd", "ToneCurveSF", "Tone Curve"))
/** If Translucency should be rendered into a separate RT and composited without DepthOfField, can be disabled in the materials (affects sorting), SHOWFLAG_ALWAYS_ACCESSIBLE for now because USceneCaptureComponent needs that */
SHOWFLAG_ALWAYS_ACCESSIBLE(SeparateTranslucency, SFG_Advanced, NSLOCTEXT("UnrealEd", "SeparateTranslucencySF", "Separate Translucency"))
#Associated Variable and Callsites
This variable is associated with another variable named CameraInterpolation
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/nDisplay/Source/DisplayClusterLightCardEditor/Private/Viewport/DisplayClusterLightCardEditorViewportClient.cpp:252
Scope (from outer to inner):
file
function void FDisplayClusterLightCardEditorViewportClient::Draw
Source code excerpt:
ViewFamily.EngineShowFlags = UseEngineShowFlags;
ViewFamily.EngineShowFlags.CameraInterpolation = 0;
ViewFamily.EngineShowFlags.SetScreenPercentage(false);
ViewFamily.ViewExtensions = GEngine->ViewExtensions->GatherActiveExtensions(FSceneViewExtensionContext(InViewport));
for (auto ViewExt : ViewFamily.ViewExtensions)
{
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorViewportClient.cpp:4174
Scope (from outer to inner):
file
function void FEditorViewportClient::Draw
Source code excerpt:
// in the editor, disable camera motion blur and other rendering features that rely on the former frame
// unless the view port is cinematic controlled
ViewFamily.EngineShowFlags.CameraInterpolation = 0;
}
if (!bStereoRendering)
{
// stereo is enabled, as many HMDs require this for proper visuals
ViewFamily.EngineShowFlags.SetScreenPercentage(false);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:109
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(1, Refraction, SFG_Developer, NSLOCTEXT("UnrealEd", "RefractionSF", "Refraction"))
/** Usually set in game or when previewing cinematics but not in editor, used for motion blur or any kind of rendering features that rely on the former frame */
SHOWFLAG_ALWAYS_ACCESSIBLE(CameraInterpolation, SFG_Hidden, NSLOCTEXT("UnrealEd", "CameraInterpolationSF", "Camera Interpolation"))
/** Post processing color fringe (chromatic aberration) */
SHOWFLAG_FIXED_IN_SHIPPING(1, SceneColorFringe, SFG_PostProcess, NSLOCTEXT("UnrealEd", "SceneColorFringeSF", "Scene Color Fringe"))
/** Post processing filmic tone curve and expand gamut */
SHOWFLAG_ALWAYS_ACCESSIBLE(ToneCurve, SFG_PostProcess, NSLOCTEXT("UnrealEd", "ToneCurveSF", "Tone Curve"))
/** If Translucency should be rendered into a separate RT and composited without DepthOfField, can be disabled in the materials (affects sorting), SHOWFLAG_ALWAYS_ACCESSIBLE for now because USceneCaptureComponent needs that */
SHOWFLAG_ALWAYS_ACCESSIBLE(SeparateTranslucency, SFG_Advanced, NSLOCTEXT("UnrealEd", "SeparateTranslucencySF", "Separate Translucency"))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMotionBlur.cpp:69
Scope (from outer to inner):
file
namespace anonymous
function FMatrix GetPreviousWorldToClipMatrix
Source code excerpt:
FMatrix GetPreviousWorldToClipMatrix(const FViewInfo& View)
{
if (View.Family->EngineShowFlags.CameraInterpolation)
{
// Instead of finding the world space position of the current pixel, calculate the world space position offset by the camera position,
// then translate by the difference between last frame's camera position and this frame's camera position,
// then apply the rest of the transforms. This effectively avoids precision issues near the extents of large levels whose world space position is very large.
FVector ViewOriginDelta = View.ViewMatrices.GetViewOrigin() - View.PrevViewInfo.ViewMatrices.GetViewOrigin();
return FTranslationMatrix(ViewOriginDelta) * View.PrevViewInfo.ViewMatrices.ComputeViewRotationProjectionMatrix();