AppleSCNMaterial - UBogun/Xojo-iosLib GitHub Wiki

Inherits from AppleObject
Memory leak check: not yet done.
Status: incomplete, materialWithMDLMaterial Constructor missing.

An SCNMaterial object manages the lighting and shading attributes associated with the surface of a geometry that define its appearance when rendered. When you create a material, you define a collection of visual attributes and their options, which you can then reuse for multiple geometries in a scene.

A material has eight visual properties, listed in Configuring a Material’s Visual Properties, each of which defines a different part of SceneKit’s lighting and shading process. Each visual property is an instance of the SCNMaterialProperty class that provides a solid color, texture, or other 2D content for that aspect of SceneKit’s rendering. The material’s lightingModelName property then determines the formula SceneKit uses to combine the visual properties with the lights in the scene to produce the final color for each pixel in the rendered scene. For more details on the rendering process, see Lighting Models.

You attach one or more materials to an instance of the SCNGeometry class using its firstMaterial or materials property. Multiple geometries can reference the same material. In this case, changing the attributes of the material changes the appearance of every geometry that uses it.

Constructors

Constructor (): Creates a new material object.

Properties

Ambient As AppleSCNMaterialProperty: An object that manages the material’s response to ambient lighting. (read-only)

AmbientOcclusion As AppleSCNMaterialProperty: An object that provides color values to be multiplied with the ambient light affecting the material. (read-only) Available in iOS 9.0 and later.

BlendMode As SCNBlendMode: The mode that determines how pixel colors rendered using this material blend with other pixel colors in the rendering target. Default Alpha. Available in iOS 9.0 and later.

SCNBlendMode Definition
Alpha Blend by multiplying source and destination color values by their corresponding alpha values.
Add Blend by adding the source color to the destination color.
Subtract Blend by subtracting the source color from the destination color.
Multiply Blend by multiplying the source color with the background color.
Screen Blend by multiplying the inverse of the source color with the inverse of the destination color.
Replace Blend by replacing the destination color with the source color, ignoring alpha.

CullMode As SCNCullMode: The mode determining which faces of a surface SceneKit renders. Animatable.

SCNCullMode Definition
Back The mode for culling back-facing polygons (and rendering only front-facing polygons).
Front The mode for culling front-facing polygons (and rendering only back-facing polygons).

Diffuse As AppleSCNMaterialProperty: An object that manages the material’s diffuse response to lighting. (read-only)

DoubleSided As Boolean: Whether SceneKit should render both front and back faces of a surface. Animatable.

Emission As AppleSCNMaterialProperty: An object that defines the color emitted by each point on a surface. (read-only)

FresnelExponent As Double: A factor affecting the material’s reflectivity. Animatable.

LightingModel As SCNLightingModel: The lighting formula that SceneKit uses to render the material. Convenience method for LightingModelName.

SCNLightingModel Defintition
Phong Shading that incorporates ambient, diffuse, and specular properties, where specular highlights are calculated using the Phong formula. Realitsic, half-glossy, defined relections.
Blinn Shading that incorporates ambient, diffuse, and specular properties, where specular highlights are calculated using the Blinn-Phong formula. Broader, more shiny reflections.
Lambert Shading that incorporates ambient and diffuse properties only. Matte.
ConstantLighting Uniform shading that incorporates ambient lighting only.

LightingModelName As Text: The same as above, in case different models follow.

LitPerPixel As Boolean: Whether SceneKit performs lighting calculations per vertex or per pixel. Animatable.

LocksAmbientWithDiffuse As Boolean: Whether the material responds identically to both ambient and diffuse lighting. Animatable.

Multiply As AppleSCNMaterialProperty: An object that provides color values that are multiplied with pixels in a material after all other shading is complete. (read-only)

Name As Text: A name associated with the material.

Normal As AppleSCNMaterialProperty: An object that defines the nominal orientation of the surface at each point for use in lighting. (read-only)

ReadsFromDepthBuffer As Boolean: Whether SceneKit uses depth information when rendering the material.

Reflective As AppleSCNMaterialProperty: An object that defines the reflected color for each point on a surface. (read-only)

SelfIllumination As AppleSCNMaterialProperty: An object that provides color values to be added to the lighting contribution of the surface. (read-only) Available in iOS 9.0 and later.

Shininess As Double: The sharpness of specular highlights. Animatable.

Specular As AppleSCNMaterialProperty: An object that manages the material’s specular response to lighting. (read-only)

Transparency As Double: The uniform transparency of the material. Animatable.

TransparencyMode As SCNTransparencyMode: The mode SceneKit uses to calculate transparency for the material. Default AOne.

SCNTransparencyMode Definition
AOne SceneKit derives transparency information from the alpha channel of colors. The value 1.0 is opaque.
RGBZero SceneKit derives transparency information from the luminance of colors. The value 0.0 is opaque. When using this mode, SceneKit ignores the alpha value of colors in the material’s transparent property. SceneKit calculates the luminance of a color from its red, green, and blue channels and uses the resulting value to determine the material’s opacity.

Transparent As AppleSCNMaterialProperty: An object that determines the opacity of each point in a material. (read-only)

WritesToDepthBuffer As Boolean: Whether SceneKit produces depth information when rendering the material.