<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/PhysicallyBasedMaterial/Opacity",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation23PhysicallyBasedMaterialV7OpacityV"
  },
  "title" : "PhysicallyBasedMaterial.Opacity"
}
-->

# PhysicallyBasedMaterial.Opacity

An object that defines the opacity of an entity.

```
struct Opacity
```

## Topics

### Creating an opacity object

[`init(floatLiteral: Float)`](/documentation/RealityKit/PhysicallyBasedMaterial/Opacity/init(floatLiteral:))

Creates an opacity object using a single value.

[`init(scale: Float, texture: PhysicallyBasedMaterial.Texture?)`](/documentation/RealityKit/PhysicallyBasedMaterial/Opacity/init(scale:texture:))

Creates an opacity object using a single value or a texture.

[`init(CustomMaterial.Opacity)`](/documentation/RealityKit/PhysicallyBasedMaterial/Opacity/init(_:))

Creates an opacity object using a custom material’s opacity
property.

### Accessing opacity values

[`var texture: PhysicallyBasedMaterial.Texture?`](/documentation/RealityKit/PhysicallyBasedMaterial/Opacity/texture)

The amount of opacity specified using a UV-mapped image.

[`static var textureSemantic: TextureResource.Semantic`](/documentation/RealityKit/PhysicallyBasedMaterial/Opacity/textureSemantic)

The intended use of the object’s texture property.

[`var scale: Float`](/documentation/RealityKit/PhysicallyBasedMaterial/Opacity/scale)

[`var opacityThreshold: Float?`](/documentation/RealityKit/PhysicallyBasedMaterial/opacityThreshold)

A threshold below which RealityKit ignores opacity.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`ExpressibleByFloatLiteral`](/documentation/Swift/ExpressibleByFloatLiteral)

[`Hashable`](/documentation/Swift/Hashable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)