Material

consoledoc.h

A material in Torque 3D is a data structure that describes a surface.

More...

Behavioral

bool

Whether to show player footprint decals on this material.

bool

Whether to emit dust particles from a shape moving over the material. This is, for example, used by vehicles or players to decide whether to show dust trails.

LinearColorF

If showDust is true, this is the set of colors to use for the ParticleData of the dust emitter.

int

What sound to play from the PlayerData sound list when the player walks over the material. -1 (default) to not play any sound.

The sound to play when the player walks over the material. If this is set, it overrides footstepSoundId. This field is useful for directly assigning custom footstep sounds to materials without having to rely on the PlayerData sound assignment.

int

What sound to play from the PlayerData sound list when the player impacts on the surface with a velocity equal or greater than PlayerData::groundImpactMinSpeed.

int

What FX to play from the PlayerData sound list when the player impacts on the surface with a velocity equal or greater than PlayerData::groundImpactMinSpeed.

The sound to play when the player impacts on the surface with a velocity equal or greater than PlayerData::groundImpactMinSpeed. If this is set, it overrides impactSoundId. This field is useful for directly assigning custom impact sounds to materials without having to rely on the PlayerData sound assignment.

Public Attributes

float

The coverage ratio of the accu map texture. Use this to make the entire shape pick up some of the accu map texture or none at all.

float

The direction of the accumulation. Chose whether you want the accu map to go from top to bottom (ie. snow) or upwards (ie. mold).

bool

Accumulation texture.

float

The scale that is applied to the accu map texture. You can use this to fit the texture to smaller or larger objects.

float

Changes specularity to this value where the accumulated material is present.

float

The strength of the accu map. This changes the transparency of the accu map texture. Make it subtle or add more contrast.

int

The alpha reference value for alpha testing. Must be between 0 to 255.

bool

Enables alpha test when rendering the material.

The types of animation to play on this material.

float
AOChan [4]

The input channel AO maps use.

filename
AOMap [4]
assetIdString

ðŒE

filename
baseTex [4]

For backwards compatibility.

bool
filename
bumpTex [4]

For backwards compatibility.

bool

If set to false the lighting system will not cast shadows from this material.

Point2I
Point2I
int
LinearColorF

For backwards compatibility.

string

The name of a CubemapData for environment mapping.

filename

ðŒE

assetIdString

ðŒE

filename

ðŒE

assetIdString
float

Used to scale the strength of the detail normal map when blended with the base normal map.

Point2F

The scale factor for the detail map.

filename

For backwards compatibility.

LinearColorF

This color is multiplied against the diffuse texture color. If no diffuse texture is present this is the material color.

filename

ðŒE

assetIdString

ðŒE

bool

Enable sRGB for the diffuse color texture map.

bool

Disables backface culling casing surfaces to be double sided. Note that the lighting on the backside will be a mirror of the front side of the surface.

bool

Enables the material to use the dynamic cubemap from the ShapeBase object its applied to.

bool

Enables emissive lighting for the material.

bool
glow [4]

Enables rendering as glowing.

filename
GlowMap [4]

,ŽE

assetIdString

ðŒE

float
glowMul [4]

glow mask multiplier

bool

Treat Roughness as Roughness.

bool
isSRGB [4]

Substance Designer Workaround.

filename

ðŒE

assetIdString

ðŒE

string

Used to map this material to the material name used by TSShape.

float

The input channel metalness maps use.

filename

`Oç

assetIdString

ðŒE

float

The degree of Metalness when not using a ORMConfigMap.

float

The Minnaert shading constant value. Must be greater than 0 to enable the effect.

filename

ðŒE

assetIdString

ðŒE

filename

`Oç

assetIdString
filename

ðŒE

assetIdString

ðŒE

filename

For backwards compatibility.

float

Enables parallax mapping and defines the scale factor for the parallax effect. Typically this value is less than 0.4 else the effect breaks down.

Point2F

The piviot position in UV coordinates to center the rotation animation.

float

The speed to rotate the texture in degrees per second when rotation animation is enabled.

filename

