Graphics Reference
In-Depth Information
Slice index Depth in meters
0
0.0
1
0.57
2
2.28
3
5.12
···
···
13
96.14
14
111.50
15
128.0
Tab l e 3. 1. Depths for depth slices.
The equation calculates the depth ( d ) for each slice index ( i ). N defines the
number of depth slices and R defines the depth range we want to cover. C
defines the curvature of the function. C =1 . 0 will result in depth slices evenly
distributed across the entire depth range. A higher value of C will move slices
near the camera closer to each other and will spread distant slices farther apart.
We use C =2 . 0 in our implementation to get a nice distribution. Table 3.1 and
Figure 3.13 show the depth slice distribution when using 16 depth slices and a
depth range of 128 meters.
To calculate the 3D texture lookup depth coordinate for a given view-space
depth, we use the following equation:
lookup depth = view space depth
R
(1 /C )
(3.4)
As shown in the equation, we divide the view-space depth by the depth range R .
We then raise it to the power of (1 . 0 /C ), which is the inverse of the power of the
curvature constant C . This will give us the normalized depth coordinate that we
can use to sample the 3D texture. The code used to calculate the 3D texture
lookup depth coordinate is shown in Listing 3.1.
0.0
32.0
64.0
96.0
128.0
Figure 3.13. Depth slice distribution when N = 16, C =2 . 0, and R = 128 . 0.
Search WWH ::




Custom Search