next up previous contents
Next: 15.4 Depth Cuing Up: 15.3.3 Rendering a Surface Previous: 15.3.3.1 Alpha Buffer Approach

15.3.3.2 No Alpha Buffer Approach

If you don't have an alpha buffer to store intermediate alpha values, then you'll have to render two images, one of the internal objects, one of the surface textured shell, then combine the two images using blending.

The first steps are the same as the alpha buffer approach: You render the internal object as before, then adjust the transparency of the resulting image by rendering the alpha textured shell with the blend mode set to glBlendFuncGL_ZERO, GL_ONE_MINUS_SRC_ALPHA(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA). The alpha values from the shell are used to scale the image of the object internals that have been rendered into the framebuffer. This time the alpha values are lost.

In a separate buffer (or different area of the window) Render the surface textured shell. Now adjust the transparency of this image by re-rendering the shell using only the alpha texture. This time the blend mode should be glBlendFuncGL_ZERO, GL_SRC_ALPHA(GL_ZERO, GL_SRC_ALPHA). This image now has it's transparency adjusted.

Now you can combine the two images using glCopyPixels() with the blend function set to glBlendFuncGL_ONE, GL_ONE(GL_ONE, GL_ONE). This brings the two halves of the blend operation together.

There is one problem. There is no depth testing between the transparent shell and the internal objects images. You can also take care of this using a stenciling technique. The technique allows you, in effect, copy an image with its depth information. The stencil buffer is used to save the results of depth comparing the two images' depth values, and used as a per-pixel mask to control the merging of the two images. See Section 8.7 for details.


next up previous contents
Next: 15.4 Depth Cuing Up: 15.3.3 Rendering a Surface Previous: 15.3.3.1 Alpha Buffer Approach
David Blythe
1999-08-06