Class SoComplexity

  • All Implemented Interfaces:

    public class SoComplexity
    extends SoNode
    Shape complexity node. This node sets the current shape complexity value. This is a heuristic value which provides a hint at what geometric complexity to render shape nodes. Values range from 0 to 1, where 0 means minimum complexity and 1 means maximum complexity. Each shape node interprets complexity in its own way.

    Shape complexity (value field)

    Shape complexity always affects rendering and primitive generation for the SoCallbackAction. For some shapes, it also affects picking.

    There are three ways to interpret shape complexity, depending on the type field.

    • BOUNDING_BOX complexity ignores the value field and renders all shapes as bounding boxes. Each bounding box shape is drawn as if it were an SoCube and is subject to all of the drawing attributes of an SoCube (current material, drawing style, etc.) except that texturing is not applied. The other two types use the value field to determine the tessellation of shapes into polygons.
    • OBJECT_SPACE complexity (the default) uses value directly to determine the tessellation.
    • SCREEN_SPACE complexity depends on value and the projected size of the shape on the screen; a value of 0 produces the minimum tessellation for a shape, and a value of 1 produces a tessellation that is fine enough that each edge of a polygon is about 1 or two pixels in length. Since the projected size depends on the camera position, objects may be tessellated differently every frame if the camera is moving; note that this may have adverse effects on render caching in SoSeparator nodes.

    The following is a sampling of the effects of shape complexity.

    • Simple shapes (SoCone, SoCube, etc): controls number of faces generated.
    • Markers/Points (SoMarkerSet, SoPointSet, etc): controls the number of markers/points actually drawn.
    • Text (SoText3, etc): controls tesselation of glyph edges in renderStyle POLYGON.
      (Quality in renderStyle TEXTURE is controlled by textureQuality.)
    • NURBS (SoNurbsCurve, SoNurbsSurface, etc): controls tesselation of the curve/surface.
    • SoCircularExtrusion: controls decimation of the extruded geometry.
    • Volume rendering (SoVolumeRender): controls the number of times the volume is sampled along each ray when the numSlicesControl field is set to AUTOMATIC.
    • Height field rendering (SoHeightFieldRender): controls tesselation of the height field (how many triangles are generated for rendering).

    Texture quality

    The SoComplexity node also controls the quality of textures applied to shapes, based on the value of the textureQuality field.

    For texture nodes (SoTexture2, SoTextureCubeMap, etc), textureQuality controls the OpenGL minFilter, magFilter and mipmap settings that the hardware will use when applying the texture image to the geometry. With the default value (0.5) textures are not interpolated. We recommend using a higher value, e.g. 0.75, on modern graphics hardware.

    For text nodes (SoText2, SoText3, etc), when the SoFont renderStyle field is set to TEXTURE, the OpenGL settings controlled by textureQuality strongly affect the quality of the text rendering. With the default value (0.5) textures are not interpolated, so text may appear to not be anti-aliased. We recommend using a higher value, e.g. 0.75, on modern graphics hardware.

    In a few cases, e.g. SoImageBackground, setting textureQuality to zero disables rendering complexity.

    File format/default:

    Complexity {

      type OBJECT_SPACE
      value 0.5
      textureQuality 0.5
      bboxType BBOX_AABB

    Action behavior:

    SoGLRenderAction, SoCallbackAction, SoGetBoundingBoxAction, SoRayPickAction
    Sets the current complexity in the state. Sets: SoComplexityElement, SoComplexityTypeElement, SoTextureQualityElement

    See Also:
    SoShape, SoShapeHints, SoTexture2, SoInteractiveComplexity
    • Field Detail

      • type

        public final SoSFEnum<SoComplexity.Types> type
        How shape complexity is interpreted. . Default is OBJECT_SPACE. The default value can also be set using the environment variable OIV_COMPLEXITY_TYPE.
      • value

        public final SoSFFloat value
        Complexity value. Default is 0.5. The default value can also be set using the environment variable OIV_COMPLEXITY (0.0 to 1.0).
      • textureQuality

        public final SoSFFloat textureQuality
        Hint about texture quality. Default is 0.5. A value of 0 indicates that the fastest texturing should be used, while a value of 1 indicates that the best quality texturing should be used. The default value can also be set using the environment variable OIV_TEXTURE_QUALITY (0.0 to 1.0).

        For backward compatibility, the default value is 0.5. This value was chosen when texturing was an expensive (low performance) feature of graphics hardware. It produces relatively low quality texture rendering because no interpolation is done. On modern graphics hardware we recommend setting this to a higher value, e.g. 0.75.

        If the filter options are set explicitly in the SoTexture.minFilter and/or SoTexture.magFilter fields, this field has no effect.

        The table below shows the correspondence between Open Inventor texture quality and OpenGL texture filtering options.

          * minFilter value
          ** magFilter value
          *** Need Mipmaps
          <= 0.5 GL_NEAREST GL_NEAREST false ExtendedFormats or CompressedFormats
          <= 0.6 GL_LINEAR GL_NEAREST false ExtendedFormats or CompressedFormats
          <= 0.7 GL_NEAREST_MIPMAP_NEAREST GL_NEAREST true ExtendedFormats or CompressedFormats
          <= 0.8 GL_NEAREST_MIPMAP_LINEAR GL_LINEAR true InternalFormats or CompressedFormats
          <= 0.9 GL_LINEAR_MIPMAP_NEAREST GL_LINEAR true InternalFormats or CompressedFormats
          <= 1.0 GL_LINEAR_MIPMAP_LINEAR GL_LINEAR true InternalFormats or CompressedFormats

        * The minFilter value can be set explicitly using the SoTexture.minFilter field of classes derived from SoTexture.

        ** If quality < 0.75, magFilter = GL_NEAREST, otherwise magFilter = GL_LINEAR.
        The magFilter value can be set explicitly using the SoTexture.magFilter field of classes derived from SoTexture.

        *** Means that Open Inventor automatically generates mipmap textures. See the OpenGL Programming Guide for information on mipmap textures.

      • bboxType

        public final SoSFEnum<SoComplexity.BboxTypes> bboxType
        Bounding box type to use. . Default is BBOX_AABB. By default an Axis Aligned Bounding Box (AABB) is used. It is simpler and faster to compute but may not be a good approximation of the shape's actual volume. Using an Object Oriented Bounding box is more compute intensive, but can provide a tighter volume box allowing better performance for actions such as culling, picking and selection.

        Open Inventor 8.1

    • Constructor Detail

      • SoComplexity

        public SoComplexity()
        Creates a complexity node with default settings.