Interactive Physically-Based Simulation
-
Upload
hakeem-ingram -
Category
Documents
-
view
64 -
download
0
description
Transcript of Interactive Physically-Based Simulation
Interactive Physically-Based Simulation
John KeyserDepartment of Computer Science and Engineering
Texas A&M University
First, a Little Background
• What do we mean by Physically-based Modeling/Simulation?
• Why do we do this?• What is its role in graphics?
Physically-Based ModelingPhysically-Based Simulation
• Modeling, then simulating processes– Based on physical principles
Physically-Based ModelingPhysically-Based Simulation
• Modeling, then simulating processes– Based on physical principles
• Basic idea: come up with a model describing how the environment works
gt
x
2
2
Physically-Based ModelingPhysically-Based Simulation
• Modeling, then simulating processes– Based on physical principles
• Basic idea: come up with a model describing how the environment works– Give an initial state
gt
x
2
2
Physically-Based ModelingPhysically-Based Simulation
• Modeling, then simulating processes– Based on physical principles
• Basic idea: come up with a model describing how the environment works– Give an initial state– Using those equations/relationships/etc.
we simulate the results
gt
x
2
2
Physically-Based ModelingPhysically-Based Simulation
• Modeling, then simulating processes– Based on physical principles
• Basic idea: come up with a model describing how the environment works– Give an initial state– Using those equations/relationships/etc.
we simulate the results• The model does not have to be
real/complete!– But, we usually assume the physical
principles are those governing the phenomenon we are modeling
gt
x
2
2
Simulating the Real World
• Motivation behind many early computer applications– Solving equations from science/engineering
• Physically Based Modeling/Simulation remains a topic of continued study, on its own– Scientific Computing/Computational Science
Why is PBM Part of Graphics?
• Many parts of graphics aim to replicate/simulate the real world, virtually.– Rendering: light interaction and sensing– Modeling: describing real-world geometry– Animation: behavior
• Goal is to create a visually plausible result– Sometimes, but not always, want “correct”
result
Graphics Applications
• Offline– Movies– Some (limited) science/engineering studies
• Interactive– Games– Training Simulators– Scripting Control
Halo3: Bungie Studios
Star Wars Episode III,LucasFilm
Simulation in Offline Graphics
• We can create very good results!– Witness almost any movie
• Still plenty of areas to work on– Some still require a lot of user
interaction/tuning– Some methods are unstable– Some “higher order” effects aren’t handled– Capturing real-world behavior– etc.
How is Interactive Simulation Different?
• Rate of simulation – Orders of magnitude difference from offline– Many offline methods are infeasible
• The user can control/adjust what happens– Feedback loop– We want the user to be able to direct the
simulation
What is Interactive?
• Action-response cycle• Frequency needed depends on application
– Control: .1 to 1 Hz– Smooth video: > 15 to 60 Hz– Force feedback: ~ 1000 Hz
• Real-time: same rate as in real world– Not always necessary, desirable, or achievable
What is Control?
• Letting the user specify the behavior of the simulation– Many ways to do this
• Control can give a range of “realism”
Goals of My Work
• Improving Interactive Simulation– Developing methods that capture phenomena at
interactive rates– Providing user control over simulation behavior
• These still affect offline simulation– Good interactive models can still be used offline– Control often applied to offline simulation
Physically Based:
Modeling• Set of defining equations
Simulation• Method for predicting
future state from current
Improving Performance
Modeling• Ignoring terms/effects• Limiting domain• Proxy objects• Statistical model• Phenomenological Model
Simulation• Larger time steps• More computing power• Parallelism• Hybridization• Multiresolution methods• Level of Detail• Alternative Formulations
Six Examples• Burning Objects
– Simplified Physical Model, Proxy Objects• Plant Motion
– Simulation Level of Detail• Waves
– Domain Limitation, Identifying Global Effect• Rigid Bodies
– Statistical Simulation• Piled Objects
– Phenomenological Model, Simulation Control• Smoke Simulation
– Simulation ControlConclusion
Interactions of Water and Objects
• Want to simulate the behavior of water and the objects interacting with water
Wave Simulation
• 3D fluid simulations are expensive• However, in most applications, the 3D fluid
motion is not needed.– Only the behavior at the surface is important
• So, simulate waves, instead– Far simpler equation– 2D instead of 3D
Wave Particles
• Typical approach: discretize the domain– Solve equations on grid
• Instead, represent the form of the solution• Represent the solution using particles
– Represent a local solution to the wave equation
– Behavior ensures global solution • Only under certain conditions
– Simulate independently
Wave Particles
• Waveform function– C1 and non-zero in a finite range– Easy to create wave trains– Can approximate shapes with larger
wavelengths– Suitable for circular motion
• Radial Definition
– If the distance between wave particles < ri / 2• Maximum error on wave crest < 0.1%• Maximum error on wave shape < 3%
Wave Particles
Wave Particles
• Wave particles– Collectively represent wavefronts– DO NOT interact– Move independently– Subdivide independently
• Into smaller wave particles• Die when too small
Wave Particles
• Circular motion is important for– Realistic wave shapes– Realistic object interaction– Realistic wave superposition
Summary
• Simplified model of the phenomenon– Waves, not fluid
• The model supports speedups in simulation– Particles act independently, thus can simulate
in parallel
• Return
Fire Simulation• Fire is very complex process – not fully
understood– Multiple fluids mixing: fuel, air, exhaust– Chemical processes– Pressure changes due to heat
• We create a simplified fire model– Single fluid– Simple processes to model combustion, fuel release– Ignore pressure terms directly; instead introduce
buoyancy force
3-Gases, Single Fluid• One motion field is used to advect fuel gas and smoke• Two scalar density fields are used to model fuel and
smoke. For every cell, the unused part is filled with oxygen.
• One scalar field is used to model temperature distribution• Same solver is applied with different parameters for
advection of fuel gas, smoke and temperature.
Fuel gas and smoke
Temperature distribution around the flame
Three Gas Model: Combustion
)( agA ddDd dA : Air density
dg : Fuel gas density
da : Exhaust gas density
gA bddrC ,min
CTt
To
b
C
t
dg
bC
t
da 11
if T>Tthreshold
b: Stoichiometric mixture
r: Burning rate, 0<r1
(burning fuel percentage per second)
T0: Heat output
Example: Fire Simulation
• Result: interactive fire simulator– Can simulate fire, flame, process interactively– Also includes object interaction/burning
• Resulting simulation method significantly simpler than prior approaches.
Simplified/Separated Object Representations
• In complex simulations, representing objects can be difficult– Different simulations want object in different form– Using one model makes simulation more complicated– Using multiple models means lengthy conversions, and
synchronization• Proposed a multi-representation object format
– Use multiple representations of objects– Treat each independently– Functions allow asynchronous update/interaction
between different representations
Burning Objects
• In fire simulation, objects play many roles– Occupy space: influence airflow– Fuel source: releasing heat– Change shape in response to fuel loss– Move around according to dynamics– Rendered for visualization
Multi-Representation Objects
• Different object representations– Level set for object structure– Polygonal model for display– Voxelized model for fuel availability– Voxelized model in fluid domain
Multi-Object Representation• Fuel release from voxel grid:
– Influences level set representation– Different representations allows ash formation
• Level set can be used to update voxel grid for fluid calculations
• Level set can be used to update polygonal model for display
• Polygonal model can be used for rigid body simulation (collision detection)
Deformation by Proxy• Some objects deform as they burn• Modeling physics is too complex• We form a “proxy” object around
the object that will deform– Map simulation parameters onto
proxy– Modify proxy in response to
simulation– Creates a free-form deformation of
underlying object– Achieve net result by simulating on
simpler object
Summary
• Simple combustion model captures burning behavior
• Simplified model of the burning objects– Multiple representations capture different
effects– Proxy object captures primary effect without
low-level model
• Return
Level-of-Detail Approaches
• If the simulation takes place out of view, we only need the final state when it’s in view
• If the simulation is less visible (e.g. farther away), we don’t need it to be as accurate
• So, for things far away/less visible/necessary for accuracy, we’ll use a simplified representation.
Simulation Level of Detail
• Use less complicated simulation technique when possible– Keep track of key information when objects are
out of sight– Simplify/combine when simulated object is
farther away• Discrete or Continuous• Transitions are important
Plant Motion in Wind
• Simulate motion of plants, trees in response to wind/external forces– Forces generated at leaves– Propagate back to branches, affecting other
leaves/branches– Branches give damping force
Method Overview
Stage I: Precompute1. Generate lookup tables describing motion2. Create tree structure from L-system3. At each parent store simplified branches of the child4. Compute error and store distance at a given threshold
Stage II: Runtime5. Walk through tree and evaluate equations of motion6. At each branch, if stored distance < actual distance
continue with the simplified branch7. Smoothly transition between levels of detail
(simulation only)
Parent/Child Combination
• Remove middle “vertex”• Calculate new bend strength and area• Match amplitude and period
* leaf area directly affects force
Original bend strength 1
Original bend strength 2
Original leaf area
Final bend strength
Final area
Child/Child Combinations
• Combine vertices (can be > 2)• Average leaf area• Find new bend strength to minimize error
Final bend strength
Final area
Original bend strengths
Original areas
Runtime
• At runtime, determine the distance to the viewer– Decide on which simulation LOD to use
• If the necessary LOD is different from previous, must account for transition
• Note: Simulation LOD is not necessarily same as geometric LOD.
Stage II: Runtime
Smoothly transition:• Rendering structures don’t align during simulation• Need to reduce “popping”
wind
Precomputed meshfixed distance
separation
Stage II: Runtime
Smoothly transition:• Force branches apart • Try to maintain relative positions and velocities
wind
Gradually force branches apart
Summary
• LOD approach allows adaptation to the timing needs of the simulation
• Good measures for when it is OK to switch LODs– Or, how much error is introduced by switch.
• Return
Rigid Body Simulation
• Plausible visualization of rigid body dynamics.
Sony TV Commercial Nintendo Wii Sport Disney Pixar ‧ Toy Story 3
Handle Collisions in Rigid Body Simulation
• Collision Detection• Collision Determination• Collision Response
Why Speed Up Rigid Body Simulation?
• Currently, rigid body simulation is pretty fast.• But, it can still take up a significant part of the
computation budget.– Large numbers of objects– Real-time 3D worlds
• Explore whether statistical response is a good way to speed up discontinuous simulations.
Previous Work
• Simplified Simulation
Simulation Level of Detail for real-time animation.Carlson & Hodgins, ‘97
Simulation Level of Detail (SLOD) Model Reduction
Model reduction for real-time fluids.Treuille, Lewis, & Popovi´c , ‘06
Previous Work
• Simplified collision + dynamically update.
BD-Tree: Output-Sensitive Collision Detection for Reduced Deformable Models.James & Pai, ‘04
Bounded Deformation-Tree
Fast Collision Detection between Massive Models usingDynamic Simplification.Yoon, Salomon, Lin, & Manocha, ‘04
Dynamically simplify the collision model
Previous Work
• Data Driven animations/simulations
Retargetting Motion to New Characters.Gleicher ‘98
Mesh Ensemble Motion Graphs:Data-driven Mesh Animation with Constraints.James & et al. ‘05
Motion Retargeting Data-driven Mesh Animation
Our idea
• Record & Reuse.• Record statistical features at collision.• Reuse the features to mimic the behavior.• Save computation to boost performance.Precompute
Our idea
• Record & Reuse.• Record statistical features at collision.• Reuse the features to mimic the behavior.• Save computation to boost performance.Simulation
How to Collect Features?• Run scenarios.
– In one scenario, we drop one rigid body to one plane.
• Collect features at first collision.
How to Collect Features?• We sample a series of scenarios to cover most
possible simulation cases.– E.g. Different directions of initial velocity.
How to Collect Features?
• Run each scenario several times with different initial orientation.
Statistical feature tables
μ : mean valueσ : standard deviation
Goal• Replace the most expensive part of a
simulation with a statistically-derived response.• Use a single sphere as the collision model.
• The size of the sphere?• Collision response?
?
Feature 1: Collision Height• Distance from center of mass to the plane at collision.
• Use the ratio of |Ω-|/|V-| to sample scenarios.• Perform scenarios, record collision heights, and save it.
• Query radius by |Ω-|/|V-|.• Update the radius every time step.
Ω -V- radius = H
Simulation
Precompute
Collision Response?
• Now, we can use a sphere as collision model.
• But, we miss the contact points…– Bad collision response.
• To make it respond like the original object, we need response data.
?
Feature 2: Response velocities• Used to replace collision response at simulation time.
• Sample in 2D, but reuse in 3D.• Sampling is controlled by four parameters.
Precompute
Feature 2: Response velocities
• Treat the target as a rigid object and a particle respectively.
• Store and .
Ω-V-
𝑉𝑅𝑖𝑔𝑖𝑑+ 𝑉𝑃𝑎𝑟𝑡𝑖𝑐𝑙𝑒+ 𝛺𝑅𝑖𝑔𝑖𝑑+
𝑉𝑅𝑒𝑙𝑎𝑡𝑖𝑣𝑒+
𝛺𝑅𝑖𝑔𝑖𝑑+ 𝑉𝑅𝑒𝑙𝑎𝑡𝑖𝑣𝑒+
Precompute
Feature 2: Response velocities• Compute correspondent indices to retrieve the
μ and σ of response data.• Build a Gaussian distribution based on μ and σ.• Generate random response data based on the
distribution.
μ & σ 𝛺𝑅𝑖𝑔𝑖𝑑+
𝑉𝑅𝑒𝑙𝑎𝑡𝑖𝑣𝑒+
Simulation
Feature 2: Response velocities
• Response velocity in simulation time– = + – =
• Object-Object?– Treat as two object-plane
collisions.
𝑉+ 𝛺+
𝑉𝑃𝑎𝑟𝑡𝑖𝑐𝑙𝑒+ 𝑉𝑅𝑒𝑙𝑎𝑡𝑖𝑣𝑒+ 𝛺𝑅𝑖𝑔𝑖𝑑+
Ω -V-
𝑉𝑅𝑖𝑔𝑖𝑑+ 𝑉𝑃𝑎𝑟𝑡𝑖𝑐𝑙𝑒+ 𝛺𝑅𝑖𝑔𝑖𝑑+
𝑉𝑅𝑒𝑙𝑎𝑡𝑖𝑣𝑒+
Simulation
Feature 3: Resting Configuration• Collecting most common resting
configurations.– Resting height– Resting normal
Precompute
Feature 3: Resting Configuration
• Only apply resting control when– sufficiently low momentum.– close to the ground.
• Determine the nearest resting configuration.– Smallest rotation angle from current
configuration.• Gradually add torque and modify radius to
approach the resting configuration.
Simulation
Performance Comparison
Impulse
2503 Vertices4698 Faces
Swift++Sweep & Prune
Impulse (low-res)
99 Vertices194 Faces
Swift++Sweep & Prune
Impulse (7-sphere)
7 Spheres
Sphere-Sphere CD Sweep & Prune
Statistical
1 Sphere
Sphere-Sphere CD Sweep & Prune
Performance Comparison
Impulse Low-Res 7-Sphere Statistical
100.00%
26.31%11.05%
2.54%
10 bunnies
Impulse Low-Res 7-Sphere Statistical
100.00%
20.79%3.37% 1.21%
100 bunnies
Impulse Low-Res 7-Sphere Statistical
100.00%
8.79%1.00% 0.75%
1,000 bunnies
7-Sphere Statistical
100.00%
64.08%
10,000 bunnies
Time per frame in %The shorter, the faster.
Limitations
• 6-8 hours precomputation for a single object.
• Object-object interaction is approximated by object-plane data.– Some artifacts
• Only limited performance improvement over 7-spheres case.
Piles of Objects
• Interesting phenomena!
http://www.flickr.com/photos/wainwrighthttp://www.flickr.com/photos/hypermodern/By Hope Shen
Simulating Piles of Objects• Rigid body simulation.• Model contact.• Model friction.
• One of the most time-consuming and difficult parts of rigid body simulation
• Frictional contact force computation NP-Hard
• Previous approaches focus on details:– friction– stability– speed
• We want to look at the bigger picture:– How can we control the shape of piles?– Can we improve the speed, too?
What else can we do?
Types of Stacking Piles
Random Piles Structured Piles
http://www.flickr.com/photos/marcwathieu/ http://www.flickr.com/photos/chachlate/
Types of Stacking Piles
Random Piles Structured Piles
http://www.flickr.com/photos/marcwathieu/ http://www.flickr.com/photos/chachlate/
Angle of Repose
• Maximal stable slope of a random pile.
http://www.geology.um.maine.edu/geodynamics/
Goal
• Generate piles.• Specify the shape by angle of repose.• Consider the max stable slope when a pile is growing.
– soft constraint
• Base on a physically-based simulator.– Small-scale behavior is realistic
• With a Phenomenological simulation control:– Simulate the piling phenomenon itself– Captures the larger-scale behavior plausibly
Phenomenological Simulation Control
• Spatial data structure– Guide the pile growth
• Heuristic-based algorithm– Strategically make objects “sleep” or “wake”
Ideas behind our pile modeling
• Spatial data structure:– conical shape.– layered.– density information.
• Stopped objects:– contribute to the volume of the shape.– Increase performance.
Piling Structure
α
h
r
• Given– Number of objects– Volume per object– Angle of repose
• We know the radius and height of an ideal pile.
Num: N Vol: v
tan
33rvN
Piling Structure
• Cut the structure to k layers.– Track density
information– No object span more
than 2 layers– A cone Cylinders
D: Bounding box diagonal
h
riα
Piling Structure
• Cut the structure to k layers.– Track density
information– No object span more
than 2 layers– A cone Cylinders
D: Bounding box diagonal
hriα
Track the Density
• Precompute the initial pile structures.• Track the density of each layer every frame.
– ci= vi / vobj (Capacity of each layer)– mi (Number of object in layer i)– ρi = mi / ci
hriα
During Simulation
• Keep track of density of each layer– Grow if layers get too full– If a more full layer is above a less-full one,
wake objects so they can avalanche
• Put objects to “sleep” as we don’t need to simulate them– Saves computation time– Provides artificial “structure” to the pile
Performance
• Provide a speedup– Ranged from 1.6x to 6x in our experiments vs.
no sleeping.– More limited (but still some speedup) vs. trivial
sleeping.
Summary
• Provide control over simulation– Get a desired angle of repose, without having
to determine and simulate full friction
• Return
Fluid Simulation Challenges
• Time-consuming (hours) at high resolution• Difficult to control/predict due to high
dimensionality and nonlinearity• Resolution of the simulation affects the
behavior– Numerical dissipation– Typical incompressibility enforcement
• Small errors build up into larger changes
Fluid Simulation
Initialize in low-res
Result in low-res
feedback
Initialize in high-res
Result in high-res
Different
Fluid Simulation
Initialize in low-res
Result in low-res
feedback
Initialize in high-res
Result in high-res
Our method
Previous Work
• Control of fluid systems– Foster N., Metaxas D.
Controlling Fluid Animation. CGI 1997
Previous Work
• Control of fluid systems– Foster N., Metaxas D.
Controlling Fluid Animation. CGI 1997– Foster N., Fedkiw R.
Practical Animation Of Liquids. SIGGRAPH 2001
Previous Work
• Control of fluid systems– Foster N., Metaxas D.
Controlling Fluid Animation. CGI 1997– Foster N., Fedkiw R.
Practical Animation Of Liquids. SIGGRAPH 2001
• Particle based control of simulations– Thürey N., Keiser R., Pauly M., Rüde U.
Detail-preserving Fluid Control. SCA 2006
Previous Work
• Keyframe matching
Treuille A., McNamara A., Popovic Z., Stam J.Keyframe Control of Smoke Simulation. SIGGRAPH 2003
McNamara A., Treuille A., Popovic Z., Stam J.Fluid Control Using The Adjoint Method. SIGGRAPH 2004
Previous Work
• Keyframe matching
Fattal R., Lischinski D.Target-driven Smoke Animation. SIGGRAPH 2004
Previous Work
• Turbulence
Kim T., Thürey N., James D., Gross M.Wavelet Turbulence For Fluid Simulation. SIGGRAPH 2008
Schechter H., Bridson R.Evolving Sub-grid Turbulence For Smoke Animation. SCA 2008
Previous Work
• Variational Methods
Nielsen M. B., Christensen B. B., Zafar N. B., Roble D., Museth K.Guiding Of Smoke Animations Through Variational Coupling Of Simulations At Different Resolutions. SCA 2009
Nielsen M. B., Christiansen B. B.Improved Variational Guiding Of Smoke Animations. Eurographics 2010
Our Method
Keyframe Sample
Error
Low-Res Preview High-Res Simulation
Sample at Match point
vv
Determining Amount of
Control
v v
Control Weight
)(' vvmvv
Our Method
Keyframe Sample
Error
Low-Res Preview High-Res Simulation
Sample at Match point
Apply Control
Determining Amount of
Control
v v
• At a match point, we sample the simulation using a Gaussian
Sampling Simulation Data
2
),( xxrir
iexxG
• At a match point, we sample the simulation using a Gaussian– scalar property
Sampling Simulation Data
2
),( xxrir
iexxG
)(),(1
xdxxGG
dx
irr
i
• At a match point, we sample the simulation using a Gaussian– scalar property
– vector property‒ Magnitude & Direction‒ Angular Momentum
Sampling Simulation Data
)(),(1
xdxxGG
dx
irr
i
2
),( xxrir
iexxG
),( id
Keyframe Storage
Keyframe Sample
Low-Res Preview High-Res Simulation
Sample at Match point
),( id),( rx
m
i
i
v v
Matching in High Resolution
)( iiii ddm
Determining Amount of Control
Keyframe Sample
Error
Low-Res Preview High-Res Simulation
Sample at Match point
v v
Matching in High Resolution
),( i
Keyframe Sample
Error
Low-Res Preview High-Res Simulation
Sample at Match point
Apply Control
Determining Amount of
Control
v v
Matching in High Resolution
Keyframe Sample
Error
Low-Res Preview High-Res Simulation
Sample at Match point
Apply Control
Determining Amount of
Control
How?
v v
),( i
Matching in High Resolution
),( i
Keyframe Sample
Error
Low-Res Preview High-Res Simulation
Sample at Match point
Apply Control
v v
Determining Amount of
Control
Matching in High Resolution
),( i
Keyframe Sample
Error
Low-Res Preview High-Res Simulationv
Determining Amount of
Control
x ir
irir xxG
xxGxxG
2)),((
),(),('
),(' xxG iri
Spatial Blending Function
Amount of increase at cell x
Matching in High Resolution
),( i
Keyframe Sample
Error
Low-Res Preview High-Res Simulation
v
Determining Amount of
Control
irG
x ir
irir xxG
xxGxxG
2)),((
),(),('
Matching in High Resolution
),( i
Keyframe Sample
Error
Low-Res Preview High-Res Simulation
Sample at Match point
Apply Control
v v
Determining Amount of
Control
Matching in High Resolution
Keyframe Sample
Error
Low-Res Preview High-Res Simulation
Sample at Match point
Apply Control
v v
Determining Amount of
Control
),( i
Matching in High Resolution
Keyframe Sample
Error
Low-Res Preview High-Res Simulation
Sample at Match point
Apply Control
Determining Amount of
Control
v v
),( i
Matching in High Resolution
Keyframe Sample
Error
Low-Res Preview High-Res Simulation
Sample at Match point
Apply Control
Determining Amount of
Control
Iterate until Converge
v v
),( i
• Guaranteeing convergence
Matching in High Resolution
0...
...0
...0
321
22321
11312
nnn
n
n
www
www
www
W
• Guaranteeing convergence
Matching in High Resolution
0...
...0
...0
321
22321
11312
nnn
n
n
www
www
www
W
How much every two Gaussian kernels overlap
• Guaranteeing convergence
Matching in High Resolution
0...
...0
...0
321
22321
11312
nnn
n
n
www
www
www
W
How much every two Gaussian kernels overlap
The matching converges
Spectral Radius
Summary
• Simple integration to control high-res by low-res
• Gives the user a real chance to interact with the simulation– Still follows most simulation rules
• Still room for improvement– Give user more control options
• Return
Many Other Simulations
• Cloud Formation• Particle-Based Effect Transfer• Adaptive Resolution Incompressible Fluids
Summary
• There are lots of interesting remaining problems in interactive simulation– We still have a long way to go
• Addressing this challenge will require a variety of approaches
• Although many of the approaches were set up specifically for one problem, the concepts do generalize
Questions?
• Thanks for listening!• Funding (NSF)• Students: Cem Yuksel, Zeki Melek, Jacob
Beaudoin, Shu-Wei Hsu, Ruoguan Huang• Contact:
– John Keyser– [email protected]– http://faculty.cs.tamu.edu/keyser