r.PrecomputedVisibilityWarning

r.PrecomputedVisibilityWarning

#Overview

name: r.PrecomputedVisibilityWarning

This variable is created as a Console Variable (cvar).

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:

  1. It is initialized as a console variable in ConsoleManager.cpp with a default value of 0.
  2. It can be configured in the Renderer Settings (RendererSettings.h) as a user-editable property.
  3. 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:

  1. This warning is particularly useful for games that rely heavily on precomputed visibility, such as first-person mobile games.
  2. Enabling this warning (setting to 1) may impact performance slightly due to the additional check during rendering.

Best practices when using this variable include:

  1. Enable it during development and testing phases to ensure precomputed visibility data is properly set up.
  2. Consider disabling it in shipping builds to avoid unnecessary overhead.
  3. Use it in conjunction with other visibility and culling tools to optimize scene rendering.

Regarding the associated variable CVarPrecomputedVisibilityWarning:

#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"));