Contents

ModelDebugOptionsComponent.VisualizationMode.normal

A mode that displays the normal vectors as a color.

Declaration

case normal

Discussion

Add a ModelDebugOptionsComponent with a visualization mode of normal to an entity to tell RealityKit to draw that entity’s surface normal vectors as its surface color. A normal vector is an imaginary line perpendicular to the surface of the object at a specific point. RealityKit draws a normal vector by using its X, Y, and Z values as the R, G, and B components of the color.

RealityKit calculates normals for entities with a VideoMaterial, UnlitMaterial, or SimpleMaterial as well as for entities imported from a USDZ file. If an entity doesn’t fall within those parameters, this option has no effect on the rendering.

Here’s how to enable surface normal visualization for an entity:

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

None

normal

[Image]

[Image]

See Also

Visualization modes