MaterialBinding


Purpose:

This node is another of the eleven geometry and appearance property Nodes. Material Binding specifies how the current materials are bound to shapes that follow the node in the scene graph.

Syntax
BINDINGS
	DEFAULT			Use default binding
	OVERALL			Whole object has same material
	PER_PART			One material for each part of object
	PER_PART_INDEXED		One material for each part, indexed
	PER_FACE			One material for each face of object
	PER_FACE_INDEXED		One material for each face, indexed
	PER_VERTEX		One material for each vertex of object
	PER_VERTEX_INDEXED		One material for each vertex, indexed

 

FILE FORMAT/DEFAULTS
	MaterialBinding {
		value	DEFAULT	# SFEnum
	}
Explanation

Shape node may interpret bindings differently from one another. The way that materials are handled is relatively simple. The current material always has a base value. This value is defined by the first value of all material fields. As material fields are capable of having multiple values, this MaterialBinding node determines how these values are distributed over a 3-D object.

Keep in mind that bindings for faces and vertices are meaningful only for shapes made from faces and vertices. In the same manner, indexed bindings are only used by shapes allowing indexing.

When this happens with multiple material values, these values are cycled through. The cycle is based on the period of the material component with the most values. For example, Table 13-1 shows the values used when cycling through, or indexing into, a material with 2 ambient colors, 3 diffuse colors, and 1 of all other components in the current material. This material has a period cycle of three.

Table: Material Values

Material Ambient color Diffuse color Other
0 0 0 0
1 1 1 0
2 1 2 0
3 0 0 0

(*Notice 3 is the same as 0*)

Example Use

The following code fragment is from Calig4.wrl.

MaterialBinding {value PER_FACE_INDEXED}

See Also

Material