You can apply materials to polygons in a mesh using ICE. The advantage of this is that there is no need for clusters with local materials. The two important attributes are Materials and MaterialID.
Materials is an attribute available on polygon mesh objects. It is an array of strings containing the names of materials that can be used on polygons in that mesh, such as "Sources.Materials.DefaultLib.Blue". The material names are resolved at render time, so undefined material names will not show as errors in the ICE tree. If a material name is not available at render time, the material applied directly to the object in the usual non-ICE way is used instead.
MaterialID is an integer attribute per polygon. It specifies which element in the Materials array to apply to each polygon. A value of 0 specifies to use the material applied to the object itself. A value of 1 uses the first material in the array (array index 0), a value of 2 uses the second material in the array (array index 1), and so on. Any polygons with values that are larger than the Materials array use the object's material.
To apply different materials to different polygons, you populate an array with the names of materials and use it to set the mesh's Materials attribute. After that, you calculate and set each polygon's MaterialID attribute to specify the material you want based on whatever criteria you choose.
There are several nodes that are useful when working with materials:
Set Materials from Library lets you build the Materials attribute by connecting references to materials. You can drag materials into the ICE tree from an explorer or the material manager.
Set Materials from Strings allows you to enter material names in the property editor, or connect string values. It is especially useful when copying and pasting material names. You can add more names by right-clicking on a port and choosing one of the Insert commands. You can remove unused ports if you want — any unresolved materials are replaced by the object's material.
Set Material ID sets the MaterialID attribute based on whatever condition you connect. In this example, the condition is whether the polygons are inside the volume of a null.
If you already have clusters on a mesh, Set Material ID from Cluster lets you use them to set MaterialID.
Reference to String converts references to scene elements, including materials, to strings. The following example adds the material Red to the self's existing Materials array.
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License