Presentation is loading. Please wait.

Presentation is loading. Please wait.

Taming a Wild River Jeff Lander Darwin 3D

Similar presentations


Presentation on theme: "Taming a Wild River Jeff Lander Darwin 3D"— Presentation transcript:

1 Taming a Wild River Jeff Lander Darwin 3D jeffl@darwin3d.com

2 Introduction What types of systems am I creating?

3 Motivation Realistically behaving water That doesn’t just look pretty And can be interacted with

4 Not going to talk about Advanced rendering of water Plenty of info out there on reflections, bumpmaps, refraction, etc. Check out the hardware vendors demos for lots of examples

5 Talk outline Approaches for fluid dynamics Approximation techniques Interaction with objects and environment Future issues

6 What makes fluid look like fluid? Motion – splashing, wavy Transfer of mass – fluid flow Incompressible

7 How is water simulated? Fortunately quite a bit of research Fluid dynamics is a large scientific field CG researchers have looked at various methods We will look at two groups of methods Physically based Other (visual sims, hacks, etc)

8 Scientifically Study of Motion of fluids (water, air,etc.) Governed by the incompressible Navier- Stokes equations. These are used for much scientific work Airflow simulation Heat exchange Restricted Fluid flow (pipes, nozzles)

9 Navier-Stokes Equation Think of it as F = ma for fluid Plus an equation for conserving mass

10 Navier-Stokes Equation There is a gradient of pressure, p, inside the fluid. This gives rise to a fluid flow, v, which seeks to eliminate it. There can also be external forces, f, effecting the flow.

11 Navier-Stokes Equation The amount of fluid entering any section of fluid must be equal to the amount leaving. Conserving mass.

12 CFD Method Numerically solve the NS equations by discretizing the the continuous function. Use a method like finite differencing I will now describe a technique know as Cell-and-Marker

13 Cell and Marker Method Simulation field is divided into a 2D grid for a 2D sim or a 3D voxel grid for 3D.

14 Cell and Marker Method Each grid cell is classified as full of fluid, empty, and obstacle or a surface between fluid and the external environment.

15 Cell and Marker Method Velocities on each edge of the grid is calculated using the NS equations. Pressure is calculated for each square.

16 Cell and Marker Method Mass is conserved by calculating the divergence of fluid in a square and then update the flow to compensate for this lost mass. This is done by changing the flow in that square. This effects each neighboring square. So conservation needs to be repeated.

17 Cell and Marker Method System is then advanced by tracing “marker” particles through the field using the calculated velocities.

18 Cell and Marker Results Very realistic results for both 2D and 3D systems. Easy to set up a variety of systems Does not scale well at all. Grid size and pressure iteration are the big holdups. A variety of linear system solvers can help. Still will not scale well enough for large scale sim.

19 Other Methods Visual simulations and other hacks Not based on NS equations Simplifications of full NS equations

20 Visual Simulations Based on periodic wave functions Mixing multiple Sin waves (FFT systems) Openwater Ocean simulations Some form of mixed noise to perturb surface Don’t account for mass transfer or depth

21 Visual Simulations Water kind of looks like a springy surface. How about mass-spring? No mass conservation No matter transfer

22 Cellular Automaton Using a method where system is advanced by a set of rules involving neighbors Some function of the “height” of all neighbors is used to determine height of each cell. H(i,j) = (H(i+1,j) + H(i,j+1) + …) / N

23 Cellular Automaton Can be extended to 3D Actually an example of the next category

24 NS Simplifications May not need the full Navier-Stokes solution for most applications Focus on the aspects of fluid that are important. For something like a flowing river Surface tracking Movement of water Ability to add or remove fluid Interact with a landscape and objects

25 NS Simplifications Deal with the fluid simulation as a 2D problem [Kass, Miller] [Chen, Lobo] [O’Brien, Hodgins] Determine the height from implicitly Use Pressure to determine changes in height

26 2D Navier-Stokes Consider a single column of water Once we discretize using finite differencing and using laws fluid pressure.

