Simulation in Computer Graphics Geometric Constraints Matthias Teschner Computer Science Department University of Freiburg
Outline introduction penalty method Lagrange multipliers local constraints University of Freiburg Computer Science Department Computer Graphics - 2
Constraint Dynamics geometric constraints restrict the mass-point movement keep a mass point at a position keep two mass points at a distance keep a mass point on a curve, a surface or in a volume in constraint dynamics, mass points obey Newton's laws and geometric constraints constraint forces explicitly maintain a constraint or implicitly transform accelerations into consistent accelerations University of Freiburg Computer Science Department Computer Graphics - 3
Applications constraint techniques are applied in robotics graphical manipulation keyframe animation collision handling, resting contact articulated rigid bodies University of Freiburg Computer Science Department Computer Graphics - 4
Demos University of Freiburg Computer Science Department Computer Graphics - 5
Global vs. Local Approaches global methods solve for all constraints simultaneously minimization techniques handle conflicting constraints useful for rigid bodies with a small number of degrees of freedom local methods constraints are handled independently efficient restricted to non-conflicting constraints useful for mass-point systems with a large number of degrees of freedom University of Freiburg Computer Science Department Computer Graphics - 6
Classification penalty method global method introduces forces to meet a constraint Lagrange multiplier global method cancel force components that act against a constraint local constraints local method introduce forces to meet a constraint University of Freiburg Computer Science Department Computer Graphics - 7
Outline introduction penalty method Lagrange multipliers local constraints University of Freiburg Computer Science Department Computer Graphics - 8
Principle compute forces from geometric constraints (principle already known from generalized springs) define a constraint that depends on mass point positions iff the constraint is met University of Freiburg Computer Science Department Computer Graphics - 9
Penalty Forces potential energy based on constraint iff the constraint is met iff the constraint is not met force at mass point based on the potential energy University of Freiburg Computer Science Department Computer Graphics - 10
Example 2D pendulum mass point at distance to the origin penalty force corresponds to a spring force keeping at the given distance University of Freiburg Computer Science Department Computer Graphics - 11
Discussion constraints are not accurately met penalty force is induced only if the constraint is not met effect of the penalty force depends on masses, velocities, external forces, and time step which are not considered in the force computation predictor-corrector or implicit schemes improve the accuracy compute a prediction step compute penalty forces based on predicted quantities apply penalty forces to the current time step (corrector step) University of Freiburg Computer Science Department Computer Graphics - 12
Outline introduction penalty method Lagrange multipliers local constraints University of Freiburg Computer Science Department Computer Graphics - 13
Principle instead of applying a penalty force too late, illegal force components are removed force components that act against a constraint are cancelled by the constraint force University of Freiburg Computer Science Department Computer Graphics - 14
Principle if a constraint is met, then in order to meet the constraint in the future, the rate of change of a constraint should be in order to maintain the rate of change of a constraint, the second derivative should be legal position legal velocity legal acceleration compute a constraint force that ensures legal acceleration University of Freiburg Computer Science Department Computer Graphics - 15
Example the usual pendulum (energy function slightly adapted to simplify further computations) if the constraint is met and its time derivative is zero, then a legal acceleration can be ensured by applying a constraint force University of Freiburg Computer Science Department Computer Graphics - 16
Example for the constraint force, we get (one equation, two unknowns in 2D) for all solutions would cancel illegal force components for all solutions has the same direction, but with a varying magnitude additional boundary conditions are required University of Freiburg Computer Science Department Computer Graphics - 17
Example the constraint force should not change the kinetic energy from and follows with being the Lagrange multiplier now, we have three equations for three unknowns University of Freiburg Computer Science Department Computer Graphics - 18
Discussion the constraint force ensures that results in a legal acceleration intending to maintain a legal velocity and a legal position in contrast to the penalty approach, external forces, masses, and velocities are considered, which results in an improved accuracy accuracy can still be improved with implicit or predictor-corrector schemes University of Freiburg Computer Science Department Computer Graphics - 19
Discussion still, the time step of the integration scheme is not considered resulting in so-called numerical drift note, that the constraint is not explicitly preserved if the constraint is not met, the approach does not care therefore, the Lagrange multiplier approach is commonly combined with penalty forces ensures a legal acceleration the constraint is not met at, but the approach assumes that the constraint is met University of Freiburg Computer Science Department Computer Graphics - 20
General Approach and are vectors containing mass point positions and forces, is a diagonal mass matrix, is a vector representing constraints in the initial state and the acceleration is given as this acceleration is set to zero and we get the constraint force University of Freiburg Computer Science Department Computer Graphics - 21
General Approach the constraint forces should not change the kinetic energy is one of our assumptions we get additional equations and unknowns (Lagrange multiplier) we get with being a square matrix University of Freiburg Computer Science Department Computer Graphics - 22
Outline introduction penalty method Lagrange multipliers local constraints University of Freiburg Computer Science Department Computer Graphics - 23
Motivation local constraint approaches are restricted to one constraint per mass point (non-conflicting constraints) since deformable mass-point systems consist of many mass points, these approaches are still quite flexible University of Freiburg Computer Science Department Computer Graphics - 24
Motivation deformable objects larger number of degrees of freedom more than one non-conflicting constraint can be defined per object by distributing the constraints to different mass points allows for versatile constraints non-conflicting constraints can be solved locally efficient: time-consuming iterative schemes are avoided accurate: information on the underlying integration scheme can be employed to improve accuracy University of Freiburg Computer Science Department Computer Graphics - 25
Characteristics local approach for non-conflicting geometric constraints for deforming mass-point systems information on the numerical integration scheme is employed a generic scheme is presented to illustrate the incorporation of a variety of integration schemes very efficient in terms of memory and computing complexity very accurate, no numerical drift or other inaccuracies all constraints are accurately met at each simulation step University of Freiburg Computer Science Department Computer Graphics - 26
Outline local constraints representation of integration schemes constraint forces point-to-nail constraint points-to-point constraint point-to-line, triangle, tetrahedron results University of Freiburg Computer Science Department Computer Graphics - 27
Representation of Numerical Integration Schemes mass point at time with mass, position, velocity, force representation of numerical integration with system matrices state vector University of Freiburg Computer Science Department Computer Graphics - 28
Example - Verlet position and velocity update rewrite velocity update University of Freiburg Computer Science Department Computer Graphics - 29
Example - Verlet state vector system matrices University of Freiburg Computer Science Department Computer Graphics - 30
Outline local constraints representation of integration schemes constraint forces point-to-nail constraint points-to-point constraint point-to-line, triangle, tetrahedron results University of Freiburg Computer Science Department Computer Graphics - 31
Constraint Forces constraint forces are computed to meet a user-defined constraint on a position or velocity by substituting constraint forces are adapted according to the actually employed integration scheme University of Freiburg Computer Science Department Computer Graphics - 32
Outline local constraints representation of integration schemes constraint forces point-to-nail constraint points-to-point constraint point-to-line, triangle, tetrahedron results University of Freiburg Computer Science Department Computer Graphics - 33
Point-to-Nail Constraint constraint that enforces a given position constraint force University of Freiburg Computer Science Department Computer Graphics - 34
Example - Verlet constraint force new position University of Freiburg Computer Science Department Computer Graphics - 35
Outline local constraints representation of integration schemes constraint forces point-to-nail constraint points-to-point constraint point-to-line, triangle, tetrahedron results University of Freiburg Computer Science Department Computer Graphics - 36
Points-to-Point Constraint hold points at a jointed position is not fixed and not user-defined equations are considered to compute unknown constraint forces University of Freiburg Computer Science Department Computer Graphics - 37
Equations first equation: momentum of the mass-point system is preserved equations: all points have the same position in the next time step University of Freiburg Computer Science Department Computer Graphics - 38
Resulting Constraint Forces in case of Verlet constraint forces move all points towards the center of mass of the next simulation step with respect to their position at the next simulation step University of Freiburg Computer Science Department Computer Graphics - 39
Outline local constraints representation of integration schemes constraint forces point-to-nail constraint points-to-point constraint point-to-line, triangle, tetrahedron results University of Freiburg Computer Science Department Computer Graphics - 40
Point-to-Line, Face, Tetrahedron mass point and a corresponding position on a line with on a triangle with in a tetrahedron with in general, is given as with being Barycentric coordinates University of Freiburg Computer Science Department Computer Graphics - 41
Constraint Force constraint force guarantees constraint force constraint force is computed for and the negative of the constraint force is distributed to the University of Freiburg Computer Science Department Computer Graphics - 42
Outline local constraints representation of integration schemes constraint forces point-to-nail constraint points-to-point constraint point-to-line, triangle, tetrahedron results University of Freiburg Computer Science Department Computer Graphics - 43
Performance University of Freiburg Computer Science Department Computer Graphics - 44
Results University of Freiburg Computer Science Department Computer Graphics - 45
Conclusion local constraints for deformable objects numerical integration scheme is employed to efficiently and accurately solve the constraints a generic scheme can incorporate various schemes no iterative solvers, no stabilization techniques no numerical drift, no other inaccuracies restricted to non-conflicting constraints University of Freiburg Computer Science Department Computer Graphics - 46
Summary penalty method introduce forces to meet a constraint handles conflicting constraints efficient and inaccurate or unstable Lagrange multipliers cancel force components that act against a constraint handles conflicting constraints less efficient (linear system) and drift problem local constraints introduce forces to meet a constraint restricted to one constraint per degree of freedom efficient and accurate University of Freiburg Computer Science Department Computer Graphics - 47
References Andrew Witkin, Kurt Fleischer, Alan Barr, "Energy Constraints on Parameterized Models", Proc. ACM SIGGRAPH '87, pp. 225-232, 1987. David Baraff, "Linear-Time Dynamics using Lagrange Multipliers", Proc. ACM SIGGRAPH '96, pp. 137-146, 1996. Andrew Witkin, David Baraff, Michael Kass, "Physically-based modeling", ACM SIGGRAPH '01, Course Notes, 2001. Marc Gissler, Markus Becker, Matthias Teschner, "Local Constraint Methods for Deformable Objects", Eurographics / ACM SIGGRAPH SCA '06, Posters and Demos, 2006. Marc Gissler, Markus Becker, Matthias Teschner, "Local Constraint Methods for Deformable Objects", Proc. VriPhys '06, pp. 25-32, 2006. University of Freiburg Computer Science Department Computer Graphics - 48