Content uploaded by Matthias Trapp
Author content
All content in this area was uploaded by Matthias Trapp on Jan 02, 2019
Content may be subject to copyright.
Real-Time Volumetric Tests
Using Layered Depth Images
Hasso Plattner Institute,
University of Potsdam,
Germany
Matthias Trapp, Jürgen Döllner
EG 2008 :: 17th April
Real-Time Volumetric Tests Using Layered Depth Images :: Matthias Trapp 2
Outline
Introduction
Layered Depth Images on GPU
Volumetric Parity Test
Discussion
Conclusion
EG 2008 :: 17th April
Real-Time Volumetric Tests Using Layered Depth Images :: Matthias Trapp 3
Introduction
Volumetric Test…
…determines if a 3D point
is inside or outside a given volume
Areas of application:
•Generalized clipping,
•Rendering with hybrid styles,
• GPU collision detection,…
Characteristics:
•Performed in shader program
•Real-time
EG 2008 :: 17th April
Real-Time Volumetric Tests Using Layered Depth Images :: Matthias Trapp 4
Real-Time Volumetric Tests
Ingredients: Data structure + algorithm
•Volume representation of polygonal shapes
–Hardware accelerated data structure
–Should give a sufficient approximation
→
Layered Depth Image
•Volumetric test for arbitrary 3D points
–Applicable in shader programs,
–Fast and efficient implementation
→
Volumetric Parity Test
EG 2008 :: 17th April
Real-Time Volumetric Tests Using Layered Depth Images :: Matthias Trapp 5
Layer Depth Images on GPU
Layered Depth Images (LDI)
[Shade 1998]
GPU friendly representation of LDIs:
•Depth maps = layers of unique depth complexity
•3D texture or 2D texture array of depth maps
•Texture format: 32bit floating point
EG 2008 :: 17th April
Real-Time Volumetric Tests Using Layered Depth Images :: Matthias Trapp 6
LDI Example
Depth Layers LDI = (LDI0,…,LDI7)
3D LDI Texture Space [0,1]3
Non-Convex Polygonal Mesh S with d = 7
3D World Space IR3
s
t
x
y
Depth-
Peeling
z
O O
EG 2008 :: 17th April
Real-Time Volumetric Tests Using Layered Depth Images :: Matthias Trapp 7
Depth-Peeling to 3D Texture
1. Scale shape into unit volume
2. Set orthographic projection, adjust near/far planes
3. Determine depth complexity of shape
4. Create and initialize 3D texture (LDI)
5. Depth-peel shape [Everitt 2001]
•Render-to-texture (slice of 3D texture)
•Use linear depth buffer values [Lapidious 1999]
uniform sampler3D LDI;
uniform int pass;
varying float linearDepth;
void main(void){
if((pass > 0) && (linearDepth <= texelFetch3D(LDI, ivec3(gl_FragCoord.xy, pass-1),0).x)){
discard;
}//endif
gl_FragDepth = linearDepth;
}
GLSL fragment shader for 2nd depth test (SM4)
EG 2008 :: 17th April
Real-Time Volumetric Tests Using Layered Depth Images :: Matthias Trapp 8
Volumetric Parity Test (VPT)
“to determine if a point is inside or outside
a complex 3D volume represented by an LDI”
•Given: arbitrary 3D point:
•Requested: Boolean parity:
•Solution:
1. Transformation into LDI texture space:
2. Perform ray-marching through depth maps
EG 2008 :: 17th April
Real-Time Volumetric Tests Using Layered Depth Images :: Matthias Trapp 9
Ray-Marching in LDI Texture Space
1. Construct a ray
2. Sample form each slice
3. Compare depth values
r
t
Tr
(s,1,0)
(s,0,1)
Ray R
Inside
Outside
d0d1d2d3
(s,0,0)
(Ts ,Tt ,0) (Ts ,Tt ,1)
pT =0 pT =1 pT =0 pT =1
S
(s,1,1)
EG 2008 :: 17th April
Real-Time Volumetric Tests Using Layered Depth Images :: Matthias Trapp 10
Efficient Shader Implementation
bool volumetricParityTestSM4(
in vec3 T, // Point in LDI texture-space
in sampler3D LDI, // layered depth image
in int depth, // LDI slices
in bool initParity) // initial parity
{
// initial parity; true = outside
bool parity = initParity;
// for each texture layer do
for(int i = 0; i < depth; i++)
{ // perform depth test
if(T.r <= texelFetch3D(LDI, ivec3(T.st, i), 0).x)
{
parity = !parity; // swap parity
}//endif
}//endfor
return parity;
}
EG 2008 :: 17th April
Real-Time Volumetric Tests Using Layered Depth Images :: Matthias Trapp 11
Discussion
Limitations:
•Memory consumptions
•Depth-peeling is costly
•Limited number of LDI
•VPT is fill-limited
Drawbacks:
•Under sampling artifacts
•Aliasing artifacts
Undersampling
Aliasing
EG 2008 :: 17th April
Real-Time Volumetric Tests Using Layered Depth Images :: Matthias Trapp 12
Conclusion & Future Work
Take away:
•Volumetric test in real-time
•Based on LDI
•Different applications
•Sampling artifacts
Future work:
•LDI compression
•Optimal viewpoint selection
•Solve sampling artifacts
•Ray-LDI intersection test
EG 2008 :: 17th April
Real-Time Volumetric Tests Using Layered Depth Images :: Matthias Trapp 13
Main References
[Lapidous 1999]
LAPIDOUS E., JIAO G.: Optimal Depth Buffer for Low-
Cost Graphics Hardware. In HWWS ’99 (New York,
NY, USA, 1999), ACM, pp. 67–73.
[Shade 1998]
SHADE J., GORTLER S., WEI HE L., SZELISKI R.:
Layered Depth Images. In SIGGRAPH ’98 (New York,
NY, USA, 1998), ACM, pp. 231–242.
[Everitt 2001]
CASS EVERITT: Interactive Order-Independent
Transparency. Tech. rep., NVIDIA Corporation, 2001.