본문으로 건너뛰기
CHOI HONGSU
1 min read

Animation Compression Tool

 

A Unity editor tool that automatically reduces AnimationClip asset size via RDP compression that converts Stream curves to Constant + missing-binding cleanup

Problem

Character AnimationClip assets are excessively large.

  • Curves whose values never actually change are also stored as Stream (keyframe-based), which is wasteful
  • Bone/component-path bindings that vanished when the character rig changed remain in the clips
  • Manually optimizing hundreds of clips is not realistic

Constraints

  • Animation quality must not change after compression — if tolerance is exceeded, keep the original automatically
  • Previously, converting to Linear Tangent caused animations to stutter visibly

Implementation

  1. 01

    1. RDP keyframe compression

    Convert Stream → Constant for curves with no variation or with deltas inside the tolerance.
    After compression, validate the actual curve error and automatically retain the original when tolerance is exceeded.

    • Unify on SetEditorCurve instead of clip.SetCurve() → prevents YAML format duplication (fixes a bug where the previous approach actually increased size)
    • Tangent: LinearClampedAuto — resolves the prior stutter issue and allows a more generous error tolerance
    • Expanded the Weighted-mode removal scope to all non-Rotation curves
  2. 02

    2. Missing-binding cleanup

    Automatically detect and remove bindings whose bone/component paths no longer exist in the prefab.

    • Auto-locate prefabs via the Animation/Prefab/ folder mapping
    • Handles all curves including Rotation, plus ObjectReference curves (Sprite swap, etc.)
    • Built-in safety check for mixing different character folders — must run per Cookie (per character folder) to behave correctly
  3. 03

    3. Safety-first design

    • Risky options like Scale removal and missing-binding cleanup are OFF by default
    • "Test Run" button — preview results before actually applying
    • Settings are auto-persisted via EditorPrefs (survives window close)

Conclusion

Results

Single clip (CH_MelonSoda_A001_Emotion_Happy_01)

BeforeAfterReduction
File size468.3 KB290.9 KB−37.9%
Stream curves257206−51
Constant curves263314+51

Batch (CH_MelonSoda 50 clips)

Value
Clips processed50
Keyframes565,028 → 231,918 (−333,110)
Bindings26,891
Removed bindings7,839

Before / After

Before / After compression

 

Default (0.0005) compression Before / After

BEFORE
Before
AFTER
After

Tradeoffs & Future Work

Tradeoffs

  • Missing-binding cleanup must be run per character folder — running across mixed character folders can cause false positives
  • The default tolerance (0.0005) suits most characters, but special motions need a separate check

Future Work

  • A shared editor tool for all characters — a self-service structure the animation team uses directly
애니메이션 압축 · Cookie Run: Oven Smash · Choi Hongsu · Hongsu