Graphics Reference
In-Depth Information
Sample ponts from ray start ray finish
Figure 4.21. The isosceles triangle with the sampling points for the cone-tracing pass
in screen space. To find the sample points of our cone in screen space, we have to use
some geometry and calculate the in-radius of this isosceles triangle. Note that this is
an approximation and we are not fully integrating the entire cone.
the length of our intersection we calculated before and the base of our isosceles
triangle is the opposite side. Using this formula we find the radius of the in-
radius circle. Once we have the in-radius of the isosceles triangle, we can take
the adjacent side and subtract the in-radius from it to find the sampling point
we are interested in. We can now read the color from the correct coordinate in
screen space.
To calculate the rest of the sampling points, all we have to do is subtract the
in-radius another time to reach the leftmost side of the circle and then recalculate
the opposite side with this new adjacent side using equation 4.2, and then rerun
the in-radius formula to get the next smaller circle. We do this successively for
as many samples as we want to take.
We accumulate the correct color by using a trilinear filtering scheme (smoothly
filtering between the neighboring pixels and between the hierarchy levels). We
also weigh the color with the transparency buffer and by how much our cone-
sphere intersects the coarse depth cells. This is done in front-to-back order,
so it is basically a linear search algorithm. The larger the cone is, the faster
it runs. The weight is accumulated to know how much visibility is integrated.
One might want to take smaller offsets between the circles to achieve smoother
results; however, that gets more expensive. If the cone tracer doesn't accumulate
a visibility of 100%, we can blend in the rest of the visibility using, say, cube-maps
with the same roughness.
Again depending on the format of the Hi-Z buffer, if we use a view-space
Z version, then how we determine whether the cone-sphere intersects the Hi-Z
buffer—as well as how we calculate the sampling points on the cone—is different
One can use the cone angle with the view-space Z distance to find the sphere size
and then project this using perspective division into screen space, keeping aspect
ratio in mind.
Search WWH ::




Custom Search