500 likes | 618 Vues
Smoke Simulation. Motivation. Movie Game Engineering. Introduction. Ideally Looks good Fast simulation Looks good ? Look plausible Doesn’t need to be exactly correct doesn’t suffer from excessive numerical dissipation. Overview. Simulation Compressible/Imcompressible Equation
E N D
Motivation • Movie • Game • Engineering
Introduction • Ideally • Looks good • Fast simulation • Looks good? • Look plausible • Doesn’t need to be exactly correct • doesn’t suffer from excessive numerical dissipation
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
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.
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.
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.
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.
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).
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.
Incompressibility • Fedkiw, R., Stam, J. and Jensen, H.W.,"Visual Simulation of Smoke",SIGGRAPH 2001, 23-30 (2001).
Incompressible Euler Equations self-advection Forces incompressible (Navier-Stokes without viscosity)
Additional Equations We now know all the finite differences we need to add the forces for heat and density… smoke’s density temperature
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.
What is vorticity? • A measure of the local rotation in a fluid flow.
Pressure Boundary Conditions • A Neumann boundary condition is a restriction on the derivative of a function.
Velocity Boundary Condition • A Dirichlet boundary condition is a restriction on the value of a function.
Solving the System • Need to calculate: • Start with initial state • Calculate new velocity fields • New state:
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
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
Update Velocity • Equation: • First term: • Advection • Move the fluid through its velocity field (Du/Dt=0) • Second term: • external forces • Final term: • pressure update
Update Velocity • Add external forces (fbuoy + forces from UI + fconf) • Advection (semi-lagrangian step – trace particles back) • Pressure update (solve linear system)
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
Update density • Equation • First term: • Advection • Move the temperature through velocity field • Second term: • Diffusion • Can skip this term • Second term: • external sources
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)
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
Update temperature • Equation • First term: • Advection • Move the temperature through velocity field • Second term: • Diffusion • Can skip this term
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)
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
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.
Numerical Dissipation • ‘Stable Fluids’ method dampens the flow • Typical with semi- Lagrangianmethods • Improve using • “Vorticity Confinement” force
Total Forces • User supplied fields • Buoyancy force • New confinement force
Other Methods • Vortex particle method • Using octree data structure
Vortex particle method-Lagrangian primitives • Curves carry the vorticity • Each local vortex induces a weighted rotation
Vortex particle method-Lagrangian primitives • Curves carry the vorticity • Each local vortex induces a weighted rotation
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
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
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
Smoke Rendering • Thick smoke: plain particles • Thin smoke: adaptive particles[AN05] • accumulate stretching
l n e Smoke Rendering • Thin smoke behaves like a surface [ William Brennan ]
Smoke Rendering • Using Compensated Ray Marching