Graphics Reference
In-Depth Information
Figure 4.22. The normalized Gaussian curve used in the demo for weighting colors.
The normalized Gaussian weights then would be 0.001, 0.028, 0.233, 0.474,
0.233, 0.028, and 0.001, which when summed equal 1.0 exactly.
We don't want to produce more energy when doing the local blurring in the
image, we want to keep the total energy in the image the same so the weights
must equal 1.0 when summed—otherwise we are going to end up with more energy
than what we started with so our image would have become brighter.
Listing 4.6 is a simple simple horizontal and vertical Gaussian blur implemen-
tation in the shading language Microsoft HLSL.
The final convolved images are produced by running the horizontal blur passes
first and then the vertical blur passes successively for each level, which then are
stored in the mip-channel of our color texture.
The choice of 7
×
7 seems to give good matching results for the needs of the
demo. Using a wider kernel with a wider range of weights will cause wrong results
because our transparency buffer and the colors associated with it will not match
on a pixel basis anymore. Notice that our Gaussian weights take the colors mostly
from the two neighboring pixels.
4.5.5 Cone-Tracing Pass
The cone-tracing pass is one of the smaller and easier-to-understand passes. In
short it calculates the in-radiuses for the triangle made up from the cone and
samples at different levels in our hierarchical color convolution buffer and pre-
integrated visibility buffer (see Listing 4.7). Refer back to Section 4.4.5 for the
algorithm explanation. The result can be seen in Figure 4.23
Search WWH ::




Custom Search