TextureLayer

Object Hierarchy | Related C++ Class: TextureLayer

Inheritance

SIObject

ProjectItem

TextureLayer

Introduced

v4.0

Description

The TextureLayer is an object which simplifies layering of shader effects on top of shaders and materials. Each layer has a set of properties which describe its characteristics (such as color, mixing mode, scale factor) to specify how it will affect the shader ports it drives. The order that layers appear under a container indicates the order the layering is applied, similar to the way a "mix N colors" shader node works.

TextureLayerPort objects are owned by TextureLayers, and are used to specify which shader ports the layer should affect. If there are no ports, then the layer is just a stub or placeholder, and as such does not affect the material's rendering.

TextureLayers can be created using Shader.CreateTextureLayer and Material.CreateTextureLayer. TextureLayers can have "sub" render trees connected to them as driving inputs, in the same way one would connect Shader objects together (using Parameter.ConnectFromPreset or Parameter.Connect).

Methods

AddCustomOp AddICEAttribute AddScriptedOp AddScriptedOpFromFile
AddTextureLayerPort AnimatedParameters2 BelongsTo operator EvaluateAt
GetICEAttributeFromName IsA IsAnimated2 IsClassOf operator
IsEqualTo operator IsKindOf IsLocked operator IsSelected operator
LockOwners Move RemoveICEAttribute RemoveTextureLayerPort
SetAsSelected operator SetCapabilityFlag operator SetLock TaggedParameters
UnSetLock      
       

Properties

Application BranchFlag operator Capabilities operator Categories
EvaluationID Families operator FullName operator Help
HierarchicalEvaluationID ICEAttributes LockLevel operator LockMasters operator
LockType operator Model Name operator NestedObjects
ObjectID Origin OriginPath Owners
PPGLayout operator Parameters operator Parent Parent3DObject
Selected operator TextureLayerPorts Type operator  
       

Examples

JScript Example

// This example shows creation of texture layers,
// plus enumerating and removing them.
oRoot = ActiveProject.ActiveScene.Root;
oSph = oRoot.AddGeometry( "Torus", "MeshSurface" );
oMat = oSph.AddMaterial( "Phong" );
oPhong = oMat.Shaders(0);
// Add a layer at the end (since there are no others the "After"
// flag is irrelevant).
var oLayers = new Array(3);
oLayers[0] = oPhong.CreateTextureLayer( "B", true );
// Add another layer before the other one.
oLayers[1] = oPhong.CreateTextureLayer( "A", false, oLayers[0] );
// Create a third layer at the very start.
oLayers[2] = oPhong.CreateTextureLayer( "base", false );
Application.LogMessage( "Created " + oPhong.TextureLayers.count + " layers." );
for ( i = 0; i < oPhong.TextureLayers.count; i++ )
{
	oLayer = oPhong.TextureLayers(i);
	Application.LogMessage( (i+1) + ": " + oLayer );
}
oPhong.RemoveTextureLayer( oLayers[1] );
oPhong.RemoveTextureLayer( oPhong.fullname + "." + oLayers[2].name );
count = oPhong.TextureLayers.count;
Application.LogMessage( "Only " + count + " remain(s) after removal." );
for ( i = 0; i < count; i++ )
{
	Application.LogMessage( (i+1) + ": " + oPhong.TextureLayers.item(i) );
}
// This example should log something like:
//INFO : "Created 3 layers."
//INFO : "1: torus.Material.Phong.base"
//INFO : "2: torus.Material.Phong.A"
//INFO : "3: torus.Material.Phong.B"
//INFO : "Only 1 remain(s) after removal."
//INFO : "1: torus.Material.Phong.B"

See Also

Shader.TextureLayers Shader.CreateTextureLayer Material.TextureLayers Material.CreateTextureLayer AddTextureLayer