Elastic Free Form Deformation

Demo Code to follow

Working with a team-mate, the two of us created a demo that allows the user to apply forces to points on a textured cube, which will react and deform in an elastic and ‘cartoonish’ manner. The project was split into 2 parts - free-form deformation and physics. I was responsible for the physics including the engine, constraints and motion.

The vertices (or control-points) are simulated as simple point masses, linked together with springs to give the elasticity. When the user clicks and drags a control-point it applies another spring-force to that point. Although the body is never considered or simulated as a whole, the spring-forces make the cube acts as one body - the difference being that it is a very stretchy, bouncy body instead of a rigid one that requires rotations to be considered. The linked-point-masses approach automatically handles rotations as a side benefit.
At every update, the spring forces are calculated based on the position of each end-point for each spring. The forces are then applied to each control-point, along with any other forces such as gravity, air resistance etc. The resultant force gives a resultant acceleration applied that point. This gives a new point velocity and from this the new position is calculated. Finally, any wall collisions are detected and resolved.
In order to keep the cube stable, every control-point/vertex is linked to every other vertex with a spring.

Extra acknowledgements: Rendering, deformation & mouse input by Murari Vasudevan

Leave a Reply