Contents

ModelDebugOptionsComponent.VisualizationMode.finalAlpha

A mode that displays the entity’s calculated transparency as its surface color.

Declaration

case finalAlpha

Discussion

Add a ModelDebugOptionsComponent with a visualization mode of finalAlpha to an entity to tell RealityKit to draw that entity’s alpha value as its surface color. RealityKit draws the alpha value as a grayscale value from black (0.0) to white (1.0), meaning the more transparent a part of the entity is, the darker RealityKit draws it.

RealityKit calculates final alpha values 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 alpha visualization for an entity:

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

None

finalAlpha

[Image]

[Image]

See Also

Visualization modes