<!--
{
  "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/Clearcoat-swift.struct/init(floatLiteral:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation14CustomMaterialV9ClearcoatV12floatLiteralAESf_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
that applies to the entire material.

The clearcoat value is available in the material’s surface shader
function, but RealityKit doesn’t render a clearcoat unless the
material’s [`lightingModel`](/documentation/RealityKit/CustomMaterial/lightingModel-swift.property) is
[`CustomMaterial.LightingModel.clearcoat`](/documentation/RealityKit/CustomMaterial/LightingModel-swift.enum/clearcoat) and its
surface shader function calls `params.surface().set_clearcoat()`.

The following Metal code demonstrates how to retrieve the clearcoat
[`scale`](/documentation/RealityKit/CustomMaterial/Clearcoat-swift.struct/scale) in a surface shader
function and use it to set the final clearcoat value for rendering:

```other
    // Retrieve the base color tint from the CustomMaterial.
    float clearcoatScale = params.material_constants().clearcoat_scale();

    // Assign the scale value as the clearcoat value for this pixel.
    params.surface().set_clearcoat(clearcoat);
```

---

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)