27 2D Navier-Stokes Consider a single column of water as a 2D cell Once we discretize using finite differencing and using laws fluid pressure.

28 2D Navier-Stokes Cell Connections Each column is connected to each neighboring cell by virtual pipes Facilitate the flow between cells

29 2D Navier-Stokes Acceleration of Flow To calculate the flow between cells: Gradient of pressure is acceleration of flow Where length is the length of the virtual pipe Effective this acts like viscosity

30 2D Navier-Stokes Calculating flow The acceleration of fluid in the “pipes” is integrated to determine the fluid flow for a timestep. All flows are integrated over time at each cell to change the volume.

31 2D Navier-Stokes Volume preservation All flow exiting a cell must not move out more volume than exists. If so, the outflow values must be scaled back so the volume is >= 0

32 2D Navier-Stokes Rendering The height at each cell is take directly from the volume. Surface normals are calculated like a standard heightmap surface Now is where you add all your fancy pixel- shader, animated bumpmap stuff.

33 2D Navier-Stokes Inflow and Outflow Simulating fluid entering the sim or exiting is easy. An additional constant flow source is added to each cell. This is done prior to the mass preservation step.

34 2D Navier-Stokes Velocity Data This system gives us the data we want at each cell. Horizontal velocity is taken as the sum of flows between cells. Direction an object on the water surface would move Vertical velocity is the gradient of height changes. Useful for shooting of spray particles Remove volume from the cell and launch.

35 2D Navier-Stokes Velocity Data

36 2D Navier-Stokes Objects on surface Objects on the surface Creates pressure down on contact cells Increase in pressure felt by object as force up Can move in velocity field Just add object pressure as addition term

37 2D Navier-Stokes Ground Interface Ground height needs to be considered If neighboring ground > current volume+ground Flow between is 0 Else only the difference in height should count Don’t consider the entire volume

38 2D Navier-Stokes Scaling Technique works well in large environments No need to iterate over entire grid Only add cells to active list once full Remove from consideration once not connected

39 Problems Loss of 3D Fluid Eddies, standing waves, etc. dampened. Solution is to add in potential flow areas. (see GDMag) No breaking waves – 2D heightfield Use particle systems to break away from surface Does not model fast moving water Limited flow to only adjacent cells

40 Conclusions Working with simplified 2D Navier Stokes Best compromise for speed and features. Scales well Provides many of features expected in flowing water Actual transport of water volume Velocity fields Models for different viscosities of fluids Lots of hacking room Evaporation models Dynamic landscape changes Add in Turbulent noise to make the surface more bumpy

41 References Griebel, Michael, Dornseifer, Thomas, and Neunhoeffer, Tilman, “Numerical Simulation in Fluid Dynamics: A Practical Introduction,” SIAM, Philadelphia, PA, 1998 Kass, Michael, and Miller, Gavin, “Rapid, Stable, Fluid Dynamics for Computer Graphics,” SIGGRAPH 1990, Volume 24, Number 4, pp. 49-55 Chen, Jim, and Lobo, Niels da Vitoria, “Toward Interactive-Rate Simulation of Fluids with Moving Obstacles Using Navier-Stokes Equations,” Graphics Models and Image Processing, Vol. 57, No. 2, March 1995, pp. 107-116 Foster, Nick, and Metaxas, Dimitri, “Realistic Animation of Liquids,” Graphics Models and Image Proc., 58 (5), 1996, pp. 471-483. http://www.cis.upenn.edu/~fostern/ Stam, Jos, “Stable Fluids,” Proceedings of SIGGRAPH 99, 1999, ACM SIGGRAPH, pp. 121-127. www.dgp.toronto.edu/people/stam/reality/Research/pub.html O’Brien, James, and Hodgins, Jessica, “Dynamic Simulation of Splashing Fluids,” Computer Animation ’95, pp. 198-205. www.cs.berkeley.edu/~job/Projects/


Download ppt "Taming a Wild River Jeff Lander Darwin 3D"

Similar presentations


Ads by Google