r.EmitterSpawnRateScale

r.EmitterSpawnRateScale

#Overview

name: r.EmitterSpawnRateScale

The value of this variable can be defined or overridden in .ini config files. 5 .ini config files referencing this setting variable.

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 r.EmitterSpawnRateScale is to provide a global scale factor for the spawn rate of particle emitters in Unreal Engine’s rendering system. This variable allows developers to adjust the overall particle spawn rate across the entire game or application without modifying individual emitter settings.

This setting variable is primarily used by the Unreal Engine’s particle system, which is part of the rendering subsystem. It is referenced in the Engine module, specifically in the particle spawn functionality.

The value of this variable is set through the console or configuration files. It is defined as a TAutoConsoleVariable with a default value of 1.0, meaning no scaling by default.

The r.EmitterSpawnRateScale variable interacts with the bApplyGlobalSpawnRateScale property of individual particle emitters. Emitters can choose whether to apply this global scale or ignore it based on this property.

Developers must be aware that this variable affects all emitters that have the bApplyGlobalSpawnRateScale property set to true. It’s a powerful tool for performance optimization and visual adjustments, but it can also lead to unexpected behavior if not used carefully.

Best practices when using this variable include:

  1. Use it for global performance adjustments rather than artistic changes.
  2. Be cautious when changing its value during runtime, as it can cause sudden changes in particle density.
  3. Document its usage clearly for other team members.
  4. Consider using it in conjunction with scalability settings to adjust particle density based on performance requirements.
  5. Test thoroughly after making changes to ensure desired visual and performance outcomes across all affected emitters.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseScalability.ini:624, section: [EffectsQuality@0]

Location: <Workspace>/Engine/Config/BaseScalability.ini:651, section: [EffectsQuality@1]

Location: <Workspace>/Engine/Config/BaseScalability.ini:678, section: [EffectsQuality@2]

Location: <Workspace>/Engine/Config/BaseScalability.ini:705, section: [EffectsQuality@3]

Location: <Workspace>/Engine/Config/BaseScalability.ini:733, section: [EffectsQuality@Cine]

#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:4114

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarEmitterSpawnRateScale(
	TEXT("r.EmitterSpawnRateScale"),
	1.0,
	TEXT("A global scale upon the spawn rate of emitters. Emitters can choose to apply or ignore it via their bApplyGlobalSpawnRateScale property."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarCheckSRVTransitions(
	TEXT("r.CheckSRVTransitions"),

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Particles/Spawn/ParticleModuleSpawn.h:36

Scope (from outer to inner):

file
class        class UParticleModuleSpawn : public UParticleModuleSpawnBase

Source code excerpt:

	TEnumAsByte<EParticleBurstMethod> ParticleBurstMethod;

	/**	If true, the SpawnRate will be scaled by the global CVar r.EmitterSpawnRateScale */
	UPROPERTY(EditAnywhere, Category=Spawn)
	uint32 bApplyGlobalSpawnRateScale : 1;

	/** Initializes the default values for this property */
	void InitializeDefaults();

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleModules_Spawn.cpp:248

Scope (from outer to inner):

file
function     float UParticleModuleSpawn::GetGlobalRateScale

Source code excerpt:

float UParticleModuleSpawn::GetGlobalRateScale()const
{
	static const auto EmitterRateScaleCVar = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("r.EmitterSpawnRateScale"));
	return (bApplyGlobalSpawnRateScale && EmitterRateScaleCVar) ? EmitterRateScaleCVar->GetValueOnAnyThread() : 1.0f;
}

/*-----------------------------------------------------------------------------
	UParticleModuleSpawnPerUnit implementation.
-----------------------------------------------------------------------------*/