---
title: "init(scale:texture:)"
framework: realitykit
role: symbol
role_heading: Initializer
path: "realitykit/physicallybasedmaterial/opacity/init(scale:texture:)"
---

# init(scale:texture:)

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

## Declaration

```swift
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

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.

## See Also

### Creating an opacity object

- [init(floatLiteral:)](realitykit/physicallybasedmaterial/opacity/init(floatliteral:).md)
- [init(_:)](realitykit/physicallybasedmaterial/opacity/init(_:).md)
