Upload
blanche-phillips
View
215
Download
0
Embed Size (px)
Citation preview
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Physically-Based Visual Simulation on Graphics Hardware
Mark J. HarrisGreg CoombeThorsten ScheuermannAnselmo Lastra
2 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
More, Better, Faster
Goal:Flexible, real-time visual simulation of diverse dynamic systemsFurther increase visual realism of interactive 3D applications•Fluids, gases, fire, etc.•Beyond canned texture animations
3 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Visual Simulation?
Goal is visual realismAd hoc simulation methods can provide good visual results w/ less computation• But not necessarily high numerical accuracy
If the user is convinced, numbers aren’t so important
4 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Coupled Map Lattice
Mapping:Continuous state lattice nodes
Coupling:Nodes interact with each other to produce new state according to specified rules
5 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Coupled Map Lattice
CML introduced by Kaneko (1980s)Used CML to study spatio-temporal chaosOthers adapted CML to physical simulation:• Boiling [Yanagita 1992]• Convection [Yanagita 1993]• Clouds [Yanagita 1997; Miyazaki 2001]• Chemical reaction-diffusion [Kapral ‘93]• Saltation (sand ripples / dunes) [ Nishimori ‘93]• And more
6 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
CML vs. CA
CML extends cellular automata (CA)
CA CMLSPACE Discrete Discrete
TIME Discrete Discrete
STATE Discrete ContinuouContinuouss
7 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
CML vs. CA
Continuous state is more usefulDiscrete: physical quantities difficult• Must filter over many nodes to get “real” values
Continuous: physical quantities easy• Real physical values at each node• Temperature, velocity, concentration, etc.
8
9 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
CML Operations
10 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Graphics Hardware
Why use it?Speed: up to 25x speedup in our simsGPU perf. grows faster than CPU perf.Cheap: GeForce 4 Ti 4200 < $140Load balancing in complex applications
Why not use it?Low precision computation (not anymore!)Difficult to program (not for long!)
11 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Hardware Implementation
12 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
CML Operations
Implement operations as building blocks for use in multiple simulations
DiffusionBuoyancy (2 types)Latent HeatAdvectionViscosity / PressureGray-Scott Chemical ReactionBoundary ConditionsUser interaction (drawing)Transfer function (color gradient)
13 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Results
Implemented multiple simulations
Boiling (2D and 3D)
Rayleigh-Bénard Convection (2D)
Reaction-diffusion (2D and 3D)
14 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Boiling
[Yanagita 1992]State = TemperatureThree operations:
Diffusion, buoyancy, latent heat7 passes in 2D, 9 per 3D slice
15 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Rayleigh-Bénard Convection[Yanagita & Kaneko 1993]State = temp. (scalar) + velocity (vector)Three operations (10 passes):
Diffusion, advection, and viscosity / pressure
16 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Reaction-Diffusion
Gray-Scott reaction-diffusion model [Pearson 1993]State = two scalar chemical concentrationsSimple: just diffusion and reaction ops2 passes in 2D, 3 per 3D slice
17 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Hardware Limitations
Precision, precision, precision!8 or 9 bits is far from enoughDiffusion is very susceptible to precision problems• All of our simulations use it!
High dynamic range simulations are very susceptible• Convection, reaction-diffusion• Not boiling – relatively small range of values
18 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Hardware Limitations
3D texturingIt’s fast … unless you are doing dynamic texturing• Copy to slice of 3D texture is slow• We use a stack of 2D slices to
represent 3D volume
Not all 2D texture shaders have 3D analogs• Fixed with general purpose fragment
programs (NV30, ATI R300)
19 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Future Work
Explore simulation techniques / issues on graphics hardware
Other PDE solution techniquesMore complex simulationsUse of HLSL, next-gen hardwareHigh dynamic range simulations
Applications:Interactive environments, gamesScientific ComputationDynamic painting / modeling applicationsDynamic procedural texture synthesisDynamic procedural model synthesis…
20 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Conclusion
GPUs are a capable, efficient, and flexible platform for physically-based visual simulation
21 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Acknowledgements
NVIDIA Developer RelationsHWW Paper ReviewersSponsors:
NVIDIA CorporationUS National Institutes of HealthUS Office of Naval Research US Department of Energy ASCI programUS National Science Foundation
22 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
For More Information
http://www.cs.unc.edu/~harrism/cmlEmail [email protected]
23 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Extra Slides
24 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
CML Philosophy
Bottom-up approach.Don’t directly simulate macroscopic behavior:
Perform simple, local, “microscopic” lattice operations.
25 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
CML Philosophy
Macroscopic behavior is aggregate of simple operations.
e.g. Boiling simulation:• 3 operations: diffusion, thermal buoyancy,
latent heat.
26 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
CML Operations
Typically consist of four components:
1. Neighbor sampling2. Computation on Neighbors3. New state computation4. State update
27 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Neighbor Sampling
Set a 1:1 mapping from pixels to texels:
Set view port resolution to texture resolution.Use orthographic projection.
To sample an immediate neighbor of each texel:
Draw a single quad filling the view port.Set texture coordinates at corners to {(0,0), (0,1), (1,1), (1,0)} plus the offset to the neighbor.• E.G. Offset to right is (w, 0), where is view space
texel width.
28 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Neighbor Sampling
Neighbor sampling is easy with vertex programs.
Store table of offsets in vertex program memory.At run time, pass table index that represents the type of offset needed.Render a quad (with only a single set of base texcoords).Use vertex program to add offsets and generate texcoords for all texture units.
29 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Computation on Neighbors
Use texture table lookups to compute arbitrary functions of sampled values.
Dependent texturing using texture shaders.
30 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
New State Computation
Combine sampled values and computations to compute new state.Implemented on GeForce 3 using register combiners.
Arithmetic: add, subtract, multiply, scale, bias and dot product.8 cascaded register combiners + 1 “final” combiner.9-bit signed arithmetic internally.8-bit unsigned on output (can clamp or scale and bias).
31 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
State Update
Store the newly computed state to texture.We use glCopyTexSubImage2D()
Fast copy from frame buffer to texture memory.
Render to texture OpenGL extension
Will reduce cost, but still in development.Already available in Direct3D.
32 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Common Operations
Laplacian:
Discrete form:
Diffusion:
cd is the diffusion coefficient
.),(2
2
2
22
y
T
x
TyxT
jijijijijiji TTTTTT ,1,1,,1,1,2 4
.4 ,
2,
', ji
djiji Tc
TT
33 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Common Operations
Directional forcesBuoyancy (used in convection simulation):
Thermal buoyancy with phase change:
• Uses dependent texture to compute tanh
• Tc is the boiling point
].2[)()( ,1,1,2,, yxyxyxc
yxyx TTTyvyv b
)],(tanh[)(
)],()([ 1,1,,2,,
c
yxyxyxyxyx
TTT
TTTTT
34 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Boiling Simulation Performance
0
200
400
600
800
1000
1200
1400
1600
1800
2000
128x
128
256x
256
512x
512
1024
x102
4
32x3
2x32
64x6
4x64
128x
128x1
28
Lattice Resolution
Ite
rati
on
s P
er
Se
co
nd
Software
GeForce 3
GeForce 4
25x speedup
35 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Interactive Framework
CMLlabFramework for building and testing CML simulations
36 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Real Applications
Fast simulation integrated with 3D environments
Virtual environment in HMD w/ head trackingWildMagic Game Engine [Eberly 2001]
37 The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Graphics Hardware Performance
Peak Perf.
('s/sec)
Year
HP CRXSGI Iris
SGI GT
HP VRX
Stellar GS1000
SGI VGX
HP TVRX
SGI SkyWriter
SGI
E&SF300
One-pixel polygons (~10M polygons @ 30Hz)
SGIRE2
RE1
Megatek
86 88 90 92 94 96 98 00104
105
106
107
108
109
UNC Pxpl4
UNC Pxpl5
UNC/HP PixelFlow
Flat shading
Gouraudshading
Antialiasing
Slope ~2.4x/year (Moore's Law ~ 1.7x/year) SGI
IRE&SHarmony
SGI R-Monster
Division VPX
E&S Freedom
Accel/VSISVoodoo
Glint
DivisionPxpl6
PC Graphics
Textures
SGICobalt
Nvidia TNT
Graph courtesy of Professor John Poulton
GeForce 3& Radeon
3DLabs