1 / 103

Flows on Surfaces of Arbitrary Topology

Flows on Surfaces of Arbitrary Topology. Jos Stam Alias GLunch Presentation by John Tran Friday, February 20, 2004. Basic Idea. Combine two pieces of code. Basic Result. Fluids in Computer Graphics. Want Good looking (convincing) Fast Easy to code How?. Far Cry (Ubisoft/Crytek 2003).

sandra_john
Download Presentation

Flows on Surfaces of Arbitrary Topology

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Flows on Surfaces of Arbitrary Topology Jos Stam Alias GLunch Presentation by John Tran Friday, February 20, 2004

  2. Basic Idea • Combine two pieces of code

  3. Basic Result

  4. Fluids in Computer Graphics • Want • Good looking (convincing) • Fast • Easy to code • How? Far Cry (Ubisoft/Crytek 2003)

  5. Stable Fluids • SG99, JGT01 (fft), GDC03, SG03, etc… • Incompressible Navier Stokes

  6. Navier Stokes • Equations have been around forever • Lots of literature • Can reuse others’ code/algorithms • Nonlinear • Hard to solve – that’s why there’s lots of literature

  7. Fluids – Previous work • “Why should we be able to solve these equations if the experts at NASA can’t? -Stam (from his Fluids talks notes) • Because we are computer graphicists!!!

  8. Fluids – Previous work • Yaeger and Upson(SG86), Gamito et al(1995) • First 2D dynamical models of fluids • Used vortex method coupled with Poisson solver • Chen (1997) • Animated water surfaces • Used pressure term from Navier Stokes eqns • Limited to 2D • Unstable

  9. Fluids – Previous work • Foster and Metaxas (1997) • Based on work of Harlow and Welch in computational fluid dynamics (~1965) • Full 3D Navier Stokes equations • Simple to code • Finite differencing • Explicit time solver • But explicit time solvers become unstable for large time-steps

  10. Eulerian solver Smaller time steps for stability Lagrangian and implicit methods ANY time step can be used -- larger time steps lead to faster simulations (and funky results, but no “blow up”) Improvements

  11. Stable Navier Stokes Fluids Solver Density Linear Velocity Conservation of momentum NONLINEAR Conservation of mass

  12. Density • Assuming velocity known • For each time step

  13. Density • Assuming velocity known • Density changes in the direction of velocity

  14. Density • Assuming velocity known • Density diffuses over time at this rate (kappa)

  15. Density • Assuming velocity known • Density increases due to sources from user

  16. How to solve this density equation • Subdivide space into voxels • Velocity and density defined in the center of each voxel (for simplicity)

  17. Algorithm

  18. Diffusing Densities

  19. Diffusing Densities • Idea: examine exchange of density only between neighbors

  20. Diffusing Densities

  21. Diffusing Densities

  22. Diffusing Densities • Unstable when k dt/h2 > 0.5

  23. Diffusing Densities • Use implicit technique • Find densities which when diffused backward in time give the original densities

  24. Diffusing Densities • Now we have a (not so bigass) linear system Ax=b • A can be huge but it is sparse • Need fast linear solver • Tradeoff: solving linear system over big time steps wins over taking lost of little steps in an unstable solver

  25. Linear Solvers

  26. Why FFT • JGT01 • Periodic boundary conditions • u(x,t) -> U(k,t) • Gradient operator turns into multiplication by ik • Diffusion and projection step are MUCH easier to solve • Raises complexity to NlogN, but easy to implement and fast

  27. Algorithm

  28. Moving Densities • Known velocity

  29. Moving Densities • Again, can think about transfer only between neighbors, but again, this becomes unstable

  30. Moving Densities • Cannot use conjugate gradient again because resulting linear system in this case has a nonsymmetrical matrix with varying constants • Easier idea…

  31. Moving Densities • If density was sampled on particles, this would be easy. • Need particle tracer • But then you would have to use a particle solver for the other terms as well – don’t know how to do this

  32. Moving Densities • New idea: find the positions of the particles that after one time step end up exactly at the grid centers

  33. Moving Densities • Trace the particles backwards in time

  34. Moving Densities • Determine four closest neighbors to the point

  35. Moving Densities • Interpolate the density at this location from the 4 cells

  36. Moving Densities • Set the interpolated value as the new density of the “departure cell” • Requires two grids (extra keeps track of density values of previous time step)

  37. Moving Densities • This scheme is unconditionally stable • Density is always bounded

  38. Done with Densities!!!

  39. Velocity • Same frickin thing! • Only difference is velocity is moved by itself

  40. Mass Conservation • Hodge Decomposition

  41. Mass Conservation • Hodge Decomposition

  42. Conservation of Mass • Gradient field found by solving the Poisson equation: • Conjugate gradient would be good. Jos uses Jacobi solver

  43. Done! • UpdateVelocity • AddForce • Diffuse • Move • ConserveMass • Simple to code

  44. Simple Stable Solver (60 lines of readable C, assuming a FFT solver)

  45. Demo • CPU version AND PocketPC version

  46. Future Work • Handle free boundaries for water rendering • Parallelize – a simple port to a dual P3 made it go much faster • (GPU?) • Adaptive grids • All in progress

  47. Remember this? • Combine two pieces of code

  48. Surfaces • Polygons • Splines • Implicit surfaces • Subdivision surfaces

  49. Polygons • Fast hardware support • Arbitrary Topology • Smooth complex surfaces require many polygons • Editing hard

  50. Splines • Easy to control • C2 • No sharp edges • (Damn this looks good… Is this a photograph?)

More Related