<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/CustomMaterial/clearcoatNormal-swift.property",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation14CustomMaterialV15clearcoatNormalAC09ClearcoatF0Vvp"
  },
  "title" : "clearcoatNormal"
}
-->

# clearcoatNormal

Waviness and imperfections for the top clearcoat.

```
var clearcoatNormal: CustomMaterial.ClearcoatNormal { get set }
```

## Discussion

An entity in RealityKit can display a clearcoat, which is a separate
layer of transparent specular highlights used to simulate a clear
coating, like on a car or the surface of lacquered objects. This
property allows you to specify a clearcoat normal and add
waviness and imperfections to the top clearcoat.

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

```swift
if let clearcoatNormalTextureResource = try?
TextureResource.load(named: "entity_cc_normalMap") {
    let ccNormalMap = CustomMaterial.Texture(clearcoatNormalTextureResource)
    material.clearcoatNormal = .init(texture: ccNormalMap)
}
```

With custom materials, RealityKit only renders a clearcoat if
[`lightingModel`](/documentation/RealityKit/CustomMaterial/lightingModel-swift.property) is
[`CustomMaterial.LightingModel.clearcoat`](/documentation/RealityKit/CustomMaterial/LightingModel-swift.enum/clearcoat) and the material’s
surface shader function calls `params.surface().set_clearcoat()`.
To specify [`clearcoatNormal`](/documentation/RealityKit/CustomMaterial/clearcoatNormal-swift.property),
your surface shader function also needs to call
`params.surface().set_clearcoat_normal()`.

The following Metal code demonstrates using
[`clearcoat`](/documentation/RealityKit/CustomMaterial/clearcoat-swift.property) and
[`clearcoatNormal`](/documentation/RealityKit/CustomMaterial/clearcoatNormal-swift.property) in a surface
shader, replicating the behavior of the [`PhysicallyBasedMaterial`](/documentation/RealityKit/PhysicallyBasedMaterial)
shader:

```cpp
// Retrieve the entity's texture coordinates.
float2 uv = params.geometry().uv0();

// Entities loaded from a USDZ or .reality file use texture coordinates with
// a flipped y-axis. This compensates for that.
uv.y = 1.0 - uv.y;

// Sample a value from the clearcoat normal texture.
auto tex = params.textures();
half3 clearcoatNormal = realitykit::unpack_normal(tex.clearcoat_normal().sample(textureSampler, uv).rgb);

// assign the result.
params.surface().set_clearcoat_normal(clearcoatNormal);
params.surface().set_clearcoat(1.0);
```

---

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)