p.Chaos.Cache.CompressTracksAfterRecording
p.Chaos.Cache.CompressTracksAfterRecording
#Overview
name: p.Chaos.Cache.CompressTracksAfterRecording
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When enabled, cache will compress the transform tracks after recording is done.[def: true]
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Cache.CompressTracksAfterRecording is to control whether the Chaos Cache system compresses transform tracks after recording is completed. This setting is part of the Chaos physics simulation and caching system in Unreal Engine 5.
This setting variable is primarily used within the ChaosCaching plugin, which is an experimental feature of Unreal Engine 5. The plugin is responsible for caching and replaying physics simulations, which can be useful for optimizing performance and creating deterministic physics-based animations.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be modified at runtime through the console or configuration files. By default, it is set to true.
The associated variable bChaosCacheCompressTracksAfterRecording directly interacts with p.Chaos.Cache.CompressTracksAfterRecording. They share the same value, and bChaosCacheCompressTracksAfterRecording is used in the actual code logic.
Developers must be aware that enabling this variable (which is the default behavior) will cause the Chaos Cache system to compress transform tracks after recording is finished. This compression can help reduce memory usage and potentially improve performance, but it may also introduce some loss of precision in the cached data.
Best practices when using this variable include:
- Consider the trade-off between memory usage and precision. If exact reproduction of physics is critical, you may want to disable this setting.
- Test your physics simulations with both compressed and uncompressed caches to ensure the compression doesn’t negatively impact your game’s visuals or gameplay.
- If you’re experiencing performance issues related to physics caching, experiment with enabling or disabling this setting to see if it helps.
- Be aware that changing this setting may affect the determinism of your physics simulations, especially if you’re relying on exact reproduction across different runs or platforms.
Regarding the associated variable bChaosCacheCompressTracksAfterRecording:
The purpose of bChaosCacheCompressTracksAfterRecording is to provide a direct, code-level boolean flag that controls whether transform tracks are compressed after recording in the Chaos Cache system.
This variable is used within the ChaosCaching plugin, specifically in the UChaosCache class. It directly influences the behavior of the EndRecord function, determining whether the CompressTracks function is called after recording is complete.
The value of bChaosCacheCompressTracksAfterRecording is set by the console variable p.Chaos.Cache.CompressTracksAfterRecording, allowing for runtime configuration.
Developers should be aware that this variable directly controls the compression behavior in the code. If compression is causing issues in your project, you may need to modify this variable’s value through the console or configuration files.
Best practices for using bChaosCacheCompressTracksAfterRecording include:
- Use the console variable p.Chaos.Cache.CompressTracksAfterRecording to modify this setting rather than changing the code directly.
- Be cautious when disabling compression, as it may significantly increase memory usage for physics caches.
- If you’re debugging issues related to physics caching or replay, consider temporarily disabling this flag to rule out compression-related problems.
- Remember that changing this setting may require re-caching your physics simulations to see the effects.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Experimental/ChaosCaching/Source/ChaosCaching/Private/Chaos/ChaosCache.cpp:18
Scope: file
Source code excerpt:
bool bChaosCacheCompressTracksAfterRecording = true;
FAutoConsoleVariableRef CVarChaosCacheCompressTracksAfterRecording(
TEXT("p.Chaos.Cache.CompressTracksAfterRecording"),
bChaosCacheCompressTracksAfterRecording,
TEXT("When enabled, cache will compress the transform tracks after recording is done.[def: true]"));
UChaosCache::UChaosCache()
: CurrentRecordCount(0)
#Associated Variable and Callsites
This variable is associated with another variable named bChaosCacheCompressTracksAfterRecording
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Experimental/ChaosCaching/Source/ChaosCaching/Private/Chaos/ChaosCache.cpp:16
Scope: file
Source code excerpt:
TEXT("When enabled, cache interpolates between keys.[def: true]"));
bool bChaosCacheCompressTracksAfterRecording = true;
FAutoConsoleVariableRef CVarChaosCacheCompressTracksAfterRecording(
TEXT("p.Chaos.Cache.CompressTracksAfterRecording"),
bChaosCacheCompressTracksAfterRecording,
TEXT("When enabled, cache will compress the transform tracks after recording is done.[def: true]"));
UChaosCache::UChaosCache()
: CurrentRecordCount(0)
, CurrentPlaybackCount(0)
#Loc: <Workspace>/Engine/Plugins/Experimental/ChaosCaching/Source/ChaosCaching/Private/Chaos/ChaosCache.cpp:469
Scope (from outer to inner):
file
function void UChaosCache::EndRecord
Source code excerpt:
}
if (bChaosCacheCompressTracksAfterRecording)
{
CompressTracks();
}
}
void UChaosCache::CompressTracks()