---
title: roughness
framework: realitykit
role: symbol
role_heading: Instance Property
path: realitykit/physicallybasedmaterial/roughness-swift.property
---

# roughness

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

## Declaration

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

## Mentioned in

Applying realistic material and lighting effects to entities

## Discussion

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.

Specify this property using a 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: material.roughness = PhysicallyBasedMaterial.Roughness(floatLiteral: 0.0) The following example uses an image to specify roughness: if let roughnessResource = try? TextureResource.load(named: "entity_roughness") {     let roughness = MaterialParameters.Texture(roughnessResource)     material.roughness = PhysicallyBasedMaterial.Roughness(texture:roughness) }

## See Also

### Setting the core properties

- [baseColor](realitykit/physicallybasedmaterial/basecolor-swift.property.md)
- [metallic](realitykit/physicallybasedmaterial/metallic-swift.property.md)
- [normal](realitykit/physicallybasedmaterial/normal-swift.property.md)
- [ambientOcclusion](realitykit/physicallybasedmaterial/ambientocclusion-swift.property.md)
- [specular](realitykit/physicallybasedmaterial/specular-swift.property.md)
- [clearcoat](realitykit/physicallybasedmaterial/clearcoat-swift.property.md)
- [clearcoatRoughness](realitykit/physicallybasedmaterial/clearcoatroughness-swift.property.md)
- [clearcoatNormal](realitykit/physicallybasedmaterial/clearcoatnormal-swift.property.md)
