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

# CustomMaterial.Opacity

An object that defines the transparency options for a custom material.

```
struct Opacity
```

## Topics

### Creating an opacity object

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

Creates an opacity object from a single value.

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

Creates an object that defines the opacity of an entity using a
single value, a UV-mapped image texture, or both.

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

Creates an object from the opacity property of an existing
physically based material.

### Accessing opacity data

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

The amount of opacity specified as a single value.

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

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

## Relationships

### Conforms To

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

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

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

---

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)