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

Physically based surface material definition node. More...

#include <Inventor/nodes/SoPhysicalMaterial.h>

+ Inheritance diagram for SoPhysicalMaterial:

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoPhysicalMaterial ()
 
virtual void setOverride (const SbBool state)
 Turns the override flag on or off.
 
virtual SbBool isOverride () const
 Returns the state of the override flag.
 
- 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

SoSFColorRGBA baseColor
 Base color of the surface.
 
SoSFFloat specular
 Specular coefficient of the surface.
 
SoSFFloat roughness
 Roughness coefficient of the surface.
 
SoSFFloat metallic
 Metallic coefficient of the surface.
 

Detailed Description

Physically based surface material definition node.

This node defines the current physically based surface material properties for all subsequent shapes. The baseColor, specular, roughness, and metallic fields are taken into account during the rendering when the SoLighModel::model field is set to SoLightModel::PHYSICALLY_BASED.

As described here, other property nodes can override the baseColor of this class.

If lighting is turned off (SoLightModel set to BASE_COLOR), only the baseColor color is used to render geometry.

Override material

To force all geometry following/below this node to use specific color and transparency values, call the setOverride() method with true. Overriding the base color overrides the color and transparency values in other nodes including SoPackedColor and SoVertexProperty. This can be useful, for example, to highlight a selected object.

It is also possible to override only a subset of the SoPhysicalMaterial fields. If, for example, you only want to override the base color, but not the other values, call setIgnored(true) on the fields that you do not want to override.

VolumeViz shapes

For scalar (non-RGBA) volumes, the color and alpha value of a voxel is affected by two nodes. SoPhysicalMaterial's baseColor field specifies the "base" color and alpha values for all voxels. SoTransferFunction specifies color and alpha values based on the voxel value. The final voxel color and alpha (before lighting and other effects) is computed by multiplying these two color and alpha values. The default material is (0.8, 0.8, 0.8, 1) (fully opaque gray). The 0.8 value for R, G and B allows lighting to increase the brightness of the voxel. For slice rendering without lighting, the application may want to set the material to 1, 1, 1, 1 so that only the SoTransferFunction affects the voxel color and alpha. Effectively the alpha value of baseColor (aka transparency) is a "global" multiplier that can increase or decrease the transparency of all voxels in the volume.

FILE FORMAT/DEFAULT

    PhysicalMaterial {
    baseColor 0.8 0.8 0.8 1
    specular 0
    roughness 0.8
    metallic 0
    }

ACTION BEHAVIOR

SEE ALSO

SoMaterial, SoBaseColor, SoLightModel, SoMaterialBinding, SoVertexProperty,

Definition at line 103 of file SoPhysicalMaterial.h.

Constructor & Destructor Documentation

◆ SoPhysicalMaterial()

SoPhysicalMaterial::SoPhysicalMaterial ( )

Member Function Documentation

◆ getClassTypeId()

static SoType SoPhysicalMaterial::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getTypeId()

virtual SoType SoPhysicalMaterial::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoNode.

◆ isOverride()

virtual SbBool SoPhysicalMaterial::isOverride ( ) const
inlinevirtual

Returns the state of the override flag.

Reimplemented from SoNode.

Definition at line 169 of file SoPhysicalMaterial.h.

◆ setOverride()

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

Turns the override flag on or off.



The following property nodes are affected by the override flag: SoBaseColor, SoColorIndex, SoComplexity, SoDepthBuffer, SoDrawStyle, SoEnvironment, SoFont, SoFullSceneAntialiasing, SoLightModel, SoMaterial, SoPhysicalMaterial, SoMaterialBinding, SoPackedColor, SoPattern, SoPickStyle, SoPolygonOffset, SoShapeHints, SoVertexProperty, SoTextProperty.

Every node has an override flag associated with it. The override flag is a powerful mechanism typically used (sparingly) near the top of a scene graph. When this flag is set, any nodes of the same type encountered later in the graph are ignored even if they also have their own override flag set. For example, you might insert a line-style SoDrawStyle node at the top of a graph to ensure that the whole scene is drawn as wireframe objects, regardless of drawing styles specified lower in the scene graph. Use the setOverride() method to set and reset the override flag. The isOverride() method returns the state of the override flag.

Normally, the override flag is not used within a scene graph for modeling. Use it in applications where you need to specify a temporary change to the whole graph.

Note: The override flag is not written to a file.

Setting the override flag on a node whose field values are not inherited (for example on a sphere with a radius of 7) has no effect on other nodes in the graph of that type.

Reimplemented from SoNode.

Definition at line 163 of file SoPhysicalMaterial.h.

Member Data Documentation

◆ baseColor

SoSFColorRGBA SoPhysicalMaterial::baseColor

Base color of the surface.

Default is 0.8 0.8 0.8 1.

In physically based models, the base color mainly controls the diffuse reflectance. Diffuse reflectance plays the most important role in determining the appearance of an object. It is affected by the color of the incident light(s) and the angle of each incident light relative to the object's normal direction. (It is most intense where the incident light falls perpendicular to the surface.)

As described here, this field is not the unique way to specify a base color in the scene graph.

Definition at line 122 of file SoPhysicalMaterial.h.

◆ metallic

SoSFFloat SoPhysicalMaterial::metallic

Metallic coefficient of the surface.

Values can range from 0.0 to 1.0. Default is 0.

This parameter controls the metallic appearance of a surface. Most of the time for pure metallic surfaces the parameter should be 1, and 0 for other surfaces. For hybrid surfaces (e.g. corroded metals) or for styling reasons, you can choose a value between 0 and 1.

Definition at line 158 of file SoPhysicalMaterial.h.

◆ roughness

SoSFFloat SoPhysicalMaterial::roughness

Roughness coefficient of the surface.

Values can range from 0.0 to 1.0. Default is 0.8.

The roughness defines the quantity of irregularity on a surface, from a perfectly smooth surface (roughness = 0) to highly irregular micro-structure (roughness = 1). This value affects the specular reflection from a mirror-like reflection (roughness = 0) to a scattered reflection (roughness = 1).

Definition at line 148 of file SoPhysicalMaterial.h.

◆ specular

SoSFFloat SoPhysicalMaterial::specular

Specular coefficient of the surface.

Values can range from 0.0 to 1.0. Default is 0.

Specular reflection from an object produces highlights. Unlike diffuse reflection, the amount of specular reflection depends on the location of the camera - it is brightest along the direct angle of reflection. To see this, imagine looking at a metallic ball outdoors in the sunlight. As you move your head, the highlight created by the sunlight moves with you to some extent. However, if you move your head too much, you lose the highlight entirely.

This field specifies the intensity of the reflected light. The roughness field controls the size of the highlight.

Definition at line 137 of file SoPhysicalMaterial.h.


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