landscape.EnableGPUCullingShadows

landscape.EnableGPUCullingShadows

#Overview

name: landscape.EnableGPUCullingShadows

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of landscape.EnableGPUCullingShadows is to control whether GPU culling is used for shadow views in landscape rendering. It’s primarily used for optimizing the rendering system, specifically for landscape shadows.

This setting variable is relied upon by the Landscape module within Unreal Engine’s rendering system. It’s referenced in the LandscapeCulling.cpp file, which is part of the Landscape runtime.

The value of this variable is set as a console variable (CVar) with an initial value of 1 (enabled). It can be changed at runtime through the console or programmatically.

This variable interacts closely with another console variable, CVarLandscapeEnableGPUCulling. Both variables are checked in conjunction to determine if GPU culling should be applied for shadow views.

Developers must be aware that this variable affects runtime performance and shadow rendering quality for landscapes. Enabling it (value 1) can potentially improve performance by reducing the number of landscape components that need to be processed for shadow rendering.

Best practices when using this variable include:

  1. Testing performance with it enabled and disabled to determine the optimal setting for your specific landscape and lighting setup.
  2. Consider disabling it if you notice any visual artifacts in landscape shadows.
  3. Use in conjunction with other landscape and shadow optimization techniques for best results.

Regarding the associated variable CVarLandscapeEnableGPUCullingShadows:

This is the actual console variable that stores the value of landscape.EnableGPUCullingShadows. It’s defined using TAutoConsoleVariable, which allows it to be changed at runtime.

The purpose of CVarLandscapeEnableGPUCullingShadows is the same as landscape.EnableGPUCullingShadows - to control GPU culling for landscape shadow views.

This variable is used directly in the Landscape module’s culling system. It’s checked in the InitShadowViews function within the UE::Landscape::Culling namespace.

The value of this variable is set initially to 1 (enabled) but can be changed through the console or programmatically at runtime.

It interacts with CVarLandscapeEnableGPUCulling, as both need to be enabled for GPU culling of shadow views to occur.

Developers should be aware that changes to this variable take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag.

Best practices include:

  1. Use the console command “landscape.EnableGPUCullingShadows” to toggle this setting during development and testing.
  2. Monitor performance metrics when changing this value to understand its impact on your specific use case.
  3. Consider exposing this as a user-configurable setting if your game targets a wide range of hardware capabilities.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeCulling.cpp:22

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLandscapeEnableGPUCullingShadows(
	TEXT("landscape.EnableGPUCullingShadows"),
	1,
	TEXT("Whether to use landscape GPU culling for a shadow views when it's supported. Allows to toggle shadow views culling at runtime"),
	ECVF_RenderThreadSafe);


/** Vertex factory for a tiled landscape rendering  */

#Associated Variable and Callsites

This variable is associated with another variable named CVarLandscapeEnableGPUCullingShadows. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeCulling.cpp:21

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarLandscapeEnableGPUCullingShadows(
	TEXT("landscape.EnableGPUCullingShadows"),
	1,
	TEXT("Whether to use landscape GPU culling for a shadow views when it's supported. Allows to toggle shadow views culling at runtime"),
	ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeCulling.cpp:809

Scope (from outer to inner):

file
namespace    UE::Landscape::Culling
function     void InitShadowViews

Source code excerpt:

	if (GCullingSystem.Landscapes.Num() == 0 ||
		CVarLandscapeEnableGPUCulling.GetValueOnRenderThread() == 0 || 
		CVarLandscapeEnableGPUCullingShadows.GetValueOnRenderThread() == 0)
	{
		return;
	}

	QUICK_SCOPE_CYCLE_COUNTER(STAT_LandscapeCulling_InitShadowViews);