2D Mesh Deformation: How Meshes Make Flat Art Bend and Squash
What 2D mesh deformation is, how vertices, weights and bones bend images and vectors, and when to use meshes instead of simple rotation in characters and UI.
Core Takeaway
Mesh deformation places a grid of points (vertices) over a piece of 2D art and moves those points to bend, squash or stretch the art. Vertices can be animated directly or bound to bones with weights, so a single bone can curve a sleeve or a cheek smoothly. It gives flat artwork a sense of volume that rotation and scaling alone cannot.
How a mesh works
The tool triangulates the image or shape into a mesh. When you move a vertex, the triangles around it stretch and the art inside them follows. More vertices give finer control but more work for the animator and the renderer. Spine's documentation describes meshes as a way to deform images and to reduce the area of transparent pixels drawn.
Weights and bones
Animating every vertex by hand is slow. Instead, bind vertices to bones and paint weights: a vertex near the elbow might follow the upper arm 50 percent and the forearm 50 percent, so the joint bends smoothly instead of breaking.
- Place extra vertices where the art bends: joints, mouth corners, cloth folds
- Use smooth weight gradients across joints
- Keep vertices sparse in areas that stay rigid
When to use meshes
Use meshes for faces turning slightly, breathing chests, soft cloth, tails, hair and squash-and-stretch on mascots. For mechanical parts, icons and most UI, rotation, scale and path animation are simpler and cheaper.
Performance
Each deformed vertex is calculated every frame, so dense meshes on many characters add up, especially on phones. Use the fewest vertices that give a clean bend, and test the heaviest scene on a mid-range device.
Building this in ExodeUI
ExodeUI, which we make, has bones, weight painting, and skinning on paths and meshes, with an IK constraint for limbs. Rigs sit next to state machines and spring physics, so a character's squash, stretch and reactions can be driven by your app's inputs at runtime.
Key Principles to Remember
- Meshes bend art by moving vertices
- Bind vertices to bones with weights for smooth joints
- Add vertices where art bends, keep rigid areas sparse
- Dense meshes cost CPU; test on phones
Frequently Asked Questions
Sources
- Meshes — Spine user guide (Esoteric Software)
- Twelve basic principles of animation — Wikipedia