Tony Yiding Tian

ButterFlight

Physically plausible butterfly flight, as a Maya plug-in

Maya C++, MEL, Python · Feb – May 2026 · Team of 2

A blue butterfly animated by ButterFlight, landing on a flower

A Maya 2026 C++ plug-in that generates physically plausible butterfly flight, after Chen et al.'s "A Practical Model for Realistic Butterfly Flight Simulation" (ACM Transactions on Graphics, 2022), so VFX artists can fill a scene with butterflies without keyframing them or knowing aerodynamics.

Cecilia Chen and I built it. She wrote the force model and the maneuvering controller; I wrote the wing model, the simulation loop and the keyframe baking, path following, hover, and the cameras that frame from the viewport.

The model

The simulation follows the paper in three modules:

  1. Wing kinematics. Five angles drive a skeleton: thorax pitch; the forewings' flap, feather and sweep; the hindwings' flap; and the abdomen. Each follows θ(t) = A(u)·cos(2π·f(u)·t + φp) + φm, its frequency f and amplitude A sigmoids of the flight speed u, so a faster butterfly beats harder. They're held for a wingbeat and updated at its end, and the abdomen swings 180° out of phase, as a real Monarch's does.
  2. Forces. Each wing is a flat panel under quasi-steady aerodynamics (Ellington, 1984), with lift and drag of ½ρ|V|²A·C(α) and the paper's empirical polynomials for the coefficients over the angle of attack. A curl-noise vortex force from Perlin noise acts on the thorax alone, and gives real flight its erratic wobble.
  3. Maneuvering. Velocity integrates the wing forces, the vortex force, gravity and a preferred acceleration toward a target. Between wingbeats, frequency and amplitude are smoothed over a sliding window of 10 cycles.

Wings and baking

I wrote the wing model, with the paper's Monarch parameters for each of the five angles, and the step that maps them onto the rig: rotations on six joints, mirrored for the right side, written every frame as Maya animation curves along with the body's path. The result is ordinary keyframes. It scrubs on the timeline, renders without the plug-in, and exports to Alembic or FBX through Maya's own dialogs.

Wiring Cecilia's force and maneuvering modules into the loop, I applied each frame's angles before the force step, so the aerodynamics read the wings where they actually are. That also fixed animation that died after the first wingbeat: with the velocity never integrated, the speed sigmoids had collapsed every frequency and amplitude to nothing.

Flying a path

The artist draws a NURBS curve, and the butterfly flies it. The first design steered at a velocity worked out from the curve's length, but the physics' speed clamp and slow velocity blend made every long curve fly at the same speed, and short ones end early. I replaced it with a time-based cursor: a target that slides along the curve at remaining length / (frames × substeps) × speed scale, which the butterfly chases on a spring while the aerodynamics keep their wobble. At a scale of 1 it reaches the end on the last frame, starting from the curve's beginning or from the point nearest the rig. Near the end it can decelerate, and blend the thorax into an exact pose to hand off to a hover.

Hovering

At zero speed there's no lift, gravity pulls, and the vortex force pushes the butterfly off station. Rather than fight the physics with a controller, hover mode skips it: only the wing model runs, with floors on frequency and amplitude, 5 Hz and 40° of flap, so the wings keep beating. They ease down to the floors over about 3 s, which plays as the butterfly settling. Its position and full orientation can be set by hand.

Cameras

Framing a moving butterfly by hand is tedious, so the bake can make the camera too. The artist frames the shot in the viewport, and at simulate time the plug-in captures that camera and keeps its framing through the flight. I added that capture to the follow camera, and a stationary camera that stays where the viewport was and turns to hold the butterfly at the same place on screen: the offset q₀ = camera · lookAt₀⁻¹ is kept, and applied as q₀ · lookAtₜ every frame. Its auto zoom keys the focal length as f₀ · dₜ / d₀, so the butterfly keeps its size as it comes near or flies off.

A blue butterfly flying low over grass past twisted roots
Along a path, from the follow camera
A blue butterfly flying off over a meadow of red flowers, with others beyond
Leaving the rose, from the stationary camera
Frames from the demo. No joint was keyed by hand: only the rig pose, the guide curves and the settings were set.

Swarms and the panel

Any mode can be a swarm: the rig is duplicated into many agents, the leader flies the chosen mode, and the rest flock with it by cohesion, separation and alignment, each running the whole pipeline with its own wingbeat phase and noise. It is all driven from a MEL panel with ten collapsible sections, which passes its settings to one C++ command, bfSimulate.

Maya's viewport with ten butterflies along a guide curve, and the ButterFlight panel docked at the right
A swarm of ten on a guide curve in Maya 2026, with the ButterFlight panel.

GitHub

[email protected] · LinkedIn · GitHub · Resume