SOMATERIAL(3iv)

✨ SoMaterial ✨

okay bestie, gather round, because we're about to talk about SoMaterial(3IV) β€” the surface material definition node that's literally the glow-up station for all your 3D shapes πŸ’…βœ¨


🌸 INHERITS FROM 🌸

SoBase > SoFieldContainer > SoNode > SoMaterial

it's giving legacy, it's giving lineage, it's giving "my ancestors were iconic too" πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

#include <Inventor/nodes/SoMaterial.h>

Fields from class SoMaterial:

SoMFColor           ambientColor
SoMFColor           diffuseColor
SoMFColor           specularColor
SoMFColor           emissiveColor
SoMFFloat           shininess
SoMFFloat           transparency

Methods from class SoMaterial:

                     SoMaterial()
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 basically, this node is the main character of surface vibes. SoMaterial defines the current surface material properties for every shape that comes after it in the scene graph. it sets several components of the current material during traversal β€” no cap, it's just out here setting the mood for everything downstream πŸ¦‹

you can specify multiple values for the diffuseColor and transparency. different shapes interpret materials with multiple values differently, so it's not a one-size-fits-all situation, bestie. to actually bind materials to shapes, you use an SoMaterialBinding node β€” that's the matchmaker that pairs your materials with your geometry πŸ’˜


✨ FIELDS ✨

  • SoMFColor ambientColor β€” the ambient color of the surface. it's the base glow, the ambient lighting vibe, the "just existing" energy πŸŒ™
  • SoMFColor diffuseColor β€” the diffuse color(s) of the surface. this is the main character color, the one everyone sees under normal light πŸ’…
  • SoMFColor specularColor β€” the specular color of the surface. that's the shiny highlight color, the sparkle, the ✨gleam✨
  • SoMFColor emissiveColor β€” the emissive color of the surface. it's the glow-from-within color, like your shape is lit from the inside out πŸ”₯
  • SoMFFloat shininess β€” the shininess coefficient of the surface. values range from 0.0 for no shininess (a diffuse surface, aka matte, lowkey) to 1.0 for maximum shininess (a highly polished surface, aka highkey glowing like a diamond πŸ’Ž).
  • SoMFFloat transparency β€” the transparency value(s) of the surface. values range from 0.0 for opaque surfaces to 1.0 for completely transparent surfaces. okay so important detail: if the transparency type is SoGLRenderAction::SCREEN_DOOR then only the first transparency value will be used. with other transparency types, multiple transparencies will be used, if the SoMaterial node contains as many transparencies as diffuse colors. if there are not as many transparencies as diffuse colors, only the first transparency will be used. fr fr, that's the rule 🫢

🧚 METHODS 🧚

  • SoMaterial() β€” creates a material node with default settings. it's the blank canvas, the fresh start, the "not me starting a new project" moment πŸ™ˆ
  • static SoType getClassTypeId() β€” returns the type identifier for this class. it's like a birth certificate but for code πŸ‘‘

🌈 ACTION BEHAVIOR 🌈

SoGLRenderAction, SoCallbackAction

sets the ambient color, the diffuse color, the specular color, the emissive color, the shininess, and the transparency of the current material. that's it. that's the whole job. and it does it flawlessly every time πŸ’―


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

Material {
   ambientColor   0.2 0.2 0.2
   diffuseColor   0.8 0.8 0.8
   specularColor  0 0 0
   emissiveColor  0 0 0
   shininess      0.2
   transparency   0
}

look at those defaults, so clean, so iconic, so "I woke up like this" 🌸


πŸ‘‘ SEE ALSO πŸ‘‘

  • SoBaseColor
  • SoLightModel
  • SoMaterialBinding
  • SoPackedColor

and that's the whole page, bestie! this has been SoMaterial(3IV)() β€” brought to you by the Inventor crew, and yes, the manual name is literally SoMaterial(3IV)() because we keep it old school like that. now go make something shiny πŸ’œβœ¨