Cloth Collisions/Contact Challenges • • Cloth is thin Critical part of real-world clothing sims is collision – Not too many simple flags / curtains / table cloths in movies! – Once you have a penetration, it’s very obvious • This part of the course is concerned with making collisions – Simulation might not be able to recover 1) good-looking, 2) robust, and • Cloth is flexible and needs many DOF 3) fast in that order – Dozens or hundreds of triangles, in many layers, • References: can be involved simultaneously in collision area – Provot, GI’97 • Cloth simulations are stressful – Bridson, Fedkiw, & Anderson, SIGGRAPH’02 – If something can break, it will… – Bridson, Marino, & Fedkiw, SCA’03 Outline of Solution • Separation from internal dynamics • Repulsion forces Separation from internal dynamics – Well-conditioned, smooth, efficient for most situations • Geometric collisions – Robust for high-velocity impacts • Impact zones – Robust and scalable for highly constrained situations
Separation Example • Simplify life by separating internal forces (stretching, • Start of timestep, x 0 (saved for collisions) bending) from collision forces • Assume black-box internal dynamics: collision module is given 1) x 0 at start of collision timestep, and 2) x 1 candidate state at end and then returns 3) x new collision-free positions • Time integrator responsible for incorporating this back into simulation Example Example • Take one or more internal dynamics steps • And get to x 1 , candidate positions at end of (ignoring collisions) collision step
Example Example • Looking at motion x 0 to x 1 , collision module • Time integrator takes x new and incorporates resolves collisions to get x new collision impulses into velocity, continues on Algorithm Notes • Collisions are synchronized, fixed time step is fine • For n=0, 1, 2, … • For n=0, 1, 2, … • Cruder algorithm shown in [BFA’02] – (x, v) = advance_internal_dynamics(x n , v n , dt) – (x, v) = advance_internal_dynamics(x n , v n , dt) • If elastic collisions are needed, add extra collision step using – x n+1 = solve_collisions(x n , x) – x n+1 = solve_collisions(x n , x) initial velocities v n – see Guendelman, Bridson, Fedkiw, SIGGRAPH’03 – dv = (x n+1 - x)/dt – dv = (x n+1 - x)/dt • Solve_collisions() only needs x 0 and x 1 : – Optional: – Optional: velocity is the difference v=(x 1 -x 0 ) when needed smooth dv with damping dynamics smooth dv with damping dynamics • Assuming linear velocity dependence in velocity smoothing e.g. dv = dv raw + dt M -1 F damp (x n+1 , dv) e.g. dv = dv raw + dt M -1 F damp (x n+1 , dv) step – v n+1 = v+dv – v n+1 = v+dv • Rest of talk: what to do in solve_collisions()
Repulsions • Look at old (collision-free) positions x 0 • If the cloth is too close to itself or something else, Repulsion Based Forces apply force to separate it • Use these for modeling: – Cloth thickness (how close are repulsions active) – Cloth compressibility (how strong are they) • Do not rely on them to stop all collisions – Extending influence and/or making them stiffer detracts from look of cloth, slows down simulation, … Proximity Detection Point-Triangle Proximity • Solve for barycentric • Two ways triangle meshes can be close: coordinates of closest point x 0 x 1 – Point close to triangle on plane of triangle – Edge close to edge � � 2 x 13 i x 23 � � � x 13 i x 03 � x 13 a � = � � � � � � � • In both cases we will want to know � � � � x 23 i x 03 2 b � x 13 i x 23 � x 23 ax 1 +bx 2 +cx 3 x 3 barycentric coordinates of closest points c = 1 � a � b x 2 • If a barycentric coordinate is negative, skip this pair (edge-edge will pick it up)
Edge-Edge Proximity Proximity Acceleration • Solve for barycentric • Put triangles in bounding volumes, only check x 1 coordinates of closest points elements if bounding volumes are close ax 0 +(1-a)x 1 on infinite lines x 3 • Organize bounding volumes for efficient culling x 0 � � • Background grid works fine if triangles similar sizes 2 x 01 i x 32 � � � x 01 i x 31 � x 01 a bx 2 +(1-b)x 3 � = � � � � � � � � � � � – Check each element against others in its grid cell or nearby x 32 i x 31 2 b � x 01 i x 32 � x 32 cells (within cloth thickness) x 2 • Bounding volume hierarchies useful too • Clamp to finite segments - one – Prune checks between distant BV’s and their children that moved furthest is correct, project onto other line and clamp again for other point BV Hierarchy Algorithm Computing Each Repulsion • Direction of repulsion n: • Put pair of root nodes on stack direction between closest points • While stack not empty: – In degenerate cases can use triangle normal or – Pop the top pair of BV’s normalized edge cross-product – If they are close or overlapping: • Several choices for repulsion: if leaves: check mesh elements – Damped spring between closest points, tries to pull else: push all pairs of children onto the stack them to cloth thickness apart – Kinematic result: move closest points some fraction of the way to cloth thickness apart
Finding the Impulse Friction • Example: point-triangle • Relative velocity: v=(x 0 1 -x 0 0 )-a(x 1 1 -x 1 0 )-b(x 2 1 -x 2 0 )-c(x 3 1 -x 3 0 ) – Want to move closest points apart by distance d • Tangential velocity: v T =v-(v•n)n – Assume impulse distributed to corners of triangle by new = x 1 � a 1 barycentric weights: x 1 m 1 In • Static: v T new =0 as long as |F T | < µ F N new = x 0 + new = x 2 � b 1 1 x 0 m 0 In x 2 m 2 In • Kinetic: If v T new � 0 then apply force |F T | = µ F N new = x 3 � c 1 x 3 m 3 In • Integrate forces in time: F � � v – Then solve for impulse: (scripted nodes have � mass) • Combine into one formula: new � ax 1 new � bx 2 new � cx 3 � � new ) � ( x 0 � ax 1 � bx 2 � cx 3 ) � i n = d ( x 0 � � � new = max 0,1 � µ � v N � � v T � v T + a 2 + b 2 + c 2 � 1 � I = d � � � v T � � m 0 m 1 m 2 m 3 Robustness Problem • Repulsions only test for proximity at one time • Fast moving cloth can collide in the middle of the Robust Geometric Collisions time step, and repulsions won’t see it • Even if repulsions catch a fast collision, they may not resolve it • End result: cloth goes through itself or objects – Once on the wrong side, repulsions will actively keep it there – Untangling is dodgy for self-intersections (but see Baraff et al, SIGGRAPH’03)
Collision Detection Defining the Cubic • Not interference (“do the meshes intersect?”), • Assume x i (t) = x i + t v i (with 0 � t � 1) but true collision detection • Coplanar when tetrahedral volume of (“do the trajectories hit at any intermediate time?”) (x 0 ,x 1 ,x 2 ,x 3 ) is zero, i.e. when • Again: meshes can collide in two ways [ ] = 0 x 1 ( t ) � x 0 ( t ), x 1 ( t ) � x 0 ( t ), x 1 ( t ) � x 0 ( t ) – Point hits triangle, edge hits edge • Approach (Provot’97): • Reduces to a cubic in t: – Assume constant velocity of nodes through timestep ] t 3 + ( ) t 2 [ [ ] + v 10 , x 20 , v 30 [ ] + v 10 , v 20 , x 30 [ ] v 10 , v 20 , v 30 x 10 , v 20 , v 30 – Solve for times when nodes coplanar (cubic in t) ( ) t + x 10 , x 20 , x 30 [ ] + x 10 , v 20 , x 30 [ ] + v 10 , x 20 , x 30 [ ] [ ] = 0 + – Check proximity (some tolerance) at possible collision times x 10 , x 20 , v 30 Solving the Cubic Acceleration • We can’t afford to miss any collisions: • Extend bounding volumes to include entire have to deal with floating-point error trajectory of triangle – Closed form solution not so useful • Then acceleration is exactly the same as for • Take a root-finding approach: proximity detection – Solve derivative (quadratic) for critical points – Find subintervals of [0,1] where there could be roots – Find roots in each subinterval with a sign change using secant method – If cubic evaluates close enough to zero at any point (e.g. subinterval boundaries), count as a root -- even with no sign change
Collision Impulse Iteration • Use the normal of the triangle, or normalized • Each time we collide a pair, we modify their cross-product of the edges, at collision time end-of-step positions • Inelastic collisions assumed: • This changes trajectories of coupled want relative normal velocity to be zero elements: could cause new collisions afterwards • So generate the list of potentially colliding • Solve for impulse exactly as with repulsions pairs, process them one at a time updating x new as we go • Friction (tangential velocity modification) also • Then generate a new list -- keep iterating works exactly the same way 1) Scalability Problem 2) Modeling Problem • Resolving one pair of colliding elements can • Chainmail friction: wrinkles stick too much cause a coupled pair to collide – Triangles behave like rigid plates, must be rotated to slide over each other, – Resolving that can cause the first to collide again takes too much torque • Resolving the first ones again can cause others to collide – And so on… • Easy to find constrained situations which require an arbitrary number of iterations
Recommend
More recommend