class
Material
Material object that keeps material information used while rendering.
Properties
Property | Description |
BlendMode | Material blend mode specifies which type of blend function to use to blend materials. The blend mode function will be used while blending layers during material casting. |
MaterialEvaluationShader | The material evaluation shader. |
MaterialGUID | The unique id for this node. |
MaterialType | The material type, used to specify which shader should be used to render the material. |
Name | The name of the Material object. (Inherited from Object) |
OpacityChannel | The name of the channel in the material to be used for Opacity or Transparency. This material property is primarily used in the scene exporters to correctly export opacity, and does *not* determine which channel to use for opacity when casting materials. The channel to be used for opacity during casting is controlled by a setting on the MaterialCaster objects. |
OpacityCutoff | The cutoff value for opacity when using mask blend mode. |
OpacityType | The opacity type determines how the opacity channel of this material is interpreted when casting. To make (0.0->1.0) map to (transparent-opaque), use 'Opacity'. To make (0.0->1.0) map to (opaque-transparent), use 'Transparency' |
UseTangentSpaceNormals | The UseTangentSpaceNormals flag. If set, the normal map has tangent space normals. |
Methods
Method | Description |
AddMaterialChannel | Add a material channel. |
AddObserver | Adds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object) |
ChangeTexturePrefixPath | Changes the prefix path (drive, directory) of all matching texture paths in the material, with the new one. This method is useful when external textures are placed in a specific folder, which needs to be moved. |
ConvertHandedness | Converts parameters such as UVTiling and UVOffset in shading networks. |
GetClass | Get the name of the Material class. (Inherited from Object) |
GetMaterialChannelCount | Returns the number of material channels in the material. |
GetMaterialChannelFromIndex | Returns the name of a channel from the index. Note that by adding/removing channels the indices are changed, and this method should only be used for enumeration. |
GetMaterialChannels | Get all unique material channel names in the material. |
GetMaterialChannelsWithTextureInputs | Get all unique material channel names having texture inputs in the material. |
GetShadingNetwork | Get which shading network to use for the material channel. |
HasMaterialChannel | Check if the channel exists within the material. |
IsA | Returns true if Material is a or is a descendant of the class named as the type parameter. (Inherited from Object) |
IsIdenticalTo | Returns true if the material is setup identical to this material. |
IsNull | Returns true if the Material object is invalid. (Inherited from Object) |
IsSameObjectAs | Returns true if the Material object is valid. (Inherited from Object) |
IsTransparent | Returns true if the material *could* be transparent. In other words, returns true IF the BlendMode of the material is not set to opaque, AND there is a non-opaque shading network assigned to the opacity channel. This means materials set to BlendMode::Blend can still return false if they have an opacity channel set that is either empty, or constant and set to an opaque value. This can be used to split transparent and opaque materials before processing, or find materials marked as BlendMode::Blend that don't have to be. |
LoadShadingNetworkFromXML | Save shading network to XML. |
NonNull | Returns true if the Material object is valid. (Inherited from Object) |
PrintInfo | Prints the content/info of the Material object to the log. (Inherited from Object) |
RemoveMaterialChannel | Remove a material channel. |
RemoveObserver | Removes a previously added observer object. (Inherited from Object) |
SaveShadingNetworkToXML | Save shading network to XML. |
SetOpacityFromDiffuseAlpha | Maps the alpha component of the diffuse channel to all the RGBA components in the opacity channel (by using a swizzle node). |
SetShadingNetwork | Set which shading network to use for the material channel. |
Static methods
Method | Description |
IsClassA | Returns true if the class is a or is a descendant of the class named as the type parameter. (Inherited from Object) |
SafeCast | SafeCast makes sure the input object is of a class that can be cast into spMaterial, and if this is the case, returns the object cast into spMaterial. (Inherited from Object) |
Properties details
BlendMode
Material blend mode specifies which type of blend function to use to blend materials. The blend mode function will be used while blending layers during material casting.
Syntax
SetBlendMode parameters
Type | Name | Min | Max | Description |
EMaterialBlendMode | value | | | The blend mode function used while blending layers during material casting. |
GetBlendMode return value
Type: EMaterialBlendMode
Default: Standard
Key | Value | Comment |
Opaque | 0 | Treat the material as fully opaque. Any opacity channel will be ignored. |
Mask | 1 | Use the opacity channel as a mask. Opacity values equal or greater than the opacity cutoff will yield opaque pixels, and opacity values less than the opacity cutoff will yield fully transparent pixels. |
Blend | 2 | Opacity values will be used to perform an alpha blend, final_color = (source_color * alpha) + (destination_color * (1 - alpha)). |
Syntax
SetBlendMode parameters
Type | Name | Min | Max | Description |
EMaterialBlendMode | value | | | The blend mode function used while blending layers during material casting. |
GetBlendMode return value
Type: EMaterialBlendMode
Default: Standard
Key | Value | Comment |
Opaque | 0 | Treat the material as fully opaque. Any opacity channel will be ignored. |
Mask | 1 | Use the opacity channel as a mask. Opacity values equal or greater than the opacity cutoff will yield opaque pixels, and opacity values less than the opacity cutoff will yield fully transparent pixels. |
Blend | 2 | Opacity values will be used to perform an alpha blend, final_color = (source_color * alpha) + (destination_color * (1 - alpha)). |
Syntax
SetBlendMode parameters
Name | Type | Min | Max | Description |
value | EMaterialBlendMode | | | The blend mode function used while blending layers during material casting. |
GetBlendMode return value
Type: EMaterialBlendMode
Default: Standard
Key | Value | Comment |
EMaterialBlendMode_Opaque | 0 | Treat the material as fully opaque. Any opacity channel will be ignored. |
EMaterialBlendMode_Mask | 1 | Use the opacity channel as a mask. Opacity values equal or greater than the opacity cutoff will yield opaque pixels, and opacity values less than the opacity cutoff will yield fully transparent pixels. |
EMaterialBlendMode_Blend | 2 | Opacity values will be used to perform an alpha blend, final_color = (source_color * alpha) + (destination_color * (1 - alpha)). |
MaterialEvaluationShader
The material evaluation shader.
MaterialGUID
The unique id for this node.
Syntax
SetMaterialGUID parameters
Type | Name | Min | Max | Description |
const char * | value | | | The node id of type string. |
GetMaterialGUID return value
Type: spString
Syntax
SetMaterialGUID parameters
Type | Name | Min | Max | Description |
string | value | | | The node id of type string. |
GetMaterialGUID return value
Type: string
Syntax
SetMaterialGUID parameters
Name | Type | Min | Max | Description |
value | str | | | The node id of type string. |
GetMaterialGUID return value
Type: str
MaterialType
The material type, used to specify which shader should be used to render the material.
Syntax
SetMaterialType parameters
Type | Name | Min | Max | Description |
EMaterialType | value | | | The material type. One of the following: Standard -> Use the standard shader. Flipbook -> Use the flipbook shader. BillboardCloud -> Use the billboard cloud shader. |
GetMaterialType return value
Type: EMaterialType
Default: Standard
Key | Value | Comment |
Standard | 0 | Use the standard shader. |
Flipbook | 1 | Use the flipbook shader. |
BillboardCloud | 2 | Use the billboard cloud shader. |
Syntax
SetMaterialType parameters
Type | Name | Min | Max | Description |
EMaterialType | value | | | The material type. One of the following: Standard -> Use the standard shader. Flipbook -> Use the flipbook shader. BillboardCloud -> Use the billboard cloud shader. |
GetMaterialType return value
Type: EMaterialType
Default: Standard
Key | Value | Comment |
Standard | 0 | Use the standard shader. |
Flipbook | 1 | Use the flipbook shader. |
BillboardCloud | 2 | Use the billboard cloud shader. |
Syntax
SetMaterialType parameters
Name | Type | Min | Max | Description |
value | EMaterialType | | | The material type. One of the following: Standard -> Use the standard shader. Flipbook -> Use the flipbook shader. BillboardCloud -> Use the billboard cloud shader. |
GetMaterialType return value
Type: EMaterialType
Default: Standard
Key | Value | Comment |
EMaterialType_Standard | 0 | Use the standard shader. |
EMaterialType_Flipbook | 1 | Use the flipbook shader. |
EMaterialType_BillboardCloud | 2 | Use the billboard cloud shader. |
Name
The name of the Material object. (Inherited from Object)
Syntax
SetName parameters
Type | Name | Min | Max | Description |
const char * | name | | | New name of the object. |
GetName return value
Type: spString
Syntax
SetName parameters
Type | Name | Min | Max | Description |
string | name | | | New name of the object. |
GetName return value
Type: string
Syntax
SetName parameters
Name | Type | Min | Max | Description |
name | str | | | New name of the object. |
GetName return value
Type: str
OpacityChannel
The name of the channel in the material to be used for Opacity or Transparency. This material property is primarily used in the scene exporters to correctly export opacity, and does *not* determine which channel to use for opacity when casting materials. The channel to be used for opacity during casting is controlled by a setting on the MaterialCaster objects.
Syntax
SetOpacityChannel parameters
Type | Name | Min | Max | Description |
const char * | value | | | The desired material channel. |
GetOpacityChannel return value
Type: spString
Default: Opacity
Syntax
SetOpacityChannel parameters
Type | Name | Min | Max | Description |
string | value | | | The desired material channel. |
GetOpacityChannel return value
Type: string
Default: Opacity
Syntax
SetOpacityChannel parameters
Name | Type | Min | Max | Description |
value | str | | | The desired material channel. |
GetOpacityChannel return value
Type: str
Default: Opacity
OpacityCutoff
The cutoff value for opacity when using mask blend mode.
Syntax
SetOpacityCutoff parameters
Type | Name | Min | Max | Description |
real | value | | | The opacity cutoff value. |
GetOpacityCutoff return value
Type: real
Syntax
SetOpacityCutoff parameters
Type | Name | Min | Max | Description |
float | value | | | The opacity cutoff value. |
GetOpacityCutoff return value
Type: float
Syntax
SetOpacityCutoff parameters
Name | Type | Min | Max | Description |
value | float | | | The opacity cutoff value. |
GetOpacityCutoff return value
Type: float
OpacityType
The opacity type determines how the opacity channel of this material is interpreted when casting. To make (0.0->1.0) map to (transparent-opaque), use 'Opacity'. To make (0.0->1.0) map to (opaque-transparent), use 'Transparency'
Syntax
SetOpacityType parameters
Type | Name | Min | Max | Description |
EOpacityType | value | | | The new opacity type. |
GetOpacityType return value
Type: EOpacityType
Default: Opacity
Key | Value | Comment |
Opacity | 0 | The level of transparency is defined from 0.0->1.0, where 0.0 is fully transparent and 1.0 is fully opaque. |
Transparency | 1 | The level of transparency is defined from 1.0->0.0, where 1.0 is fully transparent and 0.0 is fully opaque. |
Syntax
SetOpacityType parameters
Type | Name | Min | Max | Description |
EOpacityType | value | | | The new opacity type. |
GetOpacityType return value
Type: EOpacityType
Default: Opacity
Key | Value | Comment |
Opacity | 0 | The level of transparency is defined from 0.0->1.0, where 0.0 is fully transparent and 1.0 is fully opaque. |
Transparency | 1 | The level of transparency is defined from 1.0->0.0, where 1.0 is fully transparent and 0.0 is fully opaque. |
Syntax
SetOpacityType parameters
Name | Type | Min | Max | Description |
value | EOpacityType | | | The new opacity type. |
GetOpacityType return value
Type: EOpacityType
Default: Opacity
Key | Value | Comment |
EOpacityType_Opacity | 0 | The level of transparency is defined from 0.0->1.0, where 0.0 is fully transparent and 1.0 is fully opaque. |
EOpacityType_Transparency | 1 | The level of transparency is defined from 1.0->0.0, where 1.0 is fully transparent and 0.0 is fully opaque. |
UseTangentSpaceNormals
The UseTangentSpaceNormals flag. If set, the normal map has tangent space normals.
Syntax
SetUseTangentSpaceNormals parameters
Type | Name | Min | Max | Description |
bool | value | | | The desired flag value. |
GetUseTangentSpaceNormals return value
Type: bool
Syntax
SetUseTangentSpaceNormals parameters
Type | Name | Min | Max | Description |
bool | value | | | The desired flag value. |
GetUseTangentSpaceNormals return value
Type: bool
Syntax
SetUseTangentSpaceNormals parameters
Name | Type | Min | Max | Description |
value | bool | | | The desired flag value. |
GetUseTangentSpaceNormals return value
Type: bool
Methods details
AddMaterialChannel
Add a material channel.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | channelName | | | The name of the material channel. |
Syntax
Parameters
Type | Name | Min | Max | Description |
string | channelName | | | The name of the material channel. |
Syntax
Parameters
Name | Type | Min | Max | Description |
channelName | str | | | The name of the material channel. |
AddObserver
Adds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object)
Syntax
Parameters
Type | Name | Min | Max | Description |
Observer | observer | | | Observer is the object that will receive events. |
Return value
Type: rid
Syntax
Parameters
Type | Name | Min | Max | Description |
Observer | observer | | | Observer is the object that will receive events. |
Return value
Type: int
Syntax
Parameters
Name | Type | Min | Max | Description |
observer | Observer | | | Observer is the object that will receive events. |
Return value
Type: int
ChangeTexturePrefixPath
Changes the prefix path (drive, directory) of all matching texture paths in the material, with the new one. This method is useful when external textures are placed in a specific folder, which needs to be moved.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | currentPathPrefix | | | The current prefix path, either relative or absolute. |
const char * | newPathPrefix | | | The new prefix path. |
Syntax
Parameters
Type | Name | Min | Max | Description |
string | currentPathPrefix | | | The current prefix path, either relative or absolute. |
string | newPathPrefix | | | The new prefix path. |
Syntax
Parameters
Name | Type | Min | Max | Description |
currentPathPrefix | str | | | The current prefix path, either relative or absolute. |
newPathPrefix | str | | | The new prefix path. |
ConvertHandedness
Converts parameters such as UVTiling and UVOffset in shading networks.
Syntax
Parameters
ConvertHandedness takes no parameters.
Syntax
Parameters
ConvertHandedness takes no parameters.
Syntax
Parameters
ConvertHandedness takes no parameters.
GetClass
Get the name of the Material class. (Inherited from Object)
Syntax
Parameters
GetClass takes no parameters.
Return value
Type: spString
Syntax
Parameters
GetClass takes no parameters.
Return value
Type: string
Syntax
Parameters
GetClass takes no parameters.
Return value
Type: str
GetMaterialChannelCount
Returns the number of material channels in the material.
Syntax
Parameters
GetMaterialChannelCount takes no parameters.
Return value
Type: unsigned int
Syntax
Parameters
GetMaterialChannelCount takes no parameters.
Return value
Type: uint
Syntax
Parameters
GetMaterialChannelCount takes no parameters.
Return value
Type: int
GetMaterialChannelFromIndex
Returns the name of a channel from the index. Note that by adding/removing channels the indices are changed, and this method should only be used for enumeration.
Syntax
Parameters
Type | Name | Min | Max | Description |
rid | index | | | The index to the channel to be fetched. |
Return value
Type: spString
Syntax
Parameters
Type | Name | Min | Max | Description |
int | index | | | The index to the channel to be fetched. |
Return value
Type: string
Syntax
Parameters
Name | Type | Min | Max | Description |
index | int | | | The index to the channel to be fetched. |
Return value
Type: str
GetMaterialChannels
Get all unique material channel names in the material.
Syntax
Parameters
Type | Name | Min | Max | Description |
StringArray | channels | | | The array receiving unique channel names. |
Syntax
Parameters
Type | Name | Min | Max | Description |
StringArray | channels | | | The array receiving unique channel names. |
Syntax
Parameters
Name | Type | Min | Max | Description |
channels | StringArray | | | The array receiving unique channel names. |
GetMaterialChannelsWithTextureInputs
Get all unique material channel names having texture inputs in the material.
Syntax
Parameters
Type | Name | Min | Max | Description |
StringArray | channels | | | The array receiving unique channel names. |
Syntax
Parameters
Type | Name | Min | Max | Description |
StringArray | channels | | | The array receiving unique channel names. |
Syntax
Parameters
Name | Type | Min | Max | Description |
channels | StringArray | | | The array receiving unique channel names. |
GetShadingNetwork
Get which shading network to use for the material channel.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | channelName | | | The name of the channel. |
Return value
Type: ShadingNode
Syntax
Parameters
Type | Name | Min | Max | Description |
string | channelName | | | The name of the channel. |
Return value
Type: ShadingNode
Syntax
Parameters
Name | Type | Min | Max | Description |
channelName | str | | | The name of the channel. |
Return value
Type: ShadingNode
HasMaterialChannel
Check if the channel exists within the material.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | channelName | | | The name of the material channel. |
Return value
Type: bool
Syntax
Parameters
Type | Name | Min | Max | Description |
string | channelName | | | The name of the material channel. |
Return value
Type: bool
Syntax
Parameters
Name | Type | Min | Max | Description |
channelName | str | | | The name of the material channel. |
Return value
Type: bool
IsA
Returns true if Material is a or is a descendant of the class named as the type parameter. (Inherited from Object)
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | type | | | Name of the class to check if Material is, or is a descendant of. |
Return value
Type: bool
Syntax
Parameters
Type | Name | Min | Max | Description |
string | type | | | Name of the class to check if Material is, or is a descendant of. |
Return value
Type: bool
Syntax
Parameters
Name | Type | Min | Max | Description |
type | str | | | Name of the class to check if Material is, or is a descendant of. |
Return value
Type: bool
IsIdenticalTo
Returns true if the material is setup identical to this material.
Syntax
Parameters
Type | Name | Min | Max | Description |
Material | mat | | | The material to compare to. |
Return value
Type: bool
Syntax
Parameters
Type | Name | Min | Max | Description |
Material | mat | | | The material to compare to. |
Return value
Type: bool
Syntax
Parameters
Name | Type | Min | Max | Description |
mat | Material | | | The material to compare to. |
Return value
Type: bool
IsNull
Returns true if the Material object is invalid. (Inherited from Object)
Syntax
Parameters
IsNull takes no parameters.
Return value
Type: bool
Syntax
Parameters
IsNull takes no parameters.
Return value
Type: bool
Syntax
Parameters
IsNull takes no parameters.
Return value
Type: bool
IsSameObjectAs
Returns true if the Material object is valid. (Inherited from Object)
Syntax
Parameters
Type | Name | Min | Max | Description |
Object | object | | | Object to compare with. |
Return value
Type: bool
Syntax
Parameters
Type | Name | Min | Max | Description |
Object | object | | | Object to compare with. |
Return value
Type: bool
Syntax
Parameters
Name | Type | Min | Max | Description |
object | Object | | | Object to compare with. |
Return value
Type: bool
IsTransparent
Returns true if the material *could* be transparent. In other words, returns true IF the BlendMode of the material is not set to opaque, AND there is a non-opaque shading network assigned to the opacity channel. This means materials set to BlendMode::Blend can still return false if they have an opacity channel set that is either empty, or constant and set to an opaque value. This can be used to split transparent and opaque materials before processing, or find materials marked as BlendMode::Blend that don't have to be.
Syntax
Parameters
IsTransparent takes no parameters.
Return value
Type: bool
Syntax
Parameters
IsTransparent takes no parameters.
Return value
Type: bool
Syntax
Parameters
IsTransparent takes no parameters.
Return value
Type: bool
LoadShadingNetworkFromXML
Save shading network to XML.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | channelName | | | The name of the channel. |
const char * | inXml | | | The xml descriping the shading node graph. |
Syntax
Parameters
Type | Name | Min | Max | Description |
string | channelName | | | The name of the channel. |
string | inXml | | | The xml descriping the shading node graph. |
Syntax
Parameters
Name | Type | Min | Max | Description |
channelName | str | | | The name of the channel. |
inXml | str | | | The xml descriping the shading node graph. |
NonNull
Returns true if the Material object is valid. (Inherited from Object)
Syntax
Parameters
NonNull takes no parameters.
Return value
Type: bool
Syntax
Parameters
NonNull takes no parameters.
Return value
Type: bool
Syntax
Parameters
NonNull takes no parameters.
Return value
Type: bool
PrintInfo
Prints the content/info of the Material object to the log. (Inherited from Object)
Syntax
Parameters
PrintInfo takes no parameters.
Syntax
Parameters
PrintInfo takes no parameters.
Syntax
Parameters
PrintInfo takes no parameters.
RemoveMaterialChannel
Remove a material channel.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | channelName | | | The name of the material channel. |
Syntax
Parameters
Type | Name | Min | Max | Description |
string | channelName | | | The name of the material channel. |
Syntax
Parameters
Name | Type | Min | Max | Description |
channelName | str | | | The name of the material channel. |
RemoveObserver
Removes a previously added observer object. (Inherited from Object)
Syntax
Parameters
Type | Name | Min | Max | Description |
rid | observerId | | | ObserverId is the id returned by AddObserver when the observer was added. |
Syntax
Parameters
Type | Name | Min | Max | Description |
int | observerId | | | ObserverId is the id returned by AddObserver when the observer was added. |
Syntax
Parameters
Name | Type | Min | Max | Description |
observerId | int | | | ObserverId is the id returned by AddObserver when the observer was added. |
SaveShadingNetworkToXML
Save shading network to XML.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | channelName | | | The name of the channel. |
Return value
Type: spString
Syntax
Parameters
Type | Name | Min | Max | Description |
string | channelName | | | The name of the channel. |
Return value
Type: string
Syntax
Parameters
Name | Type | Min | Max | Description |
channelName | str | | | The name of the channel. |
Return value
Type: str
SetOpacityFromDiffuseAlpha
Maps the alpha component of the diffuse channel to all the RGBA components in the opacity channel (by using a swizzle node).
Syntax
Parameters
SetOpacityFromDiffuseAlpha takes no parameters.
Syntax
Parameters
SetOpacityFromDiffuseAlpha takes no parameters.
Syntax
Parameters
SetOpacityFromDiffuseAlpha takes no parameters.
SetShadingNetwork
Set which shading network to use for the material channel.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | channelName | | | The name of the new channel. |
ShadingNode | node | | | The shading network exit node. |
Syntax
Parameters
Type | Name | Min | Max | Description |
string | channelName | | | The name of the new channel. |
ShadingNode | node | | | The shading network exit node. |
Syntax
Parameters
Name | Type | Min | Max | Description |
channelName | str | | | The name of the new channel. |
node | ShadingNode | | | The shading network exit node. |
Static methods details
IsClassA
Returns true if the class is a or is a descendant of the class named as the type parameter. (Inherited from Object)
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | type | | | Name of the class to check if the class is, or is a descendant of. |
Return value
Type: bool
Syntax
Parameters
Type | Name | Min | Max | Description |
string | type | | | Name of the class to check if the class is, or is a descendant of. |
Return value
Type: bool
Syntax
Parameters
Name | Type | Min | Max | Description |
type | str | | | Name of the class to check if the class is, or is a descendant of. |
Return value
Type: bool
SafeCast
SafeCast makes sure the input object is of a class that can be cast into spMaterial, and if this is the case, returns the object cast into spMaterial. (Inherited from Object)
Syntax
Parameters
Type | Name | Min | Max | Description |
Object | object | | | Object to cast. |
Return value
Type: Material
Syntax
Parameters
Type | Name | Min | Max | Description |
Object | object | | | Object to cast. |
Return value
Type: Material
Syntax
Parameters
Name | Type | Min | Max | Description |
object | Object | | | Object to cast. |
Return value
Type: Material