An object that defines the reflected color for each point on a surface.
- iOS 8.0+
- macOS 10.8+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 3.0+
You can simulate a mirrored or chromed finish on a surface by causing it to reflect its environment. SceneKit does not render real-time reflections of the objects in a scene, but it can use an environment map texture to simulate reflection of a static or animated image. When rendering each pixel on the surface, SceneKit traces the light from that point to a pixel in the environment map as if the surface was reflecting that image.
By default, the reflective property’s
contents object is a white color, causing the property to have no visible effect. Setting the reflective property’s contents to any solid color adds uniform shading to the material. To create a reflective effect, set the property’s contents to an image or other texture-mapped content.
To produce a mirror-finish effect using an environment map, the texture image should take one of two forms:
A sphere map, a square image whose content depicts an environment as reflected by a mirrored sphere.
A cube map, an array of six square images which together form an imaginary cube enclosing the scene, whose inner surfaces are reflected by the material. You create a cube map by setting the reflective property’s
contentsobject to an
NSArrayinstance containing six images, each corresponding to a direction in the scene’s world coordinate space in the following order: +X, -X, +Y, -Y, +Z, -Z (or Right, Left, Top, Bottom, Near, Far).
The figure below shows a material (with a texture for its
normal property) before and after providing a cube map for the reflective property.
This material property does not apply to physically-based materials (see
physically). Instead, such materials reflect environment-based lighting (see the
lighting property) based on their