Notes Time scales � [work out] � For using Pixie (the renderer) make sure � For position dependence, characteristic time you type “use pixie” first interval is � � 1 � Assignment 1 questions? � t = O � � � � K � For velocity dependence, characteristic time � � interval is � t = O 1 � � � � D � Note: matches symplectic Euler stability limits • If you care about resolving these time scales, there � s not much point in going to implicit methods cs533d-term1-2005 1 cs533d-term1-2005 2 Mixed Implicit/Explicit Newmark Methods � A general class of methods � For some problems, that square root can [ ] 2 � t 2 1 � 2 � ( ) a n + 2 � a n + 1 mean velocity limit much stricter x n + 1 = x n + � tv n + 1 [ ] ( ) a n + � a n + 1 v n + 1 = v n + � t 1 � � � Or, we know we want to properly resolve the position-based oscillations, but don � t � Includes Trapezoidal Rule for example care about exact damping rate ( � =1/4, � =1/2) � Go explicit on position, implicit on velocity � The other major member of the family is Central • Often, a(x,v) is linear in v, though nonlinear in Differencing ( � =0, � =1/2) x; this way we avoid Newton iteration • This is mixed Implicit/Explicit cs533d-term1-2005 3 cs533d-term1-2005 4
Central Differencing Central: Performance � Constant acceleration: great � Rewrite it with intermediate velocity: ( ) • 2nd order accurate v n + 12 = v n + 1 2 � ta x n , v n � Position dependence: good x n + 1 = x n + � tv n + 12 • Conditionally stable, no damping ( ) v n + 1 = v n + 12 + 1 2 � ta x n + 1 , v n + 1 � Velocity dependence: good • Stable, but only conditionally monotone � Looks like a hybrid of: � Can we change the Trapezoidal Rule to • Midpoint (for position), and Backward Euler and get unconditional • Trapezoidal Rule (for velocity - split into monotonicity? Forward and Backward Euler half steps) cs533d-term1-2005 5 cs533d-term1-2005 6 Staggered Implicit/Explicit Summary (2nd order) � Like the staggered Symplectic Euler, but use � Depends a lot on the problem • What � s important: gravity, position, velocity? B.E. in velocity instead of F.E.: ( ) � Explicit methods from last class are probably bad v n + 12 = v n � 12 + 1 2 ( t n + 1 � t n � 1 ) a x n , v n + 12 � Symplectic Euler is a great fully explicit method x n + 1 = x n + � tv n + 12 (particularly with staggering) • Switch to implicit velocity step for more stability, if damping time � Constant acceleration: great step limit is the bottleneck � Position dependence: good (conditionally stable, � Implicit Compromise method • Fully stable, nice behaviour no damping) � Velocity dependence: great (unconditionally monotone) cs533d-term1-2005 7 cs533d-term1-2005 8
Example Motions Simple Velocity Fields � Can superimpose (add) to get more complexity � Constants: v(x)=constant � Expansion/contraction: v(x)=k(x-x 0 ) • Maybe make k a function of distance |x-x 0 | ( ) v ( x ) = � � x � x 0 � Rotation: • Maybe scale by a function of distance |x-x 0 | or ( ) � � x � x 0 magnitude cs533d-term1-2005 9 cs533d-term1-2005 10 Noise Example Forces � Common way to perturb fields that are too � Gravity: F gravity =mg (a=g) perfect and clean � If you want to do orbits � Noise (in graphics) = x � x 0 a smooth, non-periodic field with clear length- F gravity = � GmM 0 scale x � x 0 3 � Read Perlin, “Improving Noise”, SIGGRAPH � 02 • Hash grid points into an array of random slopes that � Note x 0 could be a fixed point (e.g. the Sun) or define a cubic Hermite spline another particle � Can also use a Fourier construction • But make sure to add the opposite and equal force to • Band limited signal • Better, more control, but (possibly much) more the other particle if so! expensive • FFT - check out www.fftw.org for one good implementation cs533d-term1-2005 11 cs533d-term1-2005 12
Drag Forces Spring Forces � Air drag: F drag =-Dv � Springs: F spring =-K(x-x 0 ) • If there � s a wind blowing with velocity v w then • x 0 is the attachment point of the spring F drag =-D(v-v w ) • Could be a fixed point in the scene � D should be a function of the cross-section • …or somewhere on a character � s body exposed to wind • …or the mouse cursor • Think paper, leaves, different sized objects, • …or another particle (but please add equal … and oppposite force!) � Depends in a difficult way on shape too • Hack away! cs533d-term1-2005 13 cs533d-term1-2005 14 Nonzero Rest Length Spring Spring Damping � Need to measure the “strain”: � Simple damping: F damp =-D(v-v 0 ) the fraction the spring has stretched from • But this damps rotation too! its rest length L � Better spring damping: F damp =-D(v-v 0 )•u/L u • Here u is (x-x 0 )/|x-x 0 |, the spring direction � � F spring = � K x � x 0 � x � x 0 � [work out 1d case] � 1 � x � x 0 � � � Critical damping: fastest damping possible L • For individual springs, gives a good typical damping force you can multiply by a factor cs533d-term1-2005 15 cs533d-term1-2005 16
Collision and Contact Collision and Contact � We can integrate particles forward in time, have some ideas for velocity or force fields � But what do we do when a particle hits an object? � No simple answer, depends on problem as always � General breakdown: • Interference vs. collision detection • What sort of collision response: (in)elastic, friction • Robustness: do we allow particles to actually be inside an object? cs533d-term1-2005 17 cs533d-term1-2005 18 Interference vs. Collision Repulsion Forces � Interference (=penetration) � Simplest idea (conceptually) • Simply detect if particle has ended up inside object, • Add a force repelling particles from objects when they push it out if so get close (or when they penetrate) v � t < 1 • Works fine if [w=object width] 2 w • Then just integrate: business as usual • Otherwise could miss interaction, or push dramatically • Related to penalty method: the wrong way instead of directly enforcing constraint (particles stay outside of objects), add forces to encourage • The ground, thick objects and slow particles constraint � Collision � For the ground: • Check if particle trajectory intersects object • F repulsion =-Ky when y<0 [think about gravity!] • Can be more complicated, especially if object is • …or -K(y-y0)-Dv when y<y0 [still not robust] moving too… • …or K(1/y-1/y0)-Dv when y<y0 � For now, let � s stick with the ground (y=0) cs533d-term1-2005 19 cs533d-term1-2005 20
Repulsion forces Collision and Contact � Difficult to tune: � Collision is when a particle hits an object • Too large extent: visible artifact • Instantaneous change of velocity • Too small extent: particles jump straight through, not (discontinuous) robust (or time step restriction) � Contact is when particle stays on object • Too strong: stiff time step restriction, or have to go surface for positive time with implicit method - but Newton will not converge if we guess past a singular repulsion force • Velocity is continuous • Too weak: won � t stop particles • Force is only discontinuous at start � Rule-of-thumb: don � t use them unless they really are part of physics • Magnetic field, aerodynamic effects, … cs533d-term1-2005 21 cs533d-term1-2005 22 Frictionless Collision Response � At point of contact, find normal n • For ground, n=(0,1,0) � Decompose velocity into • normal component v N =(v•n)n and • tangential component v T =v-v N after = � � v N [ ] � � 0,1 before , � Normal response: v N • � =0 is fully inelastic • � =1 is elastic � Tangential response after = v T before v T • Frictionless: � Then reassemble velocity v=v N +v T cs533d-term1-2005 23
Recommend
More recommend