// Management · RimWorld Mod

Facial Animation Performance Patch

Same faces, a fraction of the cost.

Same faces, a fraction of the cost.

Facial Animation redraws every animated pawn from scratch every frame and spends most of that time on work that changes nothing on screen. This patch rewrites those code paths with identical results: identical faces, identical timing, identical addon behavior. Measured with ninety pawns on screen, the whole facial animation pipeline costs under one millisecond per frame.

What it fixes:

- The render cache comes back. Facial Animation switches off RimWorld's pawn render cache for every pawn that could ever have a face, including corpses and pawns you disabled in its own settings. Now only pawns whose faces are actually drawn and animating pay for live rendering.
- No more per frame busywork. The animation filter used to rerun a chain of allocating queries every frame for every pawn. It now recomputes only when the pawn's job, mood, pain or thoughts change.
- Invisible layers stop drawing. Hidden face layers were submitted to the GPU as fully transparent quads, up to eighteen per pawn while facing away. Those draw calls are gone, and the result is pixel identical.
- Facing away costs nothing. A standing pawn seen from behind shows no face at all, so those pawns now use cached rendering. Turning back resumes animation instantly.
- No spawn hitch. Animation tables are built the first time a pawn performs a job instead of for every job in the game at spawn.
- Faster shared checks. Component lookups and the per layer invisibility check are cached with exact vanilla semantics, so AI reactions and psychic invisibility behave to the tick.

Settings: everything above is on by default and pixel identical, with individual kill switches. One optional extra, off by default: allow cached rendering when zoomed far out. Faces pause at a distance where they are a few pixels tall, and colonist bar portraits keep animating regardless.

Compatibility: works with Facial Animation Experimentals, race animation addons (HAR races, Wolfein, Kiiro, Yuran, Varan, RimRaces and friends), texture packs, EyeGenes2 and NL Facial Animation Load Fix. Addons need no changes, every def and API is consumed identically.

Safe by design: if a future Facial Animation update changes its internals, this patch notices at startup, removes itself completely and restores Facial Animation's own code. The failure mode is losing the speedup, never broken faces. The settings page shows whether it is active.

Load order: Harmony, then Facial Animation and its addons, then this patch. Requires Harmony and Facial Animation - WIP.