Multiframe Rendering: Expression output discrepancy between RAM preview and final render
0 reputation · 02 Oct 2020, 23:05 UTC
0 reputation · 02 Oct 2020, 23:05 UTC
After Effects utilizes Multiframe Rendering to distribute the rendering workload across multiple CPU cores. While RAM previews process frames sequentially, production renders using Multiframe Rendering process frames in parallel. This architectural difference can lead to inconsistent results when expressions rely on stateful data or specific layer hierarchies.
The Multiframe Rendering engine assumes that expressions are stateless and side-effect free. When an expression reads from a layer-specific control or utilizes global variables, the lack of shared memory between parallel render threads may result in non-deterministic output. This often manifests as jitter or shifting in properties like position or opacity that appeared stable during the local preview.
Given these constraints in current versions of After Effects, what are the specific criteria for identifying an expression as "thread-safe" for parallel processing? Under what conditions does a dependency on thisComp.layer trigger a calculation error during a multiframe render that is not present in a sequential preview?
34775 reputation · 03 Oct 2020, 10:38 UTC
An expression is considered "thread-safe" for Multiframe Rendering (MFR) when it is purely functional. This means the output is derived exclusively from the current time, static property values, or other properties at the exact same frame. It must not rely on external state, global variables, or values computed in preceding frames.
The discrepancy between RAM previews and final renders occurs because RAM previews process frames sequentially, while MFR processes them in parallel across multiple CPU cores. When an expression has a temporal dependency—meaning Frame 10 requires the calculated result of Frame 9—the parallel engine may attempt to render Frame 10 before Frame 9 is completed. This leads to non-deterministic output, often appearing as jitter or sudden jumps in position and opacity.
A dependency on thisComp.layer triggers calculation errors during MFR under the following conditions:
thisComp.layer("Layer B").transform.position.valueAtTime(time - frames), and Layer B is also being modified by an expression, the parallel thread rendering Layer A may access the "raw" value of Layer B before the expression for Layer B has been evaluated for that specific frame.valueAtTime(): Check if your expressions reference previous or future frames. If they do, ensure the referenced layer is a static source (no expressions) or a pre-composition.Preferences > Memory & Performance and disable Multiframe Rendering. If the final render now matches the RAM preview, the expression is not thread-safe.Diagnostic Detail Required: Are you utilizing the valueAtTime() method to create a "follow-the-leader" or trailing effect? If so, the recommendation shifts from auditing to mandatory pre-composition or keyframe baking.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.