r.Editor.3DGridFade
r.Editor.3DGridFade
#Overview
name: r.Editor.3DGridFade
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Tweak to define the grid rendering in 3D viewports.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Editor.3DGridFade is to control the opacity of the 3D grid rendering in the Unreal Engine editor’s viewports. This setting variable is part of the editor’s visualization system, specifically for adjusting the appearance of the 3D grid in the viewport.
This setting variable is primarily used in the UnrealEd module, which is responsible for the editor’s functionality. It is directly referenced in the EditorComponents.cpp file, which suggests it’s part of the editor’s component system.
The value of this variable is set as a console variable (CVar) with an initial value of 0.5f. It can be modified at runtime through the console or through engine configuration files.
The r.Editor.3DGridFade variable interacts with CVarEditor3DGridFade, which is the actual TAutoConsoleVariable object that stores and manages the value. They essentially represent the same setting, with r.Editor.3DGridFade being the string identifier used to access the value.
Developers should be aware that this variable affects the visual appearance of the 3D grid in the editor viewport. Changing its value will alter the opacity of the grid, which can impact the visibility and usability of the grid for level design and object placement.
Best practices when using this variable include:
- Adjusting it to balance grid visibility with scene clarity.
- Considering different values for different types of scenes or lighting conditions.
- Documenting any non-default values used in a project for consistency across the development team.
Regarding the associated variable CVarEditor3DGridFade:
The purpose of CVarEditor3DGridFade is to serve as the actual console variable object that stores and manages the value for the 3D grid fade setting.
It is used within the UnrealEd module, specifically in the FGridWidget::DrawNewGrid function, where it’s applied to set the alpha value of the grid color in perspective viewports.
The value of CVarEditor3DGridFade is set when the r.Editor.3DGridFade console variable is modified.
This variable interacts directly with the material instance used for rendering the grid, setting its color parameter.
Developers should be aware that accessing this variable directly in C++ code requires using the GetValueOnGameThread() method to retrieve its current value.
Best practices for using CVarEditor3DGridFade include:
- Using it in conjunction with other viewport rendering settings for a cohesive look.
- Considering performance implications when frequently changing or accessing its value.
- Ensuring thread-safety when accessing the value, as indicated by the ECVF_RenderThreadSafe flag.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorComponents.cpp:37
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarEditor3DGridFade(
TEXT("r.Editor.3DGridFade"),
0.5f,
TEXT("Tweak to define the grid rendering in 3D viewports."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarEditor3DSnapFade(
TEXT("r.Editor.3DSnapFade"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarEditor3DGridFade
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorComponents.cpp:36
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarEditor3DGridFade(
TEXT("r.Editor.3DGridFade"),
0.5f,
TEXT("Tweak to define the grid rendering in 3D viewports."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarEditor3DSnapFade(
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorComponents.cpp:187
Scope (from outer to inner):
file
function void FGridWidget::DrawNewGrid
Source code excerpt:
if(bIsPerspective)
{
MaterialInst->SetVectorParameterValue(GridColorName, FLinearColor(0.6f * Darken, 0.6f * Darken, 0.6f * Darken, CVarEditor3DGridFade.GetValueOnGameThread()));
MaterialInst->SetVectorParameterValue(SnapColorName, FLinearColor(0.5f, 0.0f, 0.0f, SnapAlphaMultiplier * CVarEditor3DSnapFade.GetValueOnGameThread()));
}
else
{
MaterialInst->SetVectorParameterValue(GridColorName, FLinearColor(0.6f * Darken, 0.6f * Darken, 0.6f * Darken, CVarEditor2DGridFade.GetValueOnGameThread()));
MaterialInst->SetVectorParameterValue(SnapColorName, FLinearColor(0.5f, 0.0f, 0.0f, SnapAlphaMultiplier * CVarEditor2DSnapFade.GetValueOnGameThread()));