FX.AllowCulling

FX.AllowCulling

#Overview

name: FX.AllowCulling

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 FX.AllowCulling is to control whether particle emitters in the Unreal Engine 5 can be culled. Culling is a process that helps optimize rendering performance by not rendering objects that are not visible to the camera.

This setting variable is primarily used in the particle and visual effects (FX) system of Unreal Engine 5. Based on the callsites, it’s clear that this variable is part of the Engine module, specifically within the particle system components.

The value of this variable is set through a console variable (CVar) named “FX.AllowCulling”. It’s associated with the bAllowCulling variable, which is defined in the FXConsoleVariables namespace.

The bAllowCulling variable interacts directly with the FX.AllowCulling console variable. They share the same value, allowing for runtime modification of the culling behavior.

Developers must be aware that:

  1. This variable affects performance and visual output of particle systems.
  2. It’s marked with ECVF_Cheat flag, indicating it’s intended for development and debugging purposes.
  3. Disabling culling (setting to false) can significantly impact performance, especially in scenes with many particle emitters.

Best practices when using this variable include:

  1. Keep it enabled (true) for release builds to maintain optimal performance.
  2. Use it for debugging purposes when investigating issues with particle visibility.
  3. Be cautious when disabling it, as it can lead to rendering all particles, even those off-screen.

Regarding the associated variable bAllowCulling: The purpose of bAllowCulling is to store the state of particle emitter culling within the engine’s code.

It’s used in the Engine module, specifically in the particle system and FX components.

The value is set through the FX.AllowCulling console variable and can be modified at runtime.

It interacts directly with FX.AllowCulling and is used in various parts of the engine to determine if culling should be applied.

Developers should be aware that:

  1. This variable directly affects the behavior of particle systems.
  2. It’s used in performance-critical areas like bounds calculation.

Best practices include:

  1. Avoid directly modifying this variable; instead, use the FX.AllowCulling console variable.
  2. Consider the performance implications when disabling culling, especially in particle-heavy scenes.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/FXSystem.cpp:204

Scope (from outer to inner):

file
namespace    FXConsoleVariables

Source code excerpt:

		);
	FAutoConsoleVariableRef CVarAllowCulling(
		TEXT("FX.AllowCulling"),
		bAllowCulling,
		TEXT("Allow emitters to be culled."),
		ECVF_Cheat
		);
	int32 bAllowGPUParticles = true;
	FAutoConsoleVariableRef CVarAllowGPUParticles(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/FXSystem.cpp:123

Scope (from outer to inner):

file
namespace    FXConsoleVariables

Source code excerpt:

	int32 VisualizeGPUSimulation = 0;
	int32 bAllowGPUSorting = true;
	int32 bAllowCulling = true;
	int32 bFreezeGPUSimulation = false;
	int32 bFreezeParticleSimulation = false;
	int32 bAllowAsyncTick = !WITH_EDITOR;
	float ParticleSlackGPU = 0.02f;
	int32 MaxParticleTilePreAllocation = 100;
	int32 MaxCPUParticlesPerEmitter = 1000;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/FXSystem.cpp:205

Scope (from outer to inner):

file
namespace    FXConsoleVariables

Source code excerpt:

	FAutoConsoleVariableRef CVarAllowCulling(
		TEXT("FX.AllowCulling"),
		bAllowCulling,
		TEXT("Allow emitters to be culled."),
		ECVF_Cheat
		);
	int32 bAllowGPUParticles = true;
	FAutoConsoleVariableRef CVarAllowGPUParticles(
		TEXT("FX.AllowGPUParticles"),

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleComponents.cpp:4966

Scope (from outer to inner):

file
function     FBoxSphereBounds UParticleSystemComponent::CalcBounds

Source code excerpt:

		return UseAutoParent->Bounds;
	}
	else if (FXConsoleVariables::bAllowCulling == false)
	{
		BoundingBox = FBox(FVector(-HALF_WORLD_MAX), FVector(HALF_WORLD_MAX));
	}
	else if(Template && Template->bUseFixedRelativeBoundingBox)
	{
		// Use hardcoded relative bounding box from template.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/FXSystem.h:65

Scope (from outer to inner):

file
namespace    FXConsoleVariables

Source code excerpt:

	ENGINE_API extern int32 bAllowGPUSorting;
	/** true if emitters can be culled. */
	extern int32 bAllowCulling;
	/** true if GPU particle simulation is frozen. */
	extern int32 bFreezeGPUSimulation;
	/** true if particle simulation is frozen. */
	extern int32 bFreezeParticleSimulation;
	/** true if we allow async ticks */
	extern int32 bAllowAsyncTick;