48

Motivation Movie Game Engineering Introduction Ideally Looks good Fast simulation Looks good? Look plausible Doesn’t need to be exactly

Embed Size (px)

Citation preview

Page 1: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly
Page 2: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Motivation

Movie Game Engineering

Page 3: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Introduction

Ideally Looks good Fast simulation

Looks good? Look plausible Doesn’t need to be exactly correct doesn’t suffer from excessive numerical

dissipation

Page 4: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Overview

Simulation Compressible/Imcompressible Equation Vortex particle method Using octree data structure

Rendering Thick smoke: plain particles Thin smoke: adaptive particles Using Compensated Ray Marching

Page 5: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Compressible Fluids Yngve, G. D., O'Brien, J. F., Hodgins, J. K., 2000,

Animating Explosions. The proceedings of ACM SIGGRAPH 2000, New Orleans, July 23-28, pp. 29-36.

Page 6: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Operator Splitting

Stam used the technique in his Stable Fluids paper, 1999.

Allows us to solve the Navier-Stokes equation in Parts.

As long as each part is stable the technique will be stable.

Page 7: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Semi-Lagrangian Convection

Trace each point p in the field backwards in time. The new velocity at x is therefore the velocity that the particle had a time step ago at the old location.

Page 8: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Smoke Viscous Diffusion

In the simulation of smoke, it is reasonable to consider the fluid inviscid. Therefore this term is zero and need not be solved for.

In fact, the implicit solver that is used will take energy away from the system anyway, so there is a numerical dampening that can look like a non-zero viscosity.

Page 9: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Body Forces

Gravity, user forces, and object interaction.

The visible smoke is from a density field.

Areas of high density fall in the direction of gravity.

Heat moves against gravity (hot air rises).

Page 10: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Incompressibility

At each time step we start with a velocity field that is divergence free. We need this to be true at the end of the time step because the fluid is incompressible.

After solving for convection, and body forces the velocity field is not divergence free.

Page 11: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Incompressibility

Fedkiw, R., Stam, J. and Jensen, H.W.,"Visual Simulation of Smoke",SIGGRAPH 2001, 23-30 (2001).

Page 12: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Incompressible Euler Equations

self-advection Forces

incompressible

(Navier-Stokes without viscosity)

Page 13: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Additional Equations

smoke’sdensity

temperature

We now know all the finite differences we need to add the forces for heat and density…

Page 14: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Vorticity Confinement

The numerical dissipation, and the coarse grid size, cause the fine scale detail of turbulent swirling smoke to vanish.

Identify where the curl is highest, and add back in a rotational force there.

“Vorticity Confinement” force preserves

swirling nature of fluids.

Page 15: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

What is vorticity?

A measure of the local rotation in a fluid flow.

Page 16: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Pressure Boundary Conditions A Neumann boundary condition is a

restriction on the derivative of a function.

Page 17: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Velocity Boundary Condition A Dirichlet boundary condition is a

restriction on the value of a function.

Page 18: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Vorticity Confinement

Page 19: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Vorticity Confinement

Page 20: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Vorticity Confinement

Page 21: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Solving the System

Need to calculate:

Start with initial state

Calculate new velocity fields

New state:

Page 22: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Smoke Simulation

While (simulating) Get external forces (if any) from UI Get density/heat sources (from UI or init

grid cells) Update velocity Update density Update temperature Display density

Page 23: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Smoke Simulation

While (simulating) Get external forces (if any) from UI Get density/heat sources (from UI or init

grid cells) Update velocity Update density Update temperature Display density

Page 24: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Update Velocity

Equation: First term:

Advection Move the fluid through its velocity field

(Du/Dt=0) Second term:

external forces Final term:

pressure update

Page 25: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Update Velocity

Add external forces (fbuoy + forces from UI + fconf)

Advection (semi-lagrangian step – trace particles back)

Pressure update (solve linear system)

Page 26: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Smoke Simulation

While (simulating) Get external forces (if any) from UI Get density/heat sources (from UI or init

grid cells) Update velocity Update density Update temperature Display density

Page 27: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Update density

Equation First term:

Advection Move the temperature through velocity field

Second term: Diffusion

Can skip this term

Second term: external sources

Page 28: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Update density

Add Sources (pick grid cells or from UI)

Advection (semi-lagrangian step – trace particles back)

Diffusion (solve linear system – can skip this step)

Page 29: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Smoke Simulation

While (simulating) Get external forces (if any) from UI Get density/heat sources (from UI or init

grid cells) Update velocity Update density Update temperature Display density

Page 30: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Update temperature

Equation First term:

Advection Move the temperature through velocity

field

Second term: Diffusion

Can skip this term

Page 31: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Update Temperature

Add Sources (grid cells or objects or UI)

Advection (semi-lagrangian step – trace particles back)

Diffusion (solve linear system – can skip this step)

Page 32: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Smoke Simulation

While (simulating) Get external forces (if any) from UI Get density/heat sources (from UI or init

grid cells) Update velocity Update density Update temperature Display density

Page 33: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Display density

Use any approach you want Visualize the density field: just opengl render a bunch of cubes

(corresponding to grid cells) that have alpha values based on how dense the smoke is.

Page 34: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Numerical Dissipation

‘ Stable Fluids’ method dampens the flow Typical with semi- Lagrangian methods

Improve using “Vorticity Confinement” force

Page 35: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Total Forces

User supplied fields

Buoyancy force

New confinement force

Page 36: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Results

Page 37: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Results

Page 38: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Other Methods

Vortex particle method Using octree data structure

Page 39: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Vortex particle method-Lagrangian primitives

Curves carry the vorticity

Each local vortex induces a weighted rotation

dx

xp

xp3

4

)(

ω

v dlxp

xp

3

4

)(

ω

v

Page 40: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Vortex particle method-Lagrangian primitives

Curves carry the vorticity

Each local vortex induces a weighted rotation

Page 41: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Method of simulation

Vortex particles (for motion) organized as curves. = tangent

Smoke particles (for visualisation)

Curves carry vortices Vortices induce a velocity field velocity field deforms curves & smoke

At every step: Advect the curves Stretch Advect the smoke

Page 42: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Method of simulation

Vortex particles (for motion) organized as curves. = tangent

Smoke particles (for visualisation)

Curves carry vortices Vortices induce a velocity field velocity field deforms curves & smoke

At every step: Advect the curves Stretch Advect the smoke

Page 43: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Method of simulation

Vortex particles (for motion) organized as curves. = tangent

Smoke particles (for visualisation)

Curves carry vortices Vortices induce a velocity field velocity field deforms curves & smoke

At every step: Advect the curves Stretch Advect the smoke

Page 44: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Video

Page 45: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Smoke Rendering Thick smoke: plain particles Thin smoke: adaptive particles [AN05]

accumulate stretching

01nTOT JJJJ ... 01nTOT JJJJ ...

Page 46: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Smoke Rendering

Thin smoke behaves like a surface

[ William Brennan ][ William Brennan ]

ee

nn

ll

eJJn 1T eJJn 1T

Page 47: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

Smoke Rendering

Using Compensated Ray Marching

Page 48: Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly

References