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

# clearcoatRoughness

The degree to which an entity’s clear, shiny coating scatters light to
create soft highlights.

```
var clearcoatRoughness: PhysicallyBasedMaterial.ClearcoatRoughness { get set }
```

## Discussion

When you enable clearcoat rendering for a material, RealityKit renders
the clearcoat as a separate layer just above the surface of the entity.
You can specify a clearcoat roughness value for the clearcoat to
indicate how much the clearcoat scatters light that bounces off of it,
which softens and spreads out the highlights.

You can specify a single value that applies to the entire material, or
you can supply a UV-mapped image texture containing different roughness
values for different parts of the entity.

The following example sets the `clearcoatRoughness` using a single
value:

```swift
material.clearcoatRoughness = .init(floatLiteral: 0.5)
```

This example shows how to set the `clearcoatRoughness` using a UV-mapped
image:

```swift
if let clearcoatRoughnessResource = try?
TextureResource.load(named: "entity_cc_roughness") {
    let ccRoughnessMap = MaterialParameters.Texture(clearcoatRoughnessResource)
    material.clearcoat = .init(texture: ccRoughnessMap)
}
```

---

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)