610 likes | 762 Views
Bending, Breaking and Squishing Stuff. Marq Singer Red Storm Entertainment marqs@redstorm.com. Synopsis. This is the last lecture of the day, so I’ll try to be nice Stuff that’s cool, but not essential Soft body dynamics Breaking and bending stuff Generating sounds. The Basics.
E N D
Bending, Breaking and Squishing Stuff Marq Singer Red Storm Entertainment marqs@redstorm.com
Synopsis • This is the last lecture of the day, so I’ll try to be nice • Stuff that’s cool, but not essential • Soft body dynamics • Breaking and bending stuff • Generating sounds
The Basics • Constraint – something that keeps an entity in the system from moving freely • For our purposes, we will treat each discreet entity as one particle in a system • Particles can be doors on hinges, bones in a skeleton, points on a piece of cloth, etc.
Box Constraints P 0 100
Box Constraints (cont) • Confine P to extents of the box • Recover from violations in position (last valid, rebound, wrap around) • Simple, yet the basis for the rest of this
Spring Constraints • Seems like a reasonable choice for soft body dynamics (cloth) • In practice, not very useful • Unstable, quickly explodes
Stiff Constraints • A special spring case does work • Ball and Stick/Tinkertoy • Particles stay a fixed distance apart • Basically an infinitely stiff spring • Simple • Not as prone to explode
Cloth Simulation • Use stiff springs • Solving constraints by relaxation • Solve with a linear system
Cloth Simulation • Forces on our cloth
Cloth Simulation • Relaxation is simple • Infinitely rigid springs are stable • Predetermine Ci distance between particles • Apply forces (once per timestep) • Calculate D for two particles • If D != 0, move each particle half the distance • If n = 2, you’re done!
Cloth Simulation • When n > 2, each particle’s movement influenced by multiple particles • Satisfying one constraint can invalidate another • Multiple iterations stabilize system converging to approximate constraints • Forces applied before iterations • Fixed timestep (critical)
More Cloth Simulation • Use less rigid constraints • Vary the constraints in each direction (i.e. horizontal stronger than vertical) • Warp and weft constraints
Still More Cloth Simulation • Sheer Springs
Still More Cloth Simulation • Flex Springs
Using a Linear System • Can sum up forces and constraints • Represent as system of linear equations • Solve using matrix methods
Basic Stuff Systems of linear equations Where: A = matrix of coefficients x = column vector of variables b = column vector of solutions
Basic Stuff • Populating matricies is a bit tricky, see [Boxerman] for a good example Isolating the ith equation:
Jacobi Iteration Solve for xi (assume other entries in x unchanged): (Which is basically what we did a few slides back)
Jacobi Iteration In matrix form: D, -L, -U are subparts of A D = diagonal -L = strictly lower triangular -U = strictly upper triangular
Jacobi Iteration Definition (diagonal, strictly lower, strictly upper): A = D - L - U
Lots More Math(not covered here) • I highly recommend [Shewchuk 1994] • Gauss-Seidel • Successive Over Relaxation (SOR) • Steepest Descent • Conjugate Gradient • Newton’s Method (in some cases) • Hessian • Newton variants (Discreet, Quasi, Truncated)
Dynamic Destruction • Assigning material properties to rigid bodies • Object break, bend, spindle and mutilate uniquely • Similar principle to constrained dynamics
Tools For Destruction • 3D tessellation • Creating constraints • Material properties • Offline processing
3D Tessellation • Uses entire volume of object • Tessellate into tetrahedrons (3D version of creating a triangle mesh)
Creating Constraints • Spring connection between (non-rendered) vertices • Particles displaced within spring limitations return to constrained position • Particles that move further “break” the constraint • Split in center and form two new virtual vertices
Material Properties • Analogous to tensile and compressive strength • Additional properties add a more realistic effect • Strain and strain rate tensors • Elastic and plastic strain components • Penalty methods on forces based on particle depth
Retessellating • Breaking a solid object can result in creation of new surface polygon • Pieces have to be retesselated and retextured • New chunks are also new rigid bodies in the system
Dynamic Destruction • Demos: • Destructo-Bunny • Crash2 Pseudo Interactive, E3 Demo, May 2004
Dynamic Destruction • Reckless destruction of tofu
Squishing Stuff • Dynamic fracture is expensive • Deformation can be cheaper • Only allow squishing • Modal analysis to create component pieces • Nastiest processing can be done offline
Modal Analysis • What the heck is it? • Looks more complicated than it really is • Comes from material science/fatigue analysis • Separates the vibrational characteristics of a material into discreet shapes (modes) • Modes can be combined additively to create complex behavior
Modal Analysis d= vector of positions K=function of elastic forces (e.g. spring-mass) C = takes velocities, returns dampening forces f = vector of external forces on the system (collisions, user input, etc.). M = takes accelerations ( ), returns required forces
Modal Analysis • Assuming small displacements, linearize to:
Modal Analysis – Warning: Crunchy Math Ahead! • A bunch of steps are in the end notes • Complicated • Involves some unfamiliar manipulations • Getting there is hard, but the end result is fairly easy to grasp
Modal Analysis • End result: • Zi is the ith row of our final matrix c1 and c2 are complex constants and w is the complex frequency: • The absolute value of the imaginary part of w is the frequency(rads/s) of the mode. The real part is the rate of decay.
Modal Analysis • All modes for an object can be processed offline and stored in a lookup table • When a forces is applied, look up the modes and their comparative strength • Modes can simply be added to obtain the final displacement of a particle in the system