OcclusionMaterial
An invisible material that hides objects rendered behind it.
Declaration
struct OcclusionMaterialOverview
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] |