Open Inventor Release 2024.2.3
 
Loading...
Searching...
No Matches
Antialiasing

The SoGLRenderAction 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:

  • Smoothing, which is relatively “cheap” in terms of processing time. Smoothing applies to lines and points only.
  • Using the accumulation buffer, which requires more processing time than smoothing but applies to the whole image and results in superior antialiasing. This technique requires an OpenGL window that supports an accumulation buffer.

Method 1: Smoothing

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.

Method 2: Using the Accumulation Buffer

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.

Use the SoXtRenderArea::setAntialiasing() method to turn on smoothing and to specify the number of passes for accumulation buffer antialiasing. You can specify either smoothing or accumulation buffer antialiasing, or both.

Full-Scene Antialiasing

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.

,_right__antialiased_

Effect of antialiasing on the display quality. Left (aliased), right (antialiased)

Activating Antialiasing

Availability of FSAA depends on your graphics hardware and driver.

FSAA is supported via the ARB_multisample OpenGL extension, which, in
turn, requires the ARB_pixel_format OpenGL extension.

FSAA is enabled using the SoXtGLWidget::setFullSceneAntialiasing() method. This method allows you to globally enable or disable FSAA and to specify the quality level that will be used for rendering your scene graph, and to optionally initialize the antialiasing shape filter. The quality and filter concepts are discussed below.

Then, during scene graph traversal, the SoFullSceneAntialiasing node can be used to activate or deactivate the antialiasing for a specific part of the scene and/or to change the antialiasing shape filter.

Antialiasing Quality

The quality level of the FSAA rendering is based on the number of samples available on your graphics hardware and driver.

FSAA is done by sampling all primitives multiple times at each pixel.

Antialiasing pixel sampling.

Because the number of samples doesn’t vary in the same way on all graphics hardware, the quality field doesn’t specify the number of samples used for antialiasing computation, but rather a value in the interval [0..1], where 0 is the lowest quality level and 1 is the highest quality level.

The quality level can be set by using the Graphics Preferences and Configurations as described in Graphics Preferences and Configurations.

Antialiasing Shape Filter

The SoFullSceneAntialiasing 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 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 LINESPOINTSPOLYGONSTEXTALL X X

| LINES | LINESPOINTSPOLYGONSTEXTALL | X X | | POINTS | LINESPOINTSPOLYGONSTEXTALL | X X |

Shape type Draw style Filter Antialiased
TEXT FILLED LINESPOINTSPOLYGONSTEXTALL XXX

| LINES | LINESPOINTSPOLYGONSTEXTALL | X XX | | POINTS | LINESPOINTSPOLYGONSTEXTALL | X XX |

All text strings are antialiased when the SoFullSceneAntialiasing filter is set to TEXT
Otherwise, antialiasing is done based on the current draw style.

Shape type Draw style Filter Antialiased
LINES FILLEDLINES LINESPOINTSPOLYGONSTEXTALL X X

| POINTS | LINESPOINTSPOLYGONSTEXTALL | X X |

Shape type Draw style Filter Antialiased
POINTS FILLEDLINESPOINTS LINESPOINTSPOLYGONSTEXTALL X X

How to read these tables: Suppose you want to antialias an SoCube object. SoCube 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::filter to POLYGONS (the SoCube type) or to ALL.

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