533D: Animation Physics
Transcript of 533D: Animation Physics
![Page 1: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/1.jpg)
Fluid Simulation
1
[Chentanez 11][Thürey 10] [Pfaff 10]
![Page 2: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/2.jpg)
Computational Fluid Dynamics
3
![Page 3: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/3.jpg)
Graphics
Why don’t we just take existing models from CFD for Computer Graphics applications?
4
![Page 4: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/4.jpg)
Graphics
Performance
5
Accuracy
Where’s my water? Disney
Why don’t we just take existing models from CFD for Computer Graphics applications?
![Page 5: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/5.jpg)
Graphics
6
Visual result Control
Why don’t we just take existing models from CFD for Computer Graphics applications?
![Page 6: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/6.jpg)
7
“It’s a common misconception that visual effects are about simulating reality. They’re not. Reality is boring. Visual effects are about simulating something dramatic,”
- Jonathan Cohen, Rhythm&Hues
Graphics
Why don’t we just take existing models from CFD for Computer Graphics applications?
![Page 7: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/7.jpg)
Films
The Abyss, 89
Fluid effects were animated manually, e.g. digitally painting
![Page 8: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/8.jpg)
Films
Antz, 98
First film with fluid simulation
-> very time consuming
![Page 9: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/9.jpg)
Films
Pirates of the Caribbean 3, 07
Control was key: manipulate
physics to meet creative goals
![Page 10: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/10.jpg)
Films
The Day After Tomorrow, 04
Foam, mist, more animator control
![Page 11: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/11.jpg)
Controlling fluid sims is an
active area of research
12
![Page 12: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/12.jpg)
Fluids in production
“We used a variety of
tools and tricks to
control the simulated
water”
![Page 13: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/13.jpg)
Fluids in production
Scanline
Scanline VFX: 2012
![Page 14: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/14.jpg)
Fluids in games
Real-time, stability
• Dimension reduction
![Page 15: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/15.jpg)
Fluids in games
Real-time, stability
16
Portal 2
• Dimension reduction
![Page 16: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/16.jpg)
Films vs Video Games
Offline Stanford Lighthouse
17
[Losasso 08]
[Chentanez 11]
Real-time NVIDIA Lighthouse
![Page 17: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/17.jpg)
Spatial Discretization
Langrangian viewpoint Eulerian viewpoint
- Particles represent the fluid, carry quantities
- Fluid motion by moving particles
- Fixed spatial locations
- Measure quantities as it flows past
You are in the balloon floating along with
the wind, measuring the pressure,
temperature, humidity etc of the air that’s
flowing alongside you
You are stuck on the ground, measuring
the pressure, temperature, humidity etc of
the air that’s flowing past
doing a
weather
report
![Page 18: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/18.jpg)
Notation Reminder
Nabla operator:
20
- Gradient (scalar -> vector):
- Divergence (vector -> scalar):
• Laplace operator (scalar->scalar):
![Page 19: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/19.jpg)
Visual Vector Calculus
21
![Page 20: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/20.jpg)
Navier-Stokes Equations
2 differential equations describing velocity field over time
Conservation of momentum:
Conservation of mass:
22
F=ma
u = velocityp = pressure
= densityg = gravity
= viscosity
![Page 21: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/21.jpg)
Derivation of Momentum Equation
Imagine single blob of fluid p:
23
m = massV = volumeu = velocity
• Start with Newton’s second law:
• Rewrite as:
![Page 22: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/22.jpg)
What Forces Act on p?
Gravity:
Pressure:- Consider nearby fluid
- Force: negative gradient-> towards largest pressure decrease / low pressure areas
Compute with:
24
![Page 23: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/23.jpg)
• Diffusion
- Laplacian
- Strength: dynamic viscosity coefficient
- Compute with:
What Forces Act on p? (2)
Viscosity- “Internal friction”
- More accurately: diffusion of (relative)
velocities
25
![Page 24: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/24.jpg)
Viscous Material
26
Losasso et al., Multiple Interacting Liquids, Siggraph 06
![Page 25: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/25.jpg)
• Diffusion
- Laplacian
- Strength: dynamic viscosity coefficient
- Compute with:
What Forces Act on p? (2)
Viscosity- “Internal friction”
- More accurately: diffusion of velocities
27
Note: Particle systems always need viscosity to stabilize system
![Page 26: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/26.jpg)
Total Forces on p
28
Forces so far.
Divide by mass
Newton’s 2nd law
(2)
(1)
(3)
(4)
(5)Rearrange, using kinematic viscosity
![Page 27: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/27.jpg)
Material Derivative
Change of a quantity q(t,x) during motion:
29
expanded through multivariate chain rule
use grad, velocity
correcting for how much of that change is due just to differences in the fluid flowing past (inflow / outflow at x)(temperature is changing because hot air is being replaced by cold air)
2
how fast q is changing at fixed point in space x(temperature is decreasing because of cooling-down)
1
• We have fluid moving in a velocity field u, possessing some scalar quantity q(t,x)
material derivative
total derivative of q with respect to time
![Page 28: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/28.jpg)
Navier-Stokes Equations
30
how fast q is changing at
fixed point in space x
(temperature is decreasing
because of cooling-down)
inflow / outflow at x
(temperature is changing
because hot air is being
replaced by cold air) 2
1
Note: This term not needed for particle-based fluids
Momentum equation:
Mass conservation equation:
![Page 29: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/29.jpg)
Very small volume change in water: 10m: ≈ 200kPa → 0.0045%4000m: ≈ 40‘000kPa → 1.8%
33
• Small effect on how fluids move at macroscopic level → Water is treated as incompressible
• Incompressibility
Mass Conservation
![Page 30: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/30.jpg)
Mass Conservation
34
• Divergence-free:
“what goes in somewhere, must go out somewhere else”
Per unit volume:
+1
+2
+4
-7
![Page 31: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/31.jpg)
Spatial Discretization: grid-
based methods
Grid discretization- Cubical cells
- Pressure and velocity defined at center
38
p(i,j)
u(i,j)
![Page 32: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/32.jpg)
Staggered grid (MAC grid)- Cubical cells
- Pressure defined at center
- Velocity componentsdefined on faces of cells
39
p(i,j)
v(i,j-1/2)
u(i-1/2,j)
v(i,j+1/2)
u(i+1/2,j)
+ Staggering more stable, second order accurate
- Evaluate velocity at any point through interpolation
Spatial Discretization: grid-
based methods
![Page 33: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/33.jpg)
How do we evaluate gradient, divergence, laplacians, etc on a grid?
Finite difference method (FDM)
40
p(i,j)
u(i,j)
Spatial Discretization: grid-
based methods
![Page 34: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/34.jpg)
41
Example: Grid Laplacian
),(),(),(2
2
2
2
yxuy
yxux
yxu
Discretizing on a grid with cell size h:
2
,1,1,,1,1
,
4
h
uuuuuu
jijijijiji
ji
![Page 35: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/35.jpg)
Computation Order
42
Advection Body Force DiffusionPressure Solve
Requires systems of linear equations to be solved at every
time step
![Page 36: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/36.jpg)
Further Reading
Bridson et al., Fluid Simulation Course, Siggraph Course Notes 2006/2007 http://www.cs.ubc.ca/~rbridson/fluidsimulation/
Cline et al., Fluid Flow for the Rest of Us: Tutorial of the Marker and Cell Method in Computer Graphicshttp://people.sc.fsu.edu/~jburkardt/pdf/fluid_flow_for_the_rest_of_us.pdf
43
![Page 37: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/37.jpg)
72
Smoothed Particle Hydrodynamics (SPH)
Spatial Discretization: particle-
based methods
![Page 38: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/38.jpg)
Particle Fluids
![Page 39: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/39.jpg)
Resolution - 40K vs 4M
![Page 40: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/40.jpg)
30M - Opaque Surface
![Page 41: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/41.jpg)
Simple Particle System
mi
vi fi
xi
emitter
-> Smoothed Particle Hydrodynamics (SPH): With particle-particle interaction based on NS eqs
• Without particle-particle interaction - Simple and fast- Fuzzy objects like fire, clouds, smoke
• Particles generated by emitters, deleted when lifetime is exceeded
• Forces -> velocities -> positions
![Page 42: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/42.jpg)
SPH Simulations in Films
Lord of the Rings 3
Superman Returns
![Page 43: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/43.jpg)
SPH Simulations in Games
81
Alice: Madness Returns
Epic Mickey
Portal 2
![Page 44: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/44.jpg)
Spatial Discretization
Eulerian viewpoint
84
- Particles represent the fluid, carry quantities
- Fluid motion by moving particles
- Fixed spatial locations
- Measure quantities as it flows past
Langrangian viewpoint
![Page 45: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/45.jpg)
Spatial Discretization
Eulerian viewpoint
Neighbor search
Advection
Splashes, droplets
Smooth surfaces
Parameters
Langrangian viewpoint
Pros and Cons
![Page 46: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/46.jpg)
Particles - Observations
89
Advection Body Force DiffusionPressure Solve
No advection needed
Viscosity always needed
Neighborhood size 30-40, dynamically changing!
One linear equation / particle
Many SPH solvers do not explicitly enforce incompressibility
![Page 47: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/47.jpg)
NS in the Lagrangian Viewpoint
90
// Multiply by density
Force densities f (F/V)
// a=F/m
// rho*a=F/V
SPH Literature in Graphics:- [Müller03] Particle-Based Fluid Simulation for Interactive Applications- [Bridson / Müller07] Fluid Simulation Course Notes, Siggraph 2007- [Ihmsen13] State of the art report, SPH Fluids in Computer Graphics
![Page 48: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/48.jpg)
Computation Order
91
Diffusion / VPressure Force / V
Body Force / V
Neighbor Search
Density, Pressure
Computed all at once
![Page 49: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/49.jpg)
Required reading for next class
Smoothed Particle Hydrodynamics“Particle-Based Fluid Simulation for Interactive Applications”, Muller et al., 2003
Position-based Fluids“Position Based Fluids”, Macklin & Muller, 2014
92
![Page 50: 533D: Animation Physics](https://reader031.fdocuments.us/reader031/viewer/2022013015/61d049df87fc7d63946e82b8/html5/thumbnails/50.jpg)
Reminder
Project Ideas
• Send me brief description by next Tuesday (1 para) Team info, topic, etc.
93