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:
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.
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.
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( C++ | Java | .NET )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.
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.
NVidia graphics hardware can support number of samples * 2 levels of quality (assuming the NV_multisample_filter_hint OpenGL extension is available). For more info, refer to the document OpenGL Pixel Formats and Multisample Antialiasing by Sébastien Dominé, NVidia Corporation, 2001. |
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 Section 2.7, “ Graphics Preferences and Configurations”.
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 |
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.