SOCOMPLEXITY(3iv)

πŸ’– SoComplexity(3IV) πŸ’–

okay bestie, pull up a chair, we're diving into SoComplexity from the 3IV manual β€” the shape complexity node, and she is lowkey the main character of your scene graph's tessellation budget ✨


🌸 NAME 🌸

SoComplexity β€” shape complexity node. that's it, that's the vibe πŸŽ€


πŸ¦‹ INHERITS FROM πŸ¦‹

SoBase > SoFieldContainer > SoNode > SoComplexity

she got the whole ancestry chain, generational excellence fr fr πŸ‘‘


✨ SYNOPSIS ✨

#include <Inventor/nodes/SoComplexity.h>
enum Type {
     SoComplexity::SCREEN_SPACE  Set complexity based on screen size
     SoComplexity::OBJECT_SPACE  Set complexity independent of screen size
     SoComplexity::BOUNDING_BOX  Draw all shapes as bounding boxes
}

Fields from class SoComplexity:

SoSFEnum            type
SoSFFloat           value
SoSFFloat           textureQuality

Methods from class SoComplexity:

                    SoComplexity()
static SoType       getClassTypeId()

Methods from class SoNode:

void                setOverride(SbBool state)
SbBool              isOverride() const
SoNode *            copy(SbBool copyConnections = FALSE) const
virtual SbBool      affectsState() const
static SoNode *     getByName(const SbName &name)
static int          getByName(const SbName &name, SoNodeList &list)

Methods from class SoFieldContainer:

void                setToDefaults()
SbBool              hasDefaultValues() const
SbBool              fieldsAreEqual(const SoFieldContainer *fc) const
void                copyFieldValues(const SoFieldContainer *fc, SbBool
                         copyConnections = FALSE)
SbBool              set(const char *fieldDataString)
void                get(SbString &fieldDataString)
virtual int         getFields(SoFieldList &resultList) const
virtual SoField *   getField(const SbName &fieldName) const
SbBool              getFieldName(const SoField *field, SbName &fieldName)
                         const
SbBool              isNotifyEnabled() const
SbBool              enableNotify(SbBool flag)

Methods from class SoBase:

void                ref()
void                unref() const
void                unrefNoDelete() const
void                touch()
virtual SoType      getTypeId() const
SbBool              isOfType(SoType type) const
virtual void        setName(const SbName &name)
virtual SbName      getName() const

πŸ’… DESCRIPTION πŸ’…

So this node sets the current shape complexity value. And ngl, it's a heuristic value β€” meaning it's a hint, a little suggestion, a whisper to your shape nodes about how much geometric complexity to render with 🫢. Values range from 0 to 1, where 0 means minimum complexity and 1 means maximum complexity. And the way each shape node interprets complexity? entirely its own business. every shape is on its own journey, periodt.

Shape complexity always affects rendering and primitive generation for the SoCallbackAction. And 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 entirely and renders all shapes as bounding boxes, using the current material, drawing style, etc.
  • The other two types use the value field to determine the tessellation of shapes into polygons:
    • OBJECT_SPACE complexity 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.
😭 and here's the thing bestie β€” since the projected size depends on the camera position, objects may be tessellated differently every frame if the camera is moving. and that may have adverse effects on render caching in SoSeparator nodes. so like… know that going in πŸ’€

The SoComplexity node also sets a hint for the quality of textures applied to shapes, based on the value of the textureQuality field. And this one's got timing, okay β€” the texture quality will take effect at the next Texture2 node; Texture2 nodes previously traversed will not be affected. so order matters, iykyk ✨


πŸŽ€ FIELDS πŸŽ€

  • SoSFEnum type β€” how shape complexity is interpreted.
  • SoSFFloat value β€” complexity value.
  • SoSFFloat textureQuality β€” hint about texture quality. 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.

🌈 METHODS 🌈

  • SoComplexity() β€” creates a complexity node with default settings. baby's first complexity node 🍼
  • static SoType getClassTypeId() β€” returns type identifier for this class.

πŸ”₯ ACTION BEHAVIOR πŸ”₯

SoGLRenderAction, SoCallbackAction, SoGetBoundingBoxAction, SoRayPickAction

  • sets the current complexity in the state. that's the whole job and she does it flawlessly πŸ’…

πŸ“ FILE FORMAT/DEFAULTS πŸ“

Complexity {
     type            OBJECT_SPACE
     value           0.5
     textureQuality  0.5
}

look at those defaults. OBJECT_SPACE, 0.5, 0.5. perfectly balanced, as all things should be ⭐


🧚 SEE ALSO 🧚

SoShape, SoShapeHints, SoTexture2


and that's the page!! footer says SoComplexity(3IV)() β€” that's the source/version-and-date stamp at the bottom, so consider this your official sign-off bestie 🫢 go forth and tessellate responsibly πŸ’–βœ¨πŸŽ€