Fast Scene Voxelization and its Applications Elmar Eisemann and Xavier Décoret i3D

Download Report

Transcript Fast Scene Voxelization and its Applications Elmar Eisemann and Xavier Décoret i3D

i3D
Fast Scene Voxelization
and its Applications
Elmar Eisemann and Xavier Décoret
ARTIS-GRAVIR/IMAG-INRIA
ARTIS is a team of the GRAVIR/IMAG laboratory, a joint effort of CNRS, INRIA, INPG and UJF
i3D
A long time ago ...
• Simple games and simple pleasures...
i3D
Nowadays ...
• 3D
• Complex models
• Complex effects
i3D
Context
• Complex and dynamic scenes
Need for
• Fast information acquisition
• Fast information evaluation
• Shader compatibility
i3D
Context
• Lots of effects
i3D
Context
• Lots of effects
i3D
Context
• Lots of effects
i3D
What is common?
• All use information from voxels!
i3D
What is a Voxel?
• Space discretized by cubes (voxels)
• Can contain information
i3D
What‘s good about voxels?
• Constant complexity
– (scene independent)
• Simple structure
• Simple entities
i3D
What‘s bad about voxels?
• Storage cost (3D)
• Not GPU adapted
• Slow on CPU
100K polygons
octree 256 x 256 x 256
3 minutes [Haumont and Warzee 2002]
i3D
Previous Work on GPU Voxelization
• Everitt et al. 2001 using Depth Peeling
– Layers are peeled off using zBuffers
• Pro:
– Representation is accurate from the viewpoint
• Contra:
– One pass per depth complexity
– Result not easy to use (and several textures)
i3D
Goals of our approach
• Representation easy to use on GPU
• Result in one pass
• Handle depth complexity problem
i3D
Previous Work on GPU Voxelization
• Dong, Chen, Bao, Zhang and Peng
Pacific Graphics 2004,
Real-time Voxelization for Complex Models
• Same key idea for representation
• Comparison later...
i3D
Our contribution(s)
• Simple and compact representation
• GPU adapted (especially in future)
• Very fast
1.000 K polygons
1024 x 1024 x 128
At approx. 70Hz (~0.02 seconds)
• Three sample applications
Comes with a
price ...
i3D
The price of speed
• Less information
– basically: 1 bit
– trade-off: grid resolution <> information
• Not accurate
– not watertight
For most applications this is not problematic
• Not hierarchical
i3D
Let‘s voxelize ...
i3D
Principle - The key idea
• Represent a 3D grid as a 2D image
slicemap
• Use GPU to fill grid by rasterizing
i3D
Principle - Voxel encoding
• Associate bitmask to distance of fragment
2
1
8
4
32 128 2
16 64
1
8
4
1 bit = 1 slice
32 128 2
16 64
1
8
4
32 128
16 64
i3D
Principle - Voxel encoding
• Fragments are ORed using OpenGL LogicOps
i3D
Principle - Voxel encoding
• Shader extremely simple (<10 instructions)
i3D
Principle - Voxel encoding
• 32 slices for 4 channels (RGBA) with 8 bits
i3D
Principle - Voxel encoding
• How can we do better?
i3D
Technical details - Precision
• Using MRT 4*32 = 128 in a single pass
i3D
Principle - Grid
• Orthographic projection leads to a voxel cube
• Depth function can be modified
i3D
Technical details – Local precision
useless voxels
uniform
i3D
Technical details – Local precision
• Tighter interval using two depth maps:
less / greater depth test
i3D
Technical details – Local precision
Less unused voxels
local
i3D
Technical details – Local precision
• Very efficient:
– 1 or 2 depth renderings (FastZBuffer)
– still simple shader (2 supplementary texlookups)
i3D
Limitations
Occur less due to high
image resolution
Well known problems...
i3D
Limitations
• Max resolution 4096 x 4096 x 128
• Only rasterizable objects
• Different representation along Z-axis
– but can be beneficial
i3D
Comparison to Dong et al.
• Same encoding in bits
• 3 slicemaps to solve “hole“ problem
– limits resolution or several render passes
– needs fusion into final voxel texture
• No local precision
i3D
Applications
• Transmittance shadow maps
• Refraction
• Shadow volume culling and clamping
i3D
Transmittance Shadow Maps - TSM
i3D
TSM - Related Works
• Deep shadow maps [Lokovic and Veach 00]
• Opacity maps [Kim and Neumann 01]
• Nalu [Nguyen and Donnelly 05]
i3D
TSM - Related Works
• Deep shadow maps [Lokovic and Veach 00]
• Opacity maps [Kim and Neumann 01]
• Nalu [Nguyen and Donnelly 05]
i3D
Deep shadow maps
• Shadows for complex scenes
• 1D attenuation function per pixel
• Evaluation like shadow map
i3D
Deep shadow maps
Pro:
Images courtesy of Lokovich and Veach, Deep Shadow Maps, Proc. of Siggraph 2000
• nice results
Contra:
• far from real-time
• no physical meaning
i3D
TSM - Related Works
• Opacity maps [Kim and Neumann 01]
– Store float opacity in layers (interpolation simple)
– Creation of one layer uses whole geometry
– For GPU evaluation (original algo used CPU evaluation):
• Currently >16 layers possible perfomance drop[Koster04]
– Expensive for complex scenes and several layers
• Nalu [Nguyen and Donnelly 05]
– Close to opacity maps
– Store opacity in color channels
– Using MRT: 16 layers
Image copyright NVIDIA cooperation
i3D
Transmittance shadow maps – Key idea
• Semi-transparent surfaces:
Attenuation =
nb of intersected surfaces
i3D
Transmittance shadow maps – Key idea
• Transparent objects‘ slicemap
Attenuation =
nb of intersected voxels
i3D
Transmittance shadow maps - Algo
• Input: Object with semi-transparent material
• 2 render passes:
– Light
– Viewer
163.000 tris
i3D
Transmittance shadow maps - Algo
• Near/far depth maps of semi-transparent
parts and local slicemap
depth maps
slicemap
i3D
Transmittance shadow maps - Shader
• Slicemap texlookup gives voxel column
slicemap
S(p)
i3D
Transmittance shadow maps - Shader
• Value truncation by position
just a mod
S(p)
Z(p)
V(p)
i3D
Transmittance shadow maps - Shader
• Bit count
tex lookup
bit count texture
i3D
Transmittance shadow maps
Results:
i3D
Transmittance shadow maps
• Trade-off: Precision vs. information
i3D
Deep shadow maps in real time
• 3 phenomena:
partial occlusion
semi-transparent
volumetric
(small occluders)
(glass)
(fog)
i3D
Deep shadow maps in real time
• 3 phenomena:
supersampling
partial occlusion
semi-transparent
volumetric
(small occluders)
(glass)
(fog)
i3D
Deep shadow maps in real time
• 3 phenomena:
supersampling
TSM
partial occlusion
semi-transparent
volumetric
(small occluders)
(glass)
(fog)
i3D
Deep shadow maps in real time
• 3 phenomena:
supersampling
TSM
Now...
partial occlusion
semi-transparent
volumetric
(small occluders)
(glass)
(fog)
i3D
Applications
• Transmittance shadow maps
• Refraction
• Shadow volume culling and clamping
i3D
Volumetric effects – Related Works
• Inspired by [Wyman 05]:
Refract ray twice:
front face normals and back face normals
Traversed depth approximated:
precalculation + depth map difference
i3D
Volumetric effects – Approach
• Use volume info for refraction / scattering
as well as attenuation
Lokovic and Veach
i3D
Volumetric effects - Algorithm
• Suppose: closed object
• Goal: traversed volume/create filled voxels
N
V
V R
R
V N N
V N N
V
Depth map difference works
i3D
Volumetric effects - Algorithm
• Suppose: closed object
• Goal: traversed volume/create filled voxels
N
V
V R
R
V N N
V N N
V
Depth map difference fails
i3D
Volumetric effects – Naive approach
• Single slicemap from eye and flood fill
N
V
V R
R
V N N
V N N
V
i3D
Volumetric effects – Naive approach
• Single slicemap from eye and flood fill
• Problems:
– On GPU flood fill is too slow
– Evaluation texture is impossible
• More than 4 Gbyte for 32 slices
– Several faces in one voxel (ambiguity)
i3D
Volumetric effects – Key Idea
• Create two slicemaps
• Front and back facing surfaces
N
V
V R
R
V N N
V N N
V
• This can be done in a single pass (MRT)
i3D
Volumetric effects – Key Idea
• Two slicemaps allow incremental volume
computation via in/out states
N
V
V R
R
V N N
V N N
V
i3D
Volumetric effects – Evaluation
• Evaluation texture for a single channel
– info to resolve ambiguity
• Texture lookups are independent
Details in paper
i3D
Volumetric effects
Results:
>200 fps on a Geforce6800
i3D
Applications
• Transmittance shadow maps
• Refraction
• Shadow volume culling and clamping
i3D
Shadow volume culling and clamping
• CC ShadowVolumes
[Lloyd, Wendt, Govindaraju, Manocha 2004]
– Culling and Clamping of SV [Crow 77]
• CC Shadow volumes
• Caster culling:
+1
+1
-1
i3D
CC Shadow volumes
• Shadow volume clampingReceiver culling:
i3D
Shadow volume culling and clamping
• Our approach uses the slicemap to perform
shadow clamping (modified depth function)
i3D
Shadow volume culling and clamping
• Our approach uses the slicemap to perform
shadow clamping (modified depth function)
Shadow volumes
CC shadow volumes
i3D
Shadow volume culling and clamping
• Slicemap with modified depth function:
i3D
Shadow volume culling and clamping
How to determine volume extent:
• Currently in a shader, 1 pass for 1 slice
i3D
Shadow volume culling and clamping
Proposed hardware extension:
• OR in area of occluder would be sufficient
(1 pass for 128 slices)
i3D
Shadow volume culling and clamping
• Slight Optimizations to improve culling and
clamping
i3D
Conclusion
• Fast voxelization of highly complex scenes
• Grid of high resolution: 4096 x 4096 x 128
• Completely GPU based
• Input of almost arbitrary nature/topology
• Several applications possible
i3D
And the future ...?
• 32 bit framebuffers imply 512 slices in 1 pass
• Direct X 10 implies bit operations
i3D
Thank you very much
for your attention!