- iOS 8.0+
- macOS 10.8+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 3.0+
Materials provide the information SceneKit uses to add color, lighting, texture, and special effects when rendering a geometry. Each
SCNMaterial object can be shared between several geometries.
If a geometry contains multiple elements (see
geometry), you can associate a separate material with each geometry element. For example, the teapot in Figure 1 has four elements, each with a different material.
If a geometry has the same number of materials as it has geometry elements, the material index corresponds to the element index. For geometries with fewer materials than elements, SceneKit determines the material index for each element by calculating the index of that element modulo the number of materials. For example, in a geometry with six elements and three materials, SceneKit renders the element at index
5 using the material at index
5 % 3 = 2.