Impulse-based Simulation of Rigid Bodies -or“A hit, a very palpable hit.” Following the paper by Brian Mirtich and John Canny.

Download Report

Transcript Impulse-based Simulation of Rigid Bodies -or“A hit, a very palpable hit.” Following the paper by Brian Mirtich and John Canny.

Impulse-based Simulation
of Rigid Bodies
-or“A hit, a very palpable hit.”
Following the paper by
Brian Mirtich and John Canny
MOTIVATION
We’ve seen how constraint-based systems simulate
the dynamics of non-penetrating rigid bodies.
Is that the only game in town?
11/7/2015
2
What are some arguments against constraint based
simulations?




Constraints change as the simulation proceeds
Constraints may become quite complicated, and may
be difficult to update/track over time
When there are multiple models for applying
constraints (e.g.: rolling contact), which do you
choose?
Impacts generally produce impulse forces, not
constraint forces
11/7/2015
3
So what do we do?
One answer: impulse-based systems.
11/7/2015
4
INTRODUCTION
(What is an impulse-based system?)



It involves no explicit constraints on
the objects.
Everything it does, it does via
impulses, i.e.: via the application of
impulse forces at locations of collision
between objects.
When objects are not colliding, they
are in ballistic trajectories.
11/7/2015
5
How does this address the problems found in
constraint-based systems?



We’ve simplified things drastically.
Instead of having to worry about many various
changing constraints, we throw all that out the
window to focus on doing one thing very well:
collisions (and their resultant impulses).
ALL modes of contact are handled via impulses:
resting, sliding, rolling, or collisions.
11/7/2015
6
COLLISIONS, COLLISIONS,
COLLISIONS (PART 1)
That sounds like there's going to
be a lot of collisions, eh?
 Yup.
Is that a problem?
 No, not if you're clever about it.
11/7/2015
7
The heart of the system used in Mirtich and
Canny's implentation is the Lin-Canny closest
features algorithm.
Why choose this algorithm? Essentially because it
doesn't just report collisions, but provides the
distance between objects.
11/7/2015
8
Since everything in our model is following a
ballistic trajectory between collisions, we can
place a lower bound on when each object in the
simulation will hit another object:


The linear acceleration is just bounded by
gravity
The angular acceleration is bounded by the
current angular velocity and the mass matrix of
the object
11/7/2015
9
Further Reduction: Bounding boxes
Creation of bounding boxes is in linear time (and occurs once
for each frame), the intersection of the boxes can be
computed in O(n(1+logR)) time, where R is the ratio of
largest to smallest box size.
11/7/2015
10
COLLISIONS, COLLISIONS,
COLLISIONS (PART 2)
Okay, so we've streamlined our collision
detection, and we get a collision
reported once the distance between
objects drops below some threshold
epsilon.
What happens when we've detected a
collision?
11/7/2015
11
Assumptions for collisions :
11/7/2015

Infinitesimal collision time

Poisson's Hypothesis

