next up previous contents
Next: 6.20.2 Making Detail Textures Up: 6.20 Detail Textures Previous: 6.20 Detail Textures

6.20.1 Signed Intensity Detail Textures

One technique that avoids having to compute the base texture magnification is to create a signed detail texture. The detail texture image created so that it has both positive and negative intensity values, with an average value over the detail texture of zero; when combined with the base image, it modifies it, adding high frequency components to the textured image. The detail texture is combined with the base texture in a separate pass, using alpha blending.

Different blend functions can be used, depending on whether you want to add in the detail texture or modulate with it. In the first pass the image is drawn with the base texture, in the second pass, The detail texture is made current, and since it is higher resolution, the texture coordinate mapping is changed, either by changing the texgen mapping or with the texture transformation matrix. Blending mode is enabled, and the blend function is set. If the blend function is glBlendFuncGL_ONE, GL_ONE(GL_ONE, GL_ONE), the detail texture is added to the base texture. If the blend function is glBlendFuncGL_ZERO, GL_SRC_COLOR(GL_ZERO, GL_SRC_COLOR), the detail texture will modulate the base texture.

The clever part of this algorithm is how the detail texture combines with the base texture as a function of magnification. The detail texture is applied to the same geometry as the base texture. The texturing system is configured so that the detail texture is at an offset magnification value relative to the base texture; it minifies if the base texture is not magnifying. The minification filtering will cause the signed intensity components to blend together.

If the average intensity of the detail texture is zero, it will have little or no contribution to the image. As both the detail and base texture are zoomed, the filtering of the detail texture begins to magnify, and the signed intensity values stop canceling each other out.

Although a signed texture value can not be blended directly, it can be simulated by using a subtractive blend and a biasing term. The signed texels of the detail texture are first converted to positive values. For example, if the texture values range from -1/4 to 1/2, the texels can be biased by 1/4. Then the texture images applied and blended normally. After the two textures are combined, a third pass subtracts out the 1/4 bias term from the textured image.

Create a signed detail texture image ranging from -1/4 to 1/2.
Bias the image to make it non-negative.
Render the surface with the base texture.
Enable blending.
Set blend function to modulate or add.
Re-render the surface using the detail texture with different texture coordinates.
Render the image unlit with a gray color (equal to the bias term) to remove the biasing term.


% latex2html id marker 6184
\vrule width 0pt height 0.1...
...}}{\small Figure \thefigure . Subtracting out Low Frequencies}\\

next up previous contents
Next: 6.20.2 Making Detail Textures Up: 6.20 Detail Textures Previous: 6.20 Detail Textures
David Blythe