Contents

metallic

The reflectiveness of an entity.

Declaration

var metallic: PhysicallyBasedMaterial.Metallic { get set }

Mentioned in

Discussion

The metallic property represents the reflectiveness of an entity. Use this property to specify whether the entity displays metallic qualities and reflects the surrounding environment, or displays dielectric qualities and doesn’t reflect the environment.

[Image]

Specify this property using a Float to represent a uniform reflectiveness for the entire entity. You an also use a UV-mapped grayscale image to represent the reflectiveness of different parts of the entity. When using an image, black pixels represent areas that are dielectric, while white pixels represents areas that are completely metallic and reflective.

If you initialize this property with a color image, rather than a grayscale image, RealityKit only uses the intensity of the image’s red channel.

The following example specifies the metallic qualities of an entity using a single float value:

material.metallic = 1.0

The following example specifies the metallic qualities of an entity using a UV-mapped image:

// Load a texture resource from a file.
let metalResource = try TextureResource.load(named: "entity_metallic")

// Set the texture to the metallic property.
let metallic = MaterialParameters.Texture(metalResource)
material.metallic = PhysicallyBasedMaterial.Metallic(texture: metallic)

See Also

Setting the core properties