Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoEnvironment Class Reference

Global environment node. More...

#include <Inventor/nodes/SoEnvironment.h>

+ Inheritance diagram for SoEnvironment:

Public Types

enum  FogType {
  NONE ,
  HAZE ,
  FOG ,
  SMOKE
}
 Type of fog. More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoEnvironment ()
 Creates an environment node with default settings.
 
virtual void setOverride (const SbBool state)
 Sets the state of the overridden field.
 
virtual SbBool isOverride () const
 Returns the state of the overridden field.
 
- Public Member Functions inherited from SoNode
virtual SoNodecopy (SbBool copyConnections=FALSE) const
 Creates and returns an exact copy of the node.
 
virtual SbBool affectsState () const
 Returns TRUE if a node has an effect on the state during traversal.
 
virtual void touch ()
 Marks an instance as modified, simulating a change to it.
 
- Public Member Functions inherited from SoFieldContainer
void setToDefaults ()
 Sets all fields in this object to their default values.
 
SbBool hasDefaultValues () const
 Returns TRUE if all of the object's fields have their default values.
 
SbBool fieldsAreEqual (const SoFieldContainer *fc) const
 Returns TRUE if this object's fields are exactly equal to fc's fields.
 
void copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE)
 Copies the contents of fc's fields into this object's fields.
 
