Contents

ModelDebugOptionsComponent.VisualizationMode.clearcoatRoughness

A mode that displays the clearcoat roughness channel of a material as the surface color.

Declaration

case clearcoatRoughness

Discussion

Add a ModelDebugOptionsComponent with a visualization mode of clearcoatRoughness to an entity to tell RealityKit to draw the entity’s calculated clearcoat roughness as its surface color. Clearcoat is a way to render objects that have a shiny transparent coating or veneer, such as the surface of a car with a coat of wax or items shrinkwrapped in clear plastic. The clearcoat roughness value represents the shininess of the clearcoat and is only used on parts of the entity that have a clearcoat value greater than zero. RealityKit draws the clearcoat roughness value as a grayscale value from black (0.0) to white (1.0), with lighter areas representing parts with a shinier clearcoat.

RealityKit calculates clearcoat roughness for entities with a SimpleMaterial and for entities imported from a USDZ file. For other entities, this option has no effect.

Here’s how to enable roughness visualization for an entity:

if let television = try? await ModelEntity(named: "tv_retro") {
    let component = ModelDebugOptionsComponent(visualizationMode: .clearcoatRoughness)
    television.components.set(component)
}

None

clearcoatRoughness

[Image]

[Image]

See Also

Visualization modes