9.1. Transparency

Use the setTransparencyType() method of the render action to specify the quality of rendering for transparent objects. Inventor uses three general types of transparency rendering. Screen-door transparency uses a fill pattern to simulate transparency. Additive blending adds the transparent object to the colors already in the frame buffer. Alpha blending uses a multiplicative algorithm for combining source and destination colors and alpha factor. Within these general categories, there are three types of additive blending and three types of alpha blending, depending on the degree of realism and amount of speed required for a particular rendering job.

See the OpenGL Programming Guide for a discussion of alpha blending.

In Inventor, the transparency quality level can be specified as follows:

Transparency rendering with the ADD (or BLEND) level of transparency, however, works only if the transparent object is being blended into something already in the frame buffer. This type of transparency rendering computes the transparency in the order in which the objects are rendered.

To ensure that transparent objects are rendered last, use the DELAYED_ADD (or DELAYED_BLEND) level. For example, if you draw a transparent cube first and then draw an opaque cylinder behind the cone, you won't see the transparency with the ADD level of transparency. In this case, you must use DELAYED_ADD (or DELAYED_BLEND). The delayed levels require more time than ADD or BLEND, but the realism is greater. (Compare Figure B.18, “ Plate 18 and Figure B.19, “ Plate 19.)

For the highest degree of realism in rendering transparent objects, specify SORTED_OBJECT_ADD (or SORTED_OBJECT_BLEND). This level requires the most time but produces the best results. It renders the transparent objects after the opaque objects and also sorts the objects by distance from the camera, drawing them from back to front. (See Figure B.20, “ Plate 20.)

[Tip]

Tip: Objects such as face sets do not sort within themselves, so the faces in a face set may not be drawn in the correct order for transparency. If the object is solid, using the SoShapeHints SoShapeHints SoShapeHints node with the proper hints may improve the picture.

Note to OpenGL programmers: If you are using delayed or sorted transparency levels, Inventor does not update the z buffer for transparent objects so that they can be drawn in any order.

If you are using an SoXtRenderArea , you can use the setTransparency- Type() method to set the quality level for rendering transparent objects.