SoNONUNICODE SbBool set (const char *fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
SbBool set (const SbString &fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
void get (SbString &fieldDataString)
 Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.
 
virtual int getFields (SoFieldList &list) const
 Appends references to all of this object's fields to resultList, and returns the number of fields appended.
 
virtual int getAllFields (SoFieldList &list) const
 Returns a list of fields, including the eventIn's and eventOut's.
 
virtual SoFieldgetField (const SbName &fieldName) const
 Returns a the field of this object whose name is fieldName.
 
virtual SoFieldgetEventIn (const SbName &fieldName) const
 Returns a the eventIn with the given name.
 
virtual SoFieldgetEventOut (const SbName &fieldName) const
 Returns the eventOut with the given name.
 
SbBool getFieldName (const SoField *field, SbName &fieldName) const
 Returns the name of the given field in the fieldName argument.
 
SbBool enableNotify (SbBool flag)
 Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).
 
SbBool isNotifyEnabled () const
 Notification is the process of telling interested objects that this object has changed.
 
virtual void setUserData (void *data)
 Sets application data.
 
void * getUserData (void) const
 Gets user application data.
 
- Public Member Functions inherited from SoBase
virtual SbName getName () const
 Returns the name of an instance.
 
virtual void setName (const SbName &name)
 Sets the name of an instance.
 
void setSynchronizable (const bool b)
 Sets this to be a ScaleViz synchronizable object.
 
bool isSynchronizable () const
 Gets the ScaleViz synchronizable state of this object.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoNode
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static SoNodegetByName (const SbName &name)
 A node's name can be set using SoBase::setName().
 
static int getByName (const SbName &name, SoNodeList &list)
 A node's name can be set using SoBase::setName().
 
- Static Public Member Functions inherited from SoFieldContainer
static SoType getClassTypeId ()
 Returns the type of this class.
 
- Static Public Member Functions inherited from SoBase
static SoType getClassTypeId ()
 Returns type identifier for this class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Public Attributes

SoSFFloat ambientIntensity
 Intensity of ambient light (for Phong lighting).
 
SoSFColor ambientColor
 RGB color of ambient lighting (for Phong lighting).
 
SoSFVec3f attenuation
 Squared, linear, and constant light attenuation coefficients (in that order).
 
SoSFBool ambientOcclusion
 If set to TRUE, ambient occlusion is activated.
 
SoSFFloat ambientOcclusionIntensity
 Intensity of ambient occlusion: the higher the value, the darker the scene.
 
SoSFFloat ambientOcclusionRadius
 Specifies the radius of the "sphere" (in world space) beyond which the ambient occlusion has no more effect.
 
SoSFEnum fogType
 Type of fog.
 
SoSFColor fogColor
 Fog color.
 
SoSFFloat fogStart
 Distance at which the linear fog HAZE starts to be applied.
 
SoSFFloat fogVisibility
 Fog visibility distance, which is the distance at which fog totally obscures objects.
 

Detailed Description

Global environment node.

This node describes global environmental attributes such as ambient lighting, light attenuation, ambient occlusion and fog.

Ambient light (ambientIntensity and ambientColor) is the amount of global light impinging on each surface point when the lighting model is Phong (see SoLightModel). The ambient light values effectively specify a minimum brightness for all shapes. Even if no light source is directly shining on a surface, the ambient component will light up the surface a little bit to prevent it from being pure black.

Light attenuation (attenuation) is the loss of light intensity over distance. The greater the distance from the light source, the lower the intensity. Attenuation affects all subsequent Point and Spot lights in a scene (see SoLight). See attenuation field for more details.

Ambient occlusion (ambientOcclusion) is a rendering effect that simulates how much of the global ambient light can reach different parts of a shape. Parts that are less exposed to the ambient light, i.e. more occluded, will appear darker. This effect is very useful to better discern the shapes of objects. The ambientOcclusion field controls this effect for shape nodes other than SoVolumeRendering and point sets. (although point sets can "generate" ambient occlusion). SoVolumeRendering also supports ambient occlusion, but it must be enabled using an SoVolumeRenderingQuality node.
Ambient occlusion limitations:

  • Important performance penalty can be experienced on Intel HD and UHD Graphics integrated GPU

No Ambient Occlusion Ambient Occlusion

Example with a lineset extracted from a DTI

Fog has one of four types, each of which blends each surface point with the specified fog color (usually set equal to the rendering window background color). Each type interprets the fogVisibility field to be the distance at which fog totally obscures objects. A fogVisibility value of 0 (the default) causes the SoEnvironment node to set up fog so that the visibility is the distance to the far clipping plane of the current camera. Using a fog of type HAZE results in a linear fog between the fogStart value and the fogVisibility value.

FILE FORMAT/DEFAULT

    Environment {
    ambientIntensity 0.2
    ambientColor 1 1 1
    attenuation 0 0 1
    ambientOcclusion FALSE
    ambientOcclusionIntensity 1.0
    ambientOcclusionRadius 4.0
    fogType NONE
    fogColor 1 1 1
    fogStart 0
    fogVisibility 0
    }

ACTION BEHAVIOR

SEE ALSO

SoLight, SoLightModel

Definition at line 163 of file SoEnvironment.h.

Member Enumeration Documentation

◆ FogType

Type of fog.

Enumerator
NONE 

No fog.

HAZE 

Linear increase in opacity with distance.

FOG 

Exponential increase in opacity.

SMOKE 

Exponential squared increase in opacity.

Definition at line 169 of file SoEnvironment.h.

Constructor & Destructor Documentation

◆ SoEnvironment()

SoEnvironment::SoEnvironment ( )

Creates an environment node with default settings.

Member Function Documentation

◆ getClassTypeId()

static SoType SoEnvironment::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getTypeId()

virtual SoType SoEnvironment::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoNode.

◆ isOverride()

virtual SbBool SoEnvironment::isOverride ( ) const
inlinevirtual

Returns the state of the overridden field.

Reimplemented from SoNode.

Definition at line 290 of file SoEnvironment.h.

◆ setOverride()

virtual void SoEnvironment::setOverride ( const SbBool  state)
inlinevirtual

Sets the state of the overridden field.

see SoNode::setOverride doc.

Reimplemented from SoNode.

Definition at line 284 of file SoEnvironment.h.

Member Data Documentation

◆ ambientColor

SoSFColor SoEnvironment::ambientColor

RGB color of ambient lighting (for Phong lighting).

Default is 1, 1, 1.

Definition at line 199 of file SoEnvironment.h.

◆ ambientIntensity

SoSFFloat SoEnvironment::ambientIntensity

Intensity of ambient light (for Phong lighting).

Default is 0.2.

Definition at line 194 of file SoEnvironment.h.

◆ ambientOcclusion

SoSFBool SoEnvironment::ambientOcclusion

If set to TRUE, ambient occlusion is activated.

Default is FALSE

Limitation:

  • Important performance penalty can be experienced on Intel HD and UHD Graphics integrated GPU

NOTE: field available since Open Inventor 10.2

Definition at line 223 of file SoEnvironment.h.

◆ ambientOcclusionIntensity

SoSFFloat SoEnvironment::ambientOcclusionIntensity

Intensity of ambient occlusion: the higher the value, the darker the scene.

Default is 1.0.

Note: This field is "global", which means that if you have multiple instances of SoEnvironment node, any change in the intensity field of one instance will automatically be applied to the intensity field of the other instances. As a result, the intensity of the ambient occlusion is the same for the whole scene

NOTE: field available since Open Inventor 10.10

Definition at line 236 of file SoEnvironment.h.

◆ ambientOcclusionRadius

SoSFFloat SoEnvironment::ambientOcclusionRadius

Specifies the radius of the "sphere" (in world space) beyond which the ambient occlusion has no more effect.

Default is 4.0.

Note: This field is "global", which means that if you have multiple instances of SoEnvironment node, any change in the radius field of one instance will automatically be applied to the radius field of the other instances. As a result, the radius of the ambient occlusion is the same for the whole scene.

NOTE: field available since Open Inventor 10.10

Definition at line 249 of file SoEnvironment.h.

◆ attenuation

SoSFVec3f SoEnvironment::attenuation

Squared, linear, and constant light attenuation coefficients (in that order).

Default is 0, 0, 1. So, by default, no attenuation is applied.

Attenuation only applies to Point and Spot lights. In the physical world attenuation is proportional to 1/d^2, where 'd' is the distance from the surface to the light source. However, this function causes the light to decrease very rapidly, so linear and constant coefficients can also be specified. The attenuation factor applied to the light is 1 / (c0*d^2 + c1*d + c2).

Definition at line 211 of file SoEnvironment.h.

◆ fogColor

SoSFColor SoEnvironment::fogColor

Fog color.

Default is 1, 1, 1.

Definition at line 259 of file SoEnvironment.h.

◆ fogStart

SoSFFloat SoEnvironment::fogStart

Distance at which the linear fog HAZE starts to be applied.

Default is 0. Between fogStart and fogVisibility, the HAZE fog is linear, and beyond the fogVisibility distance, the fog totally obscures objects. This field has no effect on other types of fog.

Definition at line 266 of file SoEnvironment.h.

◆ fogType

SoSFEnum SoEnvironment::fogType

Type of fog.

Use enum FogType. Default is NONE.

Definition at line 255 of file SoEnvironment.h.

◆ fogVisibility

SoSFFloat SoEnvironment::fogVisibility

Fog visibility distance, which is the distance at which fog totally obscures objects.

Default is 0. A value of 0 (the default) causes the SoEnvironment node to set up fog so that the visibility is the distance to the far clipping plane of the current camera.

Definition at line 273 of file SoEnvironment.h.


The documentation for this class was generated from the following file: