Applying Materials in ICE

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: