<!--
{
  "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/roughness-swift.property",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation23PhysicallyBasedMaterialV9roughnessAC9RoughnessVvp"
  },
  "title" : "roughness"
}
-->

# roughness

The amount the surface of the 3D object scatters reflected light.

```
var roughness: PhysicallyBasedMaterial.Roughness { get set }
```

## Discussion

The `roughness` property represents how much the surface of the entity
scatters light it reflects. A material with a high roughness has a matte
appearance, while one with a low roughness has a shiny appearance.

![An illustration showing three spheres with different amounts of](images/com.apple.RealityKit/PhysicallyBasedMaterial-roughness-swift-property-1@2x.png)

Specify this property using a
<doc://com.apple.documentation/documentation/Swift/Float> to represent a
uniform `roughness` for the entire entity, or a UV-mapped grayscale
image that uses shades of gray to represent the roughness of different
parts of the entity. When using an image, black pixels represent areas
that have a low roughness and appear shiny, while white represents areas
that have a high roughness and display a matte finish.

If you initialize this property with a color image rather than a
grayscale image, RealityKit only uses the intensity of the image’s red
channel.

The following example uses a single value to specify roughness:

```swift
material.roughness = PhysicallyBasedMaterial.Roughness(floatLiteral: 0.0)
```

The following example uses an image to specify roughness:

```swift
if let roughnessResource = try? TextureResource.load(named:
"entity_roughness") {
    let roughness = MaterialParameters.Texture(roughnessResource)
    material.roughness = PhysicallyBasedMaterial.Roughness(texture:roughness)
}
```

---

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)