r.PrecomputedVisibilityWarning
r.PrecomputedVisibilityWarning
#Overview
name: r.PrecomputedVisibilityWarning
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If set to 1, a warning will be displayed when rendering a scene from a view point without precomputed visibility.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PrecomputedVisibilityWarning is to control whether a warning is displayed when rendering a scene from a viewpoint without precomputed visibility data. This setting is primarily used in the rendering system of Unreal Engine 5.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, specifically within the scene rendering process.
The value of this variable is set in multiple places:
- It is initialized as a console variable in ConsoleManager.cpp with a default value of 0.
- It can be configured in the Renderer Settings (RendererSettings.h) as a user-editable property.
- It can be changed at runtime through the console or project settings.
The associated variable CVarPrecomputedVisibilityWarning interacts directly with r.PrecomputedVisibilityWarning. They share the same value and purpose.
Developers must be aware that:
- This warning is particularly useful for games that rely heavily on precomputed visibility, such as first-person mobile games.
- Enabling this warning (setting to 1) may impact performance slightly due to the additional check during rendering.
Best practices when using this variable include:
- Enable it during development and testing phases to ensure precomputed visibility data is properly set up.
- Consider disabling it in shipping builds to avoid unnecessary overhead.
- Use it in conjunction with other visibility and culling tools to optimize scene rendering.
Regarding the associated variable CVarPrecomputedVisibilityWarning:
- It is the console variable representation of r.PrecomputedVisibilityWarning.
- It is used in the rendering code to check if the warning should be displayed.
- Developers can access and modify this variable programmatically using the console variable system.
- When working with this variable in C++ code, always use IConsoleManager::Get().FindTConsoleVariableDataInt() to retrieve its current value, as shown in the SceneRendering.cpp example.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:4088
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarPrecomputedVisibilityWarning(
TEXT("r.PrecomputedVisibilityWarning"),
0,
TEXT("If set to 1, a warning will be displayed when rendering a scene from a view point without precomputed visibility."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarDemotedLocalMemoryWarning(
TEXT("r.DemotedLocalMemoryWarning"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/RendererSettings.h:370
Scope (from outer to inner):
file
class class URendererSettings : public UDeveloperSettings
Source code excerpt:
UPROPERTY(config, EditAnywhere, Category=Culling, meta=(
ConsoleVariable="r.PrecomputedVisibilityWarning",DisplayName="Warn about no precomputed visibility",
ToolTip="Displays a warning when no precomputed visibility data is available for the current camera location. This can be helpful if you are making a game that relies on precomputed visibility, e.g. a first person mobile game."))
uint32 bPrecomputedVisibilityWarning:1;
UPROPERTY(config, EditAnywhere, Category=Textures, meta=(
ConsoleVariable="r.TextureStreaming",DisplayName="Texture Streaming",
ToolTip="When enabled textures will stream in based on what is visible on screen."))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:3671
Scope (from outer to inner):
file
function void FSceneRenderer::OnRenderFinish
Source code excerpt:
{
bool bShowPrecomputedVisibilityWarning = false;
static const auto* CVarPrecomputedVisibilityWarning = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.PrecomputedVisibilityWarning"));
if (CVarPrecomputedVisibilityWarning && CVarPrecomputedVisibilityWarning->GetValueOnRenderThread() == 1)
{
bShowPrecomputedVisibilityWarning = !bUsedPrecomputedVisibility;
}
bool bShowDemotedLocalMemoryWarning = false;
#Associated Variable and Callsites
This variable is associated with another variable named CVarPrecomputedVisibilityWarning
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:4087
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarPrecomputedVisibilityWarning(
TEXT("r.PrecomputedVisibilityWarning"),
0,
TEXT("If set to 1, a warning will be displayed when rendering a scene from a view point without precomputed visibility."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarDemotedLocalMemoryWarning(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:3671
Scope (from outer to inner):
file
function void FSceneRenderer::OnRenderFinish
Source code excerpt:
{
bool bShowPrecomputedVisibilityWarning = false;
static const auto* CVarPrecomputedVisibilityWarning = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.PrecomputedVisibilityWarning"));
if (CVarPrecomputedVisibilityWarning && CVarPrecomputedVisibilityWarning->GetValueOnRenderThread() == 1)
{
bShowPrecomputedVisibilityWarning = !bUsedPrecomputedVisibility;
}
bool bShowDemotedLocalMemoryWarning = false;
static const auto* CVarDemotedLocalMemoryWarning = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.DemotedLocalMemoryWarning"));