GeometryCache.InterpolateFrames

GeometryCache.InterpolateFrames

#Overview

name: GeometryCache.InterpolateFrames

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 GeometryCache.InterpolateFrames is to control the interpolation between geometry cache frames in Unreal Engine’s Geometry Cache system. This setting is primarily used for enhancing the visual quality of animated geometry caches by enabling smooth transitions between keyframes.

This setting variable is utilized by the Geometry Cache plugin, which is part of Unreal Engine’s runtime modules. Specifically, it’s used within the GeometryCache subsystem, which handles the playback and rendering of pre-computed geometric animations.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, meaning interpolation is enabled by default. Developers can modify this value at runtime using console commands or through project settings.

The associated variable CVarInterpolateFrames directly interacts with GeometryCache.InterpolateFrames. They share the same value and purpose, with CVarInterpolateFrames being the actual C++ variable used in the code to access the setting.

Developers must be aware that this variable affects rendering performance and visual quality. Enabling interpolation (value set to 1) can result in smoother animations but may have a performance cost, especially for complex geometry caches.

Best practices when using this variable include:

  1. Consider the performance impact when enabling interpolation for complex or numerous geometry caches.
  2. Use it in conjunction with other Geometry Cache settings for optimal results.
  3. Test the visual and performance differences with interpolation enabled and disabled to find the right balance for your project.

Regarding the associated variable CVarInterpolateFrames:

The purpose of CVarInterpolateFrames is to provide a programmatic way to access and modify the GeometryCache.InterpolateFrames setting within the C++ code of Unreal Engine.

This variable is used directly in the Geometry Cache plugin’s rendering code, specifically in the GeometryCacheSceneProxy class, which is responsible for rendering geometry cache objects.

The value of CVarInterpolateFrames is set through the CVar system, mirroring the GeometryCache.InterpolateFrames setting.

It interacts closely with the rendering logic of geometry caches. For example, in the FrameUpdate function of FGeometryCacheSceneProxy, it’s used to determine whether to perform interpolation between frames.

Developers should be aware that changes to CVarInterpolateFrames will directly affect the rendering behavior of all geometry cache instances in the scene.

Best practices for CVarInterpolateFrames include:

  1. Use GetValueOnRenderThread() when accessing its value in render thread code to ensure thread safety.
  2. Consider exposing this setting in user-facing options if fine control over geometry cache rendering is needed in your project.
  3. Profile the performance impact of enabling/disabling this feature in your specific use cases.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/GeometryCache/Source/GeometryCache/Private/GeometryCacheSceneProxy.cpp:36

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarInterpolateFrames(
	TEXT("GeometryCache.InterpolateFrames"),
	1,
	TEXT("Interpolate between geometry cache frames (if topology allows this)."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarRayTracingGeometryCache(
	TEXT("r.RayTracing.Geometry.GeometryCache"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/GeometryCache/Source/GeometryCache/Private/GeometryCacheSceneProxy.cpp:35

Scope: file

Source code excerpt:

	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarInterpolateFrames(
	TEXT("GeometryCache.InterpolateFrames"),
	1,
	TEXT("Interpolate between geometry cache frames (if topology allows this)."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarRayTracingGeometryCache(

#Loc: <Workspace>/Engine/Plugins/Runtime/GeometryCache/Source/GeometryCache/Private/GeometryCacheSceneProxy.cpp:780

Scope (from outer to inner):

file
function     void FGeometryCacheSceneProxy::FrameUpdate

Source code excerpt:


			// Can we interpolate the vertex data?
			if (bCanInterpolate && (bDifferentInterpolationFactor || bFrameIndicesChanged) && !bDecoderError && CVarInterpolateFrames.GetValueOnRenderThread() != 0)
			{
				TRACE_CPUPROFILER_EVENT_SCOPE(FGeometryCacheSceneProxy::FrameUpdate::Interpolate);

				TrackProxy->bNextFrameMeshDataSelected = false;

				SCOPE_CYCLE_COUNTER(STAT_InterpolateFrames);