r.Ortho.Debug.ForceCameraFarPlane
r.Ortho.Debug.ForceCameraFarPlane
#Overview
name: r.Ortho.Debug.ForceCameraFarPlane
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Debug Force Ortho Far Plane when creating a new camera actor
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Ortho.Debug.ForceCameraFarPlane is to force a specific far plane distance for orthographic cameras during debugging. This setting is part of the camera system in Unreal Engine 5, specifically for debugging orthographic projection setups.
This setting variable is primarily used in the Engine module, particularly within the camera stack subsystem. It’s referenced in the CameraStackTypes.cpp file, which suggests it’s closely tied to the camera functionality in Unreal Engine.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of UE_OLD_WORLD_MAX, which is likely a very large number to represent an effectively infinite far plane.
This variable interacts with an associated variable named CVarDebugForceCameraOrthoFarPlane. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable is intended for debugging purposes only. It should not be relied upon for regular gameplay or production builds. It’s specifically designed to force the far plane of orthographic cameras, which can be useful for diagnosing rendering issues or testing extreme camera setups.
Best practices when using this variable include:
- Only use it for debugging purposes.
- Remember to reset it to its default value after debugging.
- Be cautious about performance implications when setting very large values.
- Use in conjunction with other orthographic camera debug settings for comprehensive testing.
Regarding the associated variable CVarDebugForceCameraOrthoFarPlane:
The purpose of CVarDebugForceCameraOrthoFarPlane is identical to r.Ortho.Debug.ForceCameraFarPlane. It’s the actual C++ variable that represents the console variable in the engine’s code.
This variable is used in the Engine module, specifically in the camera stack system. It’s defined and used in the CameraStackTypes.cpp file.
The value of this variable is set through the console variable system, initialized with UE_OLD_WORLD_MAX as the default value.
It directly interacts with r.Ortho.Debug.ForceCameraFarPlane, as they represent the same console variable.
Developers should be aware that this is the actual C++ variable used in the code to access the console variable’s value. It’s used in the CalculateProjectionMatrixGivenViewRectangle function to override the orthographic far plane distance during debug sessions.
Best practices for using this variable include:
- Access it using the GetValueOnAnyThread() method when you need its current value.
- Remember that changes to this variable will affect all orthographic cameras in the scene during debugging.
- Use it in conjunction with other debug variables like CVarDebugForceCameraOrthoNearPlane for comprehensive camera debugging.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Camera/CameraStackTypes.cpp:89
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarDebugForceCameraOrthoFarPlane(
TEXT("r.Ortho.Debug.ForceCameraFarPlane"),
UE_OLD_WORLD_MAX,
TEXT("Debug Force Ortho Far Plane when creating a new camera actor"),
ECVF_RenderThreadSafe
);
#endif
#Associated Variable and Callsites
This variable is associated with another variable named CVarDebugForceCameraOrthoFarPlane
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Camera/CameraStackTypes.cpp:88
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<float> CVarDebugForceCameraOrthoFarPlane(
TEXT("r.Ortho.Debug.ForceCameraFarPlane"),
UE_OLD_WORLD_MAX,
TEXT("Debug Force Ortho Far Plane when creating a new camera actor"),
ECVF_RenderThreadSafe
);
#endif
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Camera/CameraStackTypes.cpp:226
Scope (from outer to inner):
file
function void FMinimalViewInfo::CalculateProjectionMatrixGivenViewRectangle
Source code excerpt:
ViewInfo.bAutoCalculateOrthoPlanes = CVarDebugForceUseOrthoAutoPlanes.GetValueOnAnyThread();
ViewInfo.OrthoNearClipPlane = CVarDebugForceCameraOrthoNearPlane.GetValueOnAnyThread();
ViewInfo.OrthoFarClipPlane = CVarDebugForceCameraOrthoFarPlane.GetValueOnAnyThread();
}
#endif
bool bOrthographic = ViewInfo.ProjectionMode == ECameraProjectionMode::Orthographic;
if(bOrthographic)
{