fx.LWCTileRecache
fx.LWCTileRecache
#Overview
name: fx.LWCTileRecache
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When we cross this number of LWC tiles from where we started the FX we need to recache the LWC tile to avoid artifacts.\nWhen this occurs the system may need to reset, cull particles too far away, or do some additional processing to handle it.\nSetting this value to 0 will remove this behavior but could introduce rendering & simulation artifacts.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of fx.LWCTileRecache is to control the recaching behavior of Large World Coordinates (LWC) tiles for particle effects (FX) systems in Unreal Engine 5. It determines when the engine needs to recache LWC tiles to avoid rendering and simulation artifacts in particle systems that move across large distances in the game world.
This setting variable is primarily used by the particle system and rendering subsystems within Unreal Engine 5. It is specifically referenced in the Engine module, particularly in the ParticleComponents.cpp file, which is part of the particle system implementation.
The value of this variable is set through the Unreal Engine console variable system. It is initialized with a default value of 2 and can be modified at runtime using console commands or through project settings.
The fx.LWCTileRecache variable interacts directly with its associated C++ variable GFXLWCTileRecache. They share the same value, with GFXLWCTileRecache being the actual variable used in the engine’s C++ code.
Developers must be aware that this variable affects the performance and visual quality of particle systems in large world scenarios. Setting it to 0 will disable the recaching behavior, which can lead to rendering and simulation artifacts for particle systems that move across large distances.
Best practices when using this variable include:
- Keep the default value (2) unless specific issues are encountered.
- Increase the value if artifacts are observed in particle systems that move across large distances.
- Consider the performance impact of frequent recaching when adjusting this value.
- Test thoroughly in large world scenarios to ensure the chosen value provides a good balance between visual quality and performance.
Regarding the associated variable GFXLWCTileRecache:
The purpose of GFXLWCTileRecache is to serve as the C++ representation of the fx.LWCTileRecache console variable within the engine’s code.
This variable is used directly in the particle system implementation, specifically in the UFXSystemComponent class. It determines when a particle system needs to recache its LWC tile based on its movement in the world.
The value of GFXLWCTileRecache is set by the console variable system and is used in the RequiresLWCTileRecache function to calculate whether a recache is necessary.
GFXLWCTileRecache interacts closely with the fx.LWCTileRecache console variable, effectively mirroring its value for use in C++ code.
Developers should be aware that modifying GFXLWCTileRecache directly in C++ code is not recommended, as it may be overwritten by the console variable system. Instead, they should use the fx.LWCTileRecache console variable to adjust this setting.
Best practices for using GFXLWCTileRecache include:
- Avoid modifying it directly in C++ code.
- Use it for read-only purposes in particle system logic.
- Consider its value when implementing custom particle system behavior that involves large world coordinates.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleComponents.cpp:214
Scope: file
Source code excerpt:
float GFXLWCTileRecache = 2;
FAutoConsoleVariableRef CVarFXLWCTileRecache(
TEXT("fx.LWCTileRecache"),
GFXLWCTileRecache,
TEXT("When we cross this number of LWC tiles from where we started the FX we need to recache the LWC tile to avoid artifacts.\n")
TEXT("When this occurs the system may need to reset, cull particles too far away, or do some additional processing to handle it.\n")
TEXT("Setting this value to 0 will remove this behavior but could introduce rendering & simulation artifacts.\n"),
ECVF_Default);
#Associated Variable and Callsites
This variable is associated with another variable named GFXLWCTileRecache
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleComponents.cpp:212
Scope: file
Source code excerpt:
ECVF_ReadOnly);
float GFXLWCTileRecache = 2;
FAutoConsoleVariableRef CVarFXLWCTileRecache(
TEXT("fx.LWCTileRecache"),
GFXLWCTileRecache,
TEXT("When we cross this number of LWC tiles from where we started the FX we need to recache the LWC tile to avoid artifacts.\n")
TEXT("When this occurs the system may need to reset, cull particles too far away, or do some additional processing to handle it.\n")
TEXT("Setting this value to 0 will remove this behavior but could introduce rendering & simulation artifacts.\n"),
ECVF_Default);
static bool GFXSkipZeroDeltaTime = true;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleComponents.cpp:3547
Scope (from outer to inner):
file
function bool UFXSystemComponent::RequiresLWCTileRecache
Source code excerpt:
{
bool bNeedsRecache = false;
const float TileRecache = GFXLWCTileRecache;
if (TileRecache > 0.0f)
{
const FVector3f ActorTile = FLargeWorldRenderScalar::GetTileFor(CurrentLocation);
const float MaxMovement = (CurrentTile - ActorTile).GetAbs().GetMax();
bNeedsRecache = MaxMovement >= TileRecache;
}