SOENVIRONMENT(3iv)

✨ SoEnvironment(3IV) ✨

okay bestie, sit down, we're talking about SoEnvironment(3IV) β€” the global environment node. it's giving main character energy for your whole scene's lighting mood. πŸŽ€


πŸ’– INHERITS FROM

SoBase > SoFieldContainer > SoNode > SoEnvironment

the family tree is real and it ate. 🌸


πŸ¦‹ SYNOPSIS

#include <Inventor/nodes/SoEnvironment.h>

     enum FogType {
          SoEnvironment::NONE   No fog
          SoEnvironment::HAZE   Linear increase in opacity with distance
          SoEnvironment::FOG    Exponential increase in opacity
          SoEnvironment::SMOKE  Exponential squared increase in opacity
     }

Fields from class SoEnvironment:

     SoSFFloat           ambientIntensity
     SoSFColor           ambientColor
     SoSFVec3f           attenuation
     SoSFEnum            fogType
     SoSFColor           fogColor
     SoSFFloat           fogVisibility

Methods from class SoEnvironment:

                         SoEnvironment()
     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? it's the one holding the global environmental attributes β€” ambient lighting, light attenuation, and fog. the whole vibe check for your scene, basically. πŸ’…

Ambient lighting is the amount of extra light impinging on each surface point when the lighting model is Phong β€” peek SoLightModel for that one, iykyk.

Light attenuation affects all subsequent lights in a scene (shoutout to SoLight). it's a quadratic function of distance from a light source to a surface point. the three coefficients live in the attenuation field. and no cap: attenuation works only for light sources with a fixed location, like point and spot lights. so don't come for me when your directional light doesn't get the memo. 😭

Fog has one of four types, and each one blends each surface point with the specified fog color. each type reads the visibility field as the distance at which fog totally obscures objects. a visibility value of 0 (the default) makes the SoEnvironment node set up fog so that the visibility is the distance to the far clipping plane of the current camera. iconic behavior honestly. ✨

note bestie: this node has effect only during rendering, and it does not inherit field values from other SoEnvironment nodes. so don't expect it to pick up gossip from its neighbors. 🫢

πŸŽ€ FIELDS

  • SoSFFloat ambientIntensity
  • SoSFColor ambientColor

intensity and RGB color of ambient lighting (for Phong lighting). the glow-up, literally.

  • SoSFVec3f attenuation

squared, linear, and constant light attenuation coefficients (in that order β€” do not shuffle them, it's not a playlist) with respect to distance of light from surface (for Phong lighting).

  • SoSFEnum fogType
  • SoSFColor fogColor
  • SoSFFloat fogVisibility

type of fog, color of fog, and visibility distance β€” which is the distance at which fog totally obscures objects. mystery mode activated. 🌫️


πŸ’… METHODS

  • SoEnvironment()

creates an environment node with default settings. blank canvas, fresh start, slay.

  • static SoType getClassTypeId()

returns type identifier for this class. it's the class's little name tag at the party. πŸ’–


πŸ”₯ ACTION BEHAVIOR

  • SoGLRenderAction

sets the current environment parameters to those specified with this node. successive geometries will be rendered using this environment. periodt.


⭐ FILE FORMAT/DEFAULTS

     Environment {
          ambientIntensity  0.2
          ambientColor      1 1 1
          attenuation       0 0 1
          fogType           NONE
          fogColor          1 1 1
          fogVisibility     0
     }

these are the defaults, bestie β€” fogType starts at NONE, so no fog until you say so. she's lowkey shy at first. πŸ™ˆ


🧚 SEE ALSO

SoLight, SoLightModel


and that's the whole page!! 🌟 the source/version line and the date at the bottom are literally just SoEnvironment(3IV)() β€” same as the title, no extra tea to spill. consider yourself fully caught up. mwah, go render something gorgeous. πŸ’œπŸ¦‹βœ¨