Coulomb friction model
12
Assumption 1 : Infinitesimal collision time
A collision is a single moment during simulation,
but it is not evaluated in a single “step”.
11/7/2015
13
Assumption 2 : Poisson's Hypothesis
For a collision between two objects, let ptotal be the
magnitude of the normal component of the impulse
imparted by one object onto the other over the entire
collision. Let pmc be the magnitude of the normal
component of the impulse imparted by one object
onto the other up to the point of maximum
compression. Then
Ptotal = (1 + e)pmc
Where e is a constant between zero and one, dependent
on the objects’ materials, and called the coefficient of
restitution.
11/7/2015
14
Assumption 3 : Coulomb friction model
At a particular point during a collision between bodies 1
and 2, let u be the contact velocity of body 1 relative
to body2, let ut be the tangential component of u, and
let ût be a unit vector in the direction of ut. Let fn
and ft be the normal and tangential component of
force exerted by body 2 on body 1, respectively. Then
ut ≠ 0 →
ut = 0 →
ft = -μ║fn║ ût
║ft║ < μ║fn║
where μ is the coefficient of friction.
11/7/2015
15
Collision Analysis
m = mass
J = mass matrix
v = linear velocity of
center of mass
w = angular velocity
u = absolute velocity of
contact point
r = contact point position
relative to c.o.m.
p = impulse imparted by
body 2 on body 1
11/7/2015
16
Collision Analysis
Contact velocities are:
ui = vi + wi x ri
Relative contact velocity is
u = u1 – u2
Examine z component of
u. If negative, the
objects are colliding.
11/7/2015
17
Collision Analysis
We will need to choose
what parameter we’ll
integrate over during
the course of the
collision.
This parameter will start at
zero and continuously
increase over the course
of the collision until it
reaches some final
value.
What do we choose?
11/7/2015
18
Collision Analysis
Let’s choose our parameter (call it ψ) to be the normal
component of the impulse delivered to body 1. Then ψ
will be zero at the moment of collision and increase
during the entire course of the collision.
Furthermore, we can determine that the change in relative
contact point velocity is given by:
Δu(ψ) = u(ψ) – u(0) = M p(ψ)
where M is a 3 by 3 matrix dependent only upon the
masses and mass matrices of the colliding bodies, and
the location of the contact point relative to their centers
of mass. (I’ll refer you to the paper for the details.)
11/7/2015
19
Collision Analysis
We have:
Δu(ψ) = u(ψ) – u(0) = M p(ψ)
Now, by Assumption 1, M is constant over the entire
collision, so we get:
u’(ψ) = M p’(ψ)
11/7/2015
20
Sliding Mode
While the tangential component of u is non-zero, the
bodies are sliding relative to each other and p’ is
completely constrained.
We get a big payoff from choosing our parameter as we did:
With some additional work, we can express p’ in terms of
u, and thus u’ in terms of u:
11/7/2015
21
Sliding Mode
So, big picture, what’s the point?
We can integrate with respect to ψ (i.e. pz, our collision
parameter), and track u (relative contact velocity) over the
course of the collision.
Moreover, since Δu(ψ) = M p(ψ), we can track p(ψ).
11/7/2015
22
Sliding Mode
So here’s our computation of contact, whenever sliding is
taking place:
 Compute initial u (and verify uz is negative)
 Numerically integrate u
 During this integration uz will increase. When it reaches
zero, we can figure out when our integration will stop.
(Why?)
 We proceed until that point, and spit out our final
impulse force.
11/7/2015
23
Sticking Mode
What happens if the tangential velocity vanishes?
The objects are temporarily stuck together.
How do we determine if they "stay stuck" or
continue sliding?
Use our knowledge that u’(ψ) = M p’(ψ)
11/7/2015
24
Continuous Contact
Does all of this take care of continuous contact
situations? Not quite...
The solution is to make one more check if the
contact velocity lies below some threshold. If
friction can exactly reverse the contact velocity,
it does, producing in essence a constraint force
that does no work. If friction cannot, the usual
impulse computation is computed.
11/7/2015
25
RESULTS
Okay, so I get the idea of impulse-based dynamics.
But does the crazy thing work?
11/7/2015
26
Block Decelerating Down Ramp (due to friction)
Block velocity
11/7/2015
Block position
27
Block Accelerating Down Ramp (in spite of friction)
Block velocity
11/7/2015
Block position
28
Pool break: Virtual Time- 3.0 seconds
11/7/2015
Real Time- 95 seconds
29
Chain of Balls: Virtual Time- 2.5 seconds
11/7/2015
Real Time- 7.3 seconds
30
Coins: Virtual Time- 3.6 seconds
11/7/2015
Real Time- 50 seconds
31
Bowling: Virtual Time- 5.0 seconds
11/7/2015
Real Time- 167 seconds
32
Ball on Platter: Virtual Time- 40 seconds
11/7/2015
Real Time- 129 seconds
33
Balls in Dish: Virtual Time- 7.8 seconds
11/7/2015
Real Time- 95 seconds
34
11/7/2015
35
SUMMARY
What do we want from a dymanic simulation of
rigid bodies?


physical accuracy
computational efficiency
11/7/2015
36
How does impulse-based simulation fare?

achieves results that correspond very closely to
physical experiment and theory

achieves near real-time speed ... also, highly
parallelizable since each collision is computed
based solely on local information
11/7/2015
37
So should I always use an impulse-based system?

Short answer: no.
11/7/2015
38
Well why the heck not?

Sometimes certain situations are most easily
expressed as constraints (eg: hinges).

You can combine constraint based and impulse
based to get the best of both worlds .
11/7/2015
39
Online References



http://www.cs.berkeley.edu/~jfc/mirtich/impulse.html
Brian Mirtich and John Canny, ``Impulse-based
Simulation of Rigid Bodies,'' in Proceedings of 1995
Symposium on Interactive 3D Graphics, April 1995.
Brian Mirtich and John Canny, ``Impulse-based
Dynamic Simulation,'' in Proceedings of Workshop on
Algorithmic Foundations of Robotics, February 1994.
11/7/2015
40