r.Ortho.EditorDebugClipPlaneScale
r.Ortho.EditorDebugClipPlaneScale
#Overview
name: r.Ortho.EditorDebugClipPlaneScale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Only affects the editor ortho viewports in Lit modes.\nSet the scale to proportionally alter the near plane based on current Ortho width that is set.\nThis changes when geometry clips in the scene as the Orthozoom is changed. Helpful for varying mesh sizes.\nOther light artefacts may appear when this value changes, this is unavoidable for now.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Ortho.EditorDebugClipPlaneScale is to adjust the near clipping plane in orthographic viewports within the Unreal Editor, specifically in Lit modes. It allows for proportional scaling of the near plane based on the current orthographic width, which affects how geometry clips in the scene as the orthographic zoom changes.
This setting variable is primarily used by the editor’s viewport system, which is part of the UnrealEd module. It’s specifically utilized in the FEditorViewportClient class, which handles the rendering and interaction of editor viewports.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1.0f but can be changed at runtime through console commands or programmatically.
The associated variable CVarOrthoEditorDebugClipPlaneScale directly interacts with r.Ortho.EditorDebugClipPlaneScale. They share the same value and purpose.
Developers must be aware that changing this variable can affect the visibility of geometry in orthographic viewports. It’s particularly useful when dealing with varying mesh sizes, as it allows for adjusting the clipping behavior to accommodate different scales of objects.
Best practices when using this variable include:
- Use it judiciously, as extreme values may cause unexpected clipping or rendering artifacts.
- Be aware that changing this value may introduce light artifacts, which are currently unavoidable.
- Consider the scale of your project’s meshes when adjusting this value to find an optimal setting.
Regarding the associated variable CVarOrthoEditorDebugClipPlaneScale:
The purpose of CVarOrthoEditorDebugClipPlaneScale is identical to r.Ortho.EditorDebugClipPlaneScale. It’s the actual TAutoConsoleVariable object that represents the console variable in the C++ code.
This variable is used in the UnrealEd module, specifically within the FEditorViewportClient class to calculate the near clipping plane for orthographic views.
The value of CVarOrthoEditorDebugClipPlaneScale is set when the console variable is initialized, but it can be changed at runtime using console commands or through code using the SetValueOnAnyThread() method.
CVarOrthoEditorDebugClipPlaneScale directly interacts with the rendering system by influencing the calculation of the orthographic near clipping plane.
Developers should be aware that this variable is thread-safe (ECVF_RenderThreadSafe) and can be accessed from any thread.
Best practices for using CVarOrthoEditorDebugClipPlaneScale include:
- Use GetValueOnAnyThread() to retrieve its current value safely from any thread.
- Be cautious when changing its value, as it directly affects the rendering of orthographic viewports.
- Consider exposing this setting in user-facing options if fine-tuning of orthographic views is needed for your project.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorViewportClient.cpp:99
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarOrthoEditorDebugClipPlaneScale(
TEXT("r.Ortho.EditorDebugClipPlaneScale"),
1.0f,
TEXT("Only affects the editor ortho viewports in Lit modes.\n")
TEXT("Set the scale to proportionally alter the near plane based on current Ortho width that is set.\n")
TEXT("This changes when geometry clips in the scene as the Orthozoom is changed. Helpful for varying mesh sizes.\n")
TEXT("Other light artefacts may appear when this value changes, this is unavoidable for now.\n"),
ECVF_RenderThreadSafe);
#Associated Variable and Callsites
This variable is associated with another variable named CVarOrthoEditorDebugClipPlaneScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorViewportClient.cpp:98
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarOrthoEditorDebugClipPlaneScale(
TEXT("r.Ortho.EditorDebugClipPlaneScale"),
1.0f,
TEXT("Only affects the editor ortho viewports in Lit modes.\n")
TEXT("Set the scale to proportionally alter the near plane based on current Ortho width that is set.\n")
TEXT("This changes when geometry clips in the scene as the Orthozoom is changed. Helpful for varying mesh sizes.\n")
TEXT("Other light artefacts may appear when this value changes, this is unavoidable for now.\n"),
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorViewportClient.cpp:1210
Scope (from outer to inner):
file
function FSceneView* FEditorViewportClient::CalcSceneView
Source code excerpt:
CalculatePlanesViewInfo.bUpdateOrthoPlanes = true;
CalculatePlanesViewInfo.bUseCameraHeightAsViewTarget = true;
CalculatePlanesViewInfo.OrthoNearClipPlane = OrthoWidth * -CVarOrthoEditorDebugClipPlaneScale.GetValueOnAnyThread();
CalculatePlanesViewInfo.OrthoFarClipPlane = FarPlane - NearPlane + CalculatePlanesViewInfo.OrthoNearClipPlane;
CalculatePlanesViewInfo.AutoCalculateOrthoPlanes(ViewInitOptions);
if(ViewInitOptions.UpdateOrthoPlanes(CalculatePlanesViewInfo))
{
ZScale = 1.0f / (CalculatePlanesViewInfo.OrthoFarClipPlane - CalculatePlanesViewInfo.OrthoNearClipPlane);