Joe Kniss Scientific Computing and Imaging Institute University of Utah Volume Effects: Modeling...
-
date post
20-Dec-2015 -
Category
Documents
-
view
216 -
download
0
Transcript of Joe Kniss Scientific Computing and Imaging Institute University of Utah Volume Effects: Modeling...
Joe Kniss
Scientific Computing and Imaging Institute
University of Utah
Volume Effects:Modeling Smoke, Fire, & Clouds
Classification & Optical Properties Joe KnissSiggraph 2004
Volume Modeling
• Acquired data (rarely available)• Simulated (implicit)• Procedural (explicit)
Classification & Optical Properties Joe KnissSiggraph 2004
Volume Modeling
• Acquired data (rarely available)• Simulated (implicit)
– Fedkiw (smoke, fire, fluids)– Harris, Dobashi, Nishita (clouds)
- GP-GPU tomorrow
• Procedural (explicit)
Fedkiw et al.Dobashi et al.
Classification & Optical Properties Joe KnissSiggraph 2004
Volume Modeling
• Acquired data (rarely available)• Simulated (implicit)
– Fedkiw (smoke, fire, fluids)– Harris, Dobashi, Nishita (clouds)
- GP-GPU tomorrow
• Procedural (explicit)
Wednesday : Course 32, GPGPU, Full day
Classification & Optical Properties Joe KnissSiggraph 2004
Volume Modeling
• Acquired data (rarely available)• Simulated (implicit)• Procedural (explicit)
– Constructive volume modeling & animation– Build volume from basic blocks– Blinn, Perlin, Ebert
Perlin Schpok et al.
Classification & Optical Properties Joe KnissSiggraph 2004
Volume Modeling
• Acquired data (rarely available)• Simulated (implicit)• Procedural (explicit)
– Constructive volume modeling & animation– Build volume from basic blocks– Blinn, Perlin, Ebert
Wednesday: Course 31, Elements of Nature, Full day
Classification & Optical Properties Joe KnissSiggraph 2004
Simulation
• Navier-Stokes equations– (Nearly) Always assume divergence free– Time dependent– Initial conditions + Mathematical constraints
• Other options:– Boltzman lattice– Reaction diffusion & coupled map lattice
• Current conditions “implied” by initial conditions and simulation
• Key concept: Project out error and instability– Hodge-Helmholtz decomposition
Classification & Optical Properties Joe KnissSiggraph 2004
Procedural
• Evaluate a function for each fragment– Generate data– Generate optical properties– Modify position– Modify optical properties
• Key components:– Spatial primitives– Noise
Classification & Optical Properties Joe KnissSiggraph 2004
Primitives
• Planes – Distance to plane– Half space
• Blobs (ellipsoids)– Gaussian blob h*exp( -(pos – cent)2 /width)
• Cylinders (volume of rotation)– Any curve based on distance to line segment
• Cones – Inside / outside– Area of circle
w
Classification & Optical Properties Joe KnissSiggraph 2004
Noise
• Perlin noise (ideal?)– Not a reality on GPUs, yet…
• Need to use 3D texture• “Perturb”
– Position (rolling waves)– Optical properties (inhomogeneous clouds)
• Position– Add vector to current tex-coord
• Optical properties– Multiply or add to opacity etc…
Classification & Optical Properties Joe KnissSiggraph 2004
Noise
• Fill 3D texture with random values (3/4 vectors)• Blur values (hide grid)• Set to wrap• Set texture coords
– Multiple copies (multiple texture reads)– Need constants to scale higher frequencies
• In fragment program– Read from noise texture a different frequencies– Scale and sum vectors (mad op)– Add to “data” tex-coord/ position/ optical properties
Classification & Optical Properties Joe KnissSiggraph 2004
Divergence Free Noise
• Don’t just use any old random noise field for flow like phenomena (position perturbation)
• Create vector field that is divergence free to begin with
• Curl( random field ) = 0 divergence– Great for turbulence
• Rotation about a cylinder = vortex• Constant direction = prevailing wind• Sum of divergence free fields = divergence free• Keep divergence around for optical properties?
Classification & Optical Properties Joe KnissSiggraph 2004
Quick review• Grad, differential linear operator:
– { dx, dy, dz }; grad * f = gradient (f is scalar)
• Divergence: div(V) = Dot( grad, V ) (v is vector)– dx vx + dy vy + dz vz
• Curl: curl(V) = Cross( grad, V )– {(dy vz – dz vy), (dz vx – dx vz), (dx vy – dy vx)}
• Divergence free: div( V ) = 0– div( curl ( V ) ) = 0– div( Const( v ) ) = 0
• Curl = rotation– Orthogonal to original flow
• Dot distributes– Dot( grad, u + v ) = Dot( grad, u ) + Dot( grad, v )
Classification & Optical Properties Joe KnissSiggraph 2004
Flow noise – visual example
Original Curl free Divergence free
Tong et al.
Classification & Optical Properties Joe KnissSiggraph 2004
Flow noise – Key idea
• For random turbulence for perturbation– Use curl of random noise field
• Avoid cusps in flow• Subtle, but important• Construct “valid” flow field exactly how you want
it.
Classification & Optical Properties Joe KnissSiggraph 2004
Flow perturbation – Tips
• Everything is backwards– Gather rather than scatter
• Modify position based on where you came from• NOT where the flow is going (opposite)
Classification & Optical Properties Joe KnissSiggraph 2004
Practical Advice• Split relevant computation between vertex and
fragment programs– Every instruction counts!– For blobs; center/distort in VP
• Still need to use to textures!– Even if entirely procedural, texture is fast– Use for volume of rotation, height fields etc…
• Try it multiple ways, and get timings!• Volume rendering == FILL BOUND
– Long programs can be bad– Try pre-integrated transfer functions – Try zero-mean noise (only need modulo)– Compute on tessellated mesh and interpolate for frags
Classification & Optical Properties Joe KnissSiggraph 2004
More Practical Advice
• Move harmonics of noise independently– Example movie
Classification & Optical Properties Joe KnissSiggraph 2004
Meta-programming
• Procedural generation of procedural vertex/fragment programs
• Simplifies a potentially exponential explosion of GPU programs
• Use SH from Waterloo• Design your own lazy meta interface
– Keep symbol table– Attribute maps– Use C++ for your fragment programs
Classification & Optical Properties Joe KnissSiggraph 2004
Height fields and more
• Height field == Huge detail, simple canvas• Leverage p-buffers and auto-mipmap• Compute “height” and compare to map-altitude• Keep it fuzzy• Align height field with view port for optimal
silhouette
Classification & Optical Properties Joe KnissSiggraph 2004
Faking it
• 2D Billboard• 2.5 D Height field• Cache “Render to 3D texture”
Classification & Optical Properties Joe KnissSiggraph 2004
Example – fluffy clouds
+
+ +
np
c
D = exp( -(c – ( x+n*dot(x-p,n)*1/(1+dot(x-p,n))a ) + s*noise(x) )
Classification & Optical Properties Joe KnissSiggraph 2004
Summary
• Volume Construction– Needed for dynamic effects
• Several choices – Simulation– Procedural
• Consider flexibility of vertex/fragment programs– Longer programs, minimize cache misses– Need to procedurally generate these programs
• Flow noise• Height fields & caching• User interface is important
– Primitives and deformers