Contents

OcclusionMaterial

An invisible material that hides objects rendered behind it.

Declaration

struct OcclusionMaterial

Overview

Add an OcclusionMaterial to a model by setting it as one of the materials in a ModelComponent.

let model = ModelComponent(
    mesh: .generateBox(size: 1),
    materials: [OcclusionMaterial()]
)
smallBoxEntity.components.set(model)

For example, on the left is a case of two cubes, the larger red cube is slightly further from the camera and has a simple material. The slightly smaller and closer cube has no material in the left image and an occlusion material on the right image.

No material

Occlusion material

[Image]

[Image]

Topics

Creating an occlusion material

Receiving dynamic lighting

Setting depth testing properties

Instance Properties

Type Aliases

See Also

Object occlusion