Contents

ModelDebugOptionsComponent.VisualizationMode.roughness

A mode that displays the shininess of a material as the surface color.

Declaration

case roughness

Discussion

Add a ModelDebugOptionsComponent with a visualization mode of roughness to an entity to tell RealityKit to draw that entity’s roughness value as its surface color. A high roughness value represents a surface with a matte finish, while a low roughness value represents a shiny or polished surface. When using this mode, RealityKit draws the roughness value as a grayscale value from black (0.0) to white (1.0), meaning the shinier a part of the entity is, the darker RealityKit draws it.

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

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

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

None

roughness

[Image]

[Image]

See Also

Visualization modes