Contents

ModelDebugOptionsComponent.VisualizationMode.textureCoordinates

A mode that displays the texture coordinates as a color.

Declaration

case textureCoordinates

Discussion

Adding a ModelDebugOptionsComponent with a visualization mode of textureCoordinates to an entity tells RealityKit to draw that entity’s UV texture coordinates as its surface color. RealityKit draws the texture coordinates by using its U and V values as the R and G components of the color, using a value of 0 for the color’s B component.

RealityKit calculates texture coordinates for entities with a VideoMaterial, UnlitMaterial, 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 UV texture coordinate visualization for an entity:

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

None

textureCoordinates

[Image]

[Image]

See Also

Visualization modes