`Oç

assetIdString

ðŒE

float

The degree of roughness when not using a ORMConfigMap.

float

The input channel roughness maps use.

Point2F

The scroll direction in UV space when scroll animation is enabled.

float

The speed to scroll the texture in UVs per second when scroll animation is enabled.

float

The number of frames per second for frame based sequence animations if greater than zero.

float

The size of each frame in UV units for sequence animations.

bool

Enables the subsurface scattering approximation.

LinearColorF

The color used for the subsurface scattering approximation.

float

The 0 to 1 rolloff factor used in the subsurface scattering approximation.

filename
ToneMap [4]

ðŒE

assetIdString

ðŒE

bool

If true this material is translucent blended.

The type of blend operation to use when the material is translucent.

bool

If enabled and the material is translucent it will write into the depth buffer.

bool

Use anisotropic filtering for the textures of this stage.

bool

If enabled, vertex colors are premultiplied with diffuse colors.

bool
vertLit [4]

If true the vertex color is used for lighting.

float
waveAmp [4]

The wave amplitude when wave animation is enabled.

float

The wave frequency when wave animation is enabled.

The type of wave animation to perform when wave animation is enabled.

Public Functions

void

Dumps a formatted list of the currently allocated material instances for this material to the console.

void

Flushes all material instances that use this material.

string
getAnimFlags(uint id)
string

Get filename of autogenerated shader file.

string

Get filename of material.

void

Dumps a formatted list of the currently allocated material instances for this material to the console.

bool

Returns true if this Material was automatically generated by MaterialList::mapMaterials()

void

Reloads all material instances that use this material.

void
setAutoGenerated(bool isAutoGenerated)

setAutoGenerated(bool isAutoGenerated): Set whether or not the Material is autogenerated.

Detailed Description

A material in Torque 3D is a data structure that describes a surface.

It contains many different types of information for rendering properties. Torque 3D generates shaders from Material definitions. The shaders are compiled at runtime and output into the example/shaders directory. Any errors or warnings generated from compiling the procedurally generated shaders are output to the console as well as the output window in the Visual C IDE.

singleton Material(DECAL_scorch)
{
   baseTex[0] = "./scorch_decal.png";
   vertColor[ 0 ] = true;

   translucent = true;
   translucentBlendOp = None;
   translucentZWrite = true;
   alphaTest = true;
   alphaRef = 84;
};

Behavioral

bool showFootprints 

Whether to show player footprint decals on this material.

see:

PlayerData::decalData

bool showDust 

Whether to emit dust particles from a shape moving over the material. This is, for example, used by vehicles or players to decide whether to show dust trails.

LinearColorF effectColor [2]

If showDust is true, this is the set of colors to use for the ParticleData of the dust emitter.

int footstepSoundId 

What sound to play from the PlayerData sound list when the player walks over the material. -1 (default) to not play any sound.

The IDs are:

SFXTrack customFootstepSound 

The sound to play when the player walks over the material. If this is set, it overrides footstepSoundId. This field is useful for directly assigning custom footstep sounds to materials without having to rely on the PlayerData sound assignment.

@warn Be aware that materials are client-side objects. This means that the SFXTracks assigned to materials must be client-side, too.

int impactSoundId 

What sound to play from the PlayerData sound list when the player impacts on the surface with a velocity equal or greater than PlayerData::groundImpactMinSpeed.

For a list of IDs, see footstepSoundId

int ImpactFXIndex 

What FX to play from the PlayerData sound list when the player impacts on the surface with a velocity equal or greater than PlayerData::groundImpactMinSpeed.

For a list of IDs, see #impactFXId

SFXTrack customImpactSound 

The sound to play when the player impacts on the surface with a velocity equal or greater than PlayerData::groundImpactMinSpeed. If this is set, it overrides impactSoundId. This field is useful for directly assigning custom impact sounds to materials without having to rely on the PlayerData sound assignment.

@warn Be aware that materials are client-side objects. This means that the SFXTracks assigned to materials must be client-side, too.

Public Attributes

float accuCoverage [4]

The coverage ratio of the accu map texture. Use this to make the entire shape pick up some of the accu map texture or none at all.

float accuDirection [4]

The direction of the accumulation. Chose whether you want the accu map to go from top to bottom (ie. snow) or upwards (ie. mold).

bool accuEnabled [4]

Accumulation texture.

float accuScale [4]

The scale that is applied to the accu map texture. You can use this to fit the texture to smaller or larger objects.

float accuSpecular [4]

Changes specularity to this value where the accumulated material is present.

float accuStrength [4]

The strength of the accu map. This changes the transparency of the accu map texture. Make it subtle or add more contrast.

int alphaRef 

The alpha reference value for alpha testing. Must be between 0 to 255.

bool alphaTest 

Enables alpha test when rendering the material.

MaterialAnimType animFlags [4]

The types of animation to play on this material.

float AOChan [4]

The input channel AO maps use.

filename AOMap [4]
assetIdString AOMapAsset [4]

ðŒE

filename baseTex [4]

For backwards compatibility.

see:

diffuseMap

bool bumpAtlas [4]
filename bumpTex [4]

For backwards compatibility.

see:

normalMap

bool castShadows 

If set to false the lighting system will not cast shadows from this material.

Point2I cellIndex [4]
Point2I cellLayout [4]
int cellSize [4]
LinearColorF colorMultiply [4]

For backwards compatibility.

string cubemap 

The name of a CubemapData for environment mapping.

filename DetailMap [4]

ðŒE

assetIdString DetailMapAsset [4]

ðŒE

filename DetailNormalMap [4]

ðŒE

assetIdString DetailNormalMapAsset [4]

ðŒE

float detailNormalMapStrength [4]

Used to scale the strength of the detail normal map when blended with the base normal map.

Point2F detailScale [4]

The scale factor for the detail map.

filename detailTex [4]

For backwards compatibility.

see:

detailMap

LinearColorF diffuseColor [4]

This color is multiplied against the diffuse texture color. If no diffuse texture is present this is the material color.

filename DiffuseMap [4]

ðŒE

assetIdString DiffuseMapAsset [4]

ðŒE

bool diffuseMapSRGB [4]

Enable sRGB for the diffuse color texture map.

bool doubleSided 

Disables backface culling casing surfaces to be double sided. Note that the lighting on the backside will be a mirror of the front side of the surface.

bool dynamicCubemap 

Enables the material to use the dynamic cubemap from the ShapeBase object its applied to.

bool emissive [4]

Enables emissive lighting for the material.

bool glow [4]

Enables rendering as glowing.

filename GlowMap [4]

,ŽE

assetIdString GlowMapAsset [4]

ðŒE

float glowMul [4]

glow mask multiplier

bool invertRoughness [4]

Treat Roughness as Roughness.

bool isSRGB [4]

Substance Designer Workaround.

filename LightMap [4]

ðŒE

assetIdString LightMapAsset [4]

ðŒE

string mapTo 

Used to map this material to the material name used by TSShape.

float metalChan [4]

The input channel metalness maps use.

filename MetalMap [4]

`Oç

assetIdString MetalMapAsset [4]

ðŒE

float metalness [4]

The degree of Metalness when not using a ORMConfigMap.

float minnaertConstant [4]

The Minnaert shading constant value. Must be greater than 0 to enable the effect.

filename NormalMap [4]

ðŒE

assetIdString NormalMapAsset [4]

ðŒE

filename ORMConfigMap [4]

`Oç

assetIdString ORMConfigMapAsset [4]

ðŒE

filename OverlayMap [4]

ðŒE

assetIdString OverlayMapAsset [4]

ðŒE

filename overlayTex [4]

For backwards compatibility.

see:

overlayMap

float parallaxScale [4]

Enables parallax mapping and defines the scale factor for the parallax effect. Typically this value is less than 0.4 else the effect breaks down.

bool planarReflection 
Point2F rotPivotOffset [4]

The piviot position in UV coordinates to center the rotation animation.

float rotSpeed [4]

The speed to rotate the texture in degrees per second when rotation animation is enabled.

filename RoughMap [4]

`Oç

assetIdString RoughMapAsset [4]

ðŒE

float roughness [4]

The degree of roughness when not using a ORMConfigMap.

float roughnessChan [4]

The input channel roughness maps use.

Point2F scrollDir [4]

The scroll direction in UV space when scroll animation is enabled.

float scrollSpeed [4]

The speed to scroll the texture in UVs per second when scroll animation is enabled.

float sequenceFramePerSec [4]

The number of frames per second for frame based sequence animations if greater than zero.

float sequenceSegmentSize [4]

The size of each frame in UV units for sequence animations.

bool subSurface [4]

Enables the subsurface scattering approximation.

LinearColorF subSurfaceColor [4]

The color used for the subsurface scattering approximation.

float subSurfaceRolloff [4]

The 0 to 1 rolloff factor used in the subsurface scattering approximation.

filename ToneMap [4]

ðŒE

assetIdString ToneMapAsset [4]

ðŒE

bool translucent 

If true this material is translucent blended.

MaterialBlendOp translucentBlendOp 

The type of blend operation to use when the material is translucent.

bool translucentZWrite 

If enabled and the material is translucent it will write into the depth buffer.

bool useAnisotropic [4]

Use anisotropic filtering for the textures of this stage.

bool vertColor [4]

If enabled, vertex colors are premultiplied with diffuse colors.

bool vertLit [4]

If true the vertex color is used for lighting.

float waveAmp [4]

The wave amplitude when wave animation is enabled.

float waveFreq [4]

The wave frequency when wave animation is enabled.

MaterialWaveType waveType [4]

The type of wave animation to perform when wave animation is enabled.

Public Functions

dumpInstances()

Dumps a formatted list of the currently allocated material instances for this material to the console.

flush()

Flushes all material instances that use this material.

getAnimFlags(uint id)

getAutogeneratedFile()

Get filename of autogenerated shader file.

getFilename()

Get filename of material.

getMaterialInstances(GuiTreeViewCtrl matTree)

Dumps a formatted list of the currently allocated material instances for this material to the console.

isAutoGenerated()

Returns true if this Material was automatically generated by MaterialList::mapMaterials()

reload()

Reloads all material instances that use this material.

setAutoGenerated(bool isAutoGenerated)

setAutoGenerated(bool isAutoGenerated): Set whether or not the Material is autogenerated.