9.2. Antialiasing

The SoGLRenderAction( C++ | Java | .NET ) class also provides methods for antialiasing, techniques used to eliminate or reduce jagged lines and make objects drawn on the screen appear smooth. You can choose from two antialiasing methods:

Use the SoGLRenderAction::setSmoothing() method to turn on smoothing. The isSmoothing() method returns the current state of the Smoothing flag. This form of antialiasing is for lines and points only. Because it requires alpha or additive blending, Inventor changes the transparency type if necessary when you turn on smoothing.

Normally, Inventor performs one rendering pass each time a render action is applied. You can use the SoGLRenderAction::setNumPasses() method to increase the number of rendering passes for accumulation buffer antialiasing. Inventor then renders the scene multiple times, moving the camera a little bit each time, and averages the results. The more times Inventor renders a scene, the better the antialiasing. The trade-off is that increasing the number of passes also increases the amount of time required to render the scene. The number of passes can be from 1 to 255, inclusive. Specifying 1 disables multipass antialiasing.

In addition, if you specify TRUE for the SoGLRenderAction::setPass- Update() method, the current contents of the accumulation buffer are copied into the currently active drawing buffer after each rendering pass. This technique slows things down but allows you to watch what happens between the incremental rendering passes. The default for setPassUpdate() is FALSE.

Full-scene antialiasing (FSAA) is a new way to do antialiasing(eliminating or reducing jagged lines and making objects drawn on the screen appearing smooth) in Open Inventor.


The old multipass antialiasing method available in Open Inventor 4.0 can still be used, but we strongly recommend using full-scene antialiasing when it’s available. FSAA has the advantage of being hardware accelerated and does not require rendering the scene multiple times.

The SoFullSceneAntialiasing( C++ | Java | .NET )property node allows you to select what kinds of shapes will be antialiased. When FSAA is enabled, the default filter is ALL, meaning that all shapes will be antialised. If you want to disable FSAA for particular kinds of shapes, you can use SoFullSceneAntialiasing( C++ | Java | .NET ) to do so.

Antialiasing depends on three factors:

  • The FSAA shape type (points, lines, polygons, text),

  • The current draw style,

  • The current antialiasing filter.

The shape type can be retrieved by a call to SoShape::getShapeType() .

During rendering, the following rules are applied to determine if the current shape must be rendered antialiased or not:

Shape type Draw style Filter Antialiased

POLYGONS

FILLED

LINES

POINTS

POLYGONS

TEXT

ALL

 

 

X

 

X

LINES

LINES

POINTS

POLYGONS

TEXT

ALL

X

 

 

 

X

POINTS

LINES

POINTS

POLYGONS

TEXT

ALL

 

X

 

 

X

Shape type Draw style Filter Antialiased

TEXT

FILLED

LINES

POINTS

POLYGONS

TEXT

ALL

 

 

X

X

X

LINES

LINES

POINTS

POLYGONS

TEXT

ALL

X

 

 

X

X

POINTS

LINES

POINTS

POLYGONS

TEXT

ALL

 

X

 

X

X

[Important]

All text strings are antialiased when the SoFullSceneAntialiasing( C++ | Java | .NET ) filter is set to TEXT Otherwise, antialiasing is done based on the current draw style.

Shape type Draw style Filter Antialiased

LINES

FILLED

LINES

LINES

POINTS

POLYGONS

TEXT

ALL

X

 

 

 

X

POINTS

LINES

POINTS

POLYGONS

TEXT

ALL

 

X

 

 

X

Shape type Draw style Filter Antialiased

POINTS

FILLED

LINES

POINTS

LINES

POINTS

POLYGONS

TEXT

ALL

 

X

 

 

X

How to read these tables: Suppose you want to antialias an SoCube( C++ | Java | .NET ) object. SoCube( C++ | Java | .NET ) is of type POLYGONS, so you would refer to the POLYGONS shape type in the tables. Then if the current draw style is FILLED, the two ways to enable antialiasing are to set the SoFullSceneAntialiasing::filterto POLYGONS (the SoCube( C++ | Java | .NET ) type) or to ALL.

[Warning]

The antialiasing of certain primitives may be undesirable. For example, bitmap text strings (SoText2( C++ | Java | .NET ), …) may be "blurred" when they are antialiased.