<!--
{
  "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/init(scale:texture:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation23PhysicallyBasedMaterialV7OpacityV5scale7textureAESf_AA0E10ParametersV7TextureVSgtcfc"
  },
  "title" : "init(scale:texture:)"
}
-->

# init(scale:texture:)

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

```
init(scale: Float = 1.0, texture: PhysicallyBasedMaterial.Texture? = nil)
```

## Parameters

`scale`

The opacity value for the entire material.

`texture`

The opacity values as a UV-mapped image.

## Discussion

This initializer allows you to create an instance using either a
single value for the entire material or a UV-mapped image. If
`texture` is non-`nil`, RealityKit uses that image to determine the
material’s opacity and ignores `scale`. If `texture` is `nil`, then
it uses `scale` for the entire material.

---

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)