Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
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.

Transparency Levels

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

SCREEN_DOOR use OpenGL stipple patterns for screen-door transparency.
ADD use additive OpenGL alpha blending.
DELAYED_ADD use additive blending; render opaque objects first and transparent objects last.
SORTED_OBJECT_ADD use additive blending. Draw opaque objects first, then transparent objects. Sort the transparent objects by their distance from the camera and draw them from back to front (same as DELAYED_ADD because adding is commutative).
BLEND use OpenGL alpha blending. (See Plate 18 .)
DELAYED_BLEND use OpenGL alpha blending; render opaque objects first and transparent objects last. (See Plate 19 .)
SORTED_OBJECT_BLEND use OpenGL alpha blending. Draw opaque objects first, then transparent objects. Sort the transparent objects by their distance from the camera and draw them from back to front. (See Plate 20 .)

Trade-offs

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 Plate 18 and 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 Plate 20 .)

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 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.