<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/CustomMaterial/ClearcoatRoughness-swift.struct/init(floatLiteral:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation14CustomMaterialV18ClearcoatRoughnessV12floatLiteralAESf_tcfc"
  },
  "title" : "init(floatLiteral:)"
}
-->

# init(floatLiteral:)

Creates a clearcoat object using a single value.

```
init(floatLiteral value: Float)
```

## Parameters

`value`

The clearcoat value to use for the entity.

## Discussion

A clearcoat is a separate layer of transparent specular highlights
used to simulate a clear coating, like on a car or the surface of
lacquered objects. Use this initializer to create an object to
specify the amount of clearcoat for a material using a single value
for the entire material, a UV-mapped image to specify different
values for different parts of the entity, or both.

The values from this property are available in the custom material’s
surface shader function regardless of the value of
[`lightingModel`](/documentation/RealityKit/CustomMaterial/lightingModel-swift.property) , but clearcoat
isn’t drawn unless the custom material’s
[`lightingModel`](/documentation/RealityKit/CustomMaterial/lightingModel-swift.property) is
[`CustomMaterial.LightingModel.clearcoat`](/documentation/RealityKit/CustomMaterial/LightingModel-swift.enum/clearcoat) and the
surface shader calls `params.surface().set_clearcoat()`.

The following Metal code demonstrates how to retrieve the scale and
texture values from this property and use them to enable clearcoat
rendering.

```other
    // Retrieve the clearcoat scale and roughness from the CustomMaterial.
    float clearcoatScale = params.material_constants().clearcoat_scale();
    float clearcoatRoughnessScale = params.material_constants().clearcoat_roughness_scale();

    // Assign the clearcoat scale to enable clearcoat rendering (if
    // lightingModel is .clearcoat).
    params.surface().set_clearcoat(clearcoatScale);

    // Assign the clearcoat roughness from the scale property set
    //  on the custom material.
    params.surface().set_clearcoat_roughness(clearcoatRoughnessScale);
```

---

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)