<!--
{
  "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/init(surfaceShader:geometryModifier:lightingModel:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation14CustomMaterialV13surfaceShader16geometryModifier13lightingModelA2C07SurfaceF0V_AC08GeometryH0VSgAC08LightingJ0OtKcfc"
  },
  "title" : "init(surfaceShader:geometryModifier:lightingModel:)"
}
-->

# init(surfaceShader:geometryModifier:lightingModel:)

Creates a custom material from a lighting model, surface shader, and
geometry modifier.

```
init(surfaceShader: CustomMaterial.SurfaceShader, geometryModifier: CustomMaterial.GeometryModifier? = nil, lightingModel: CustomMaterial.LightingModel) throws
```

## Parameters

`surfaceShader`

The surface shader function.

`geometryModifier`

The geometry modifier shader function.

`lightingModel`

The lighting model.

## Discussion

This initializer creates a custom material using a lighting model you
specify, which determines how RealityKit renders the output of your
shader functions. The [`CustomMaterial.LightingModel.lit`](/documentation/RealityKit/CustomMaterial/LightingModel-swift.enum/lit)
and [`CustomMaterial.LightingModel.clearcoat`](/documentation/RealityKit/CustomMaterial/LightingModel-swift.enum/clearcoat) use
RealityKit’s physically-based shaders to render the entity based on the
output of your shader functions. When using these lighting models,
RealityKit uses all provided material attributes like
[`baseColor`](/documentation/RealityKit/CustomMaterial/baseColor-swift.property),
[`metallic`](/documentation/RealityKit/CustomMaterial/metallic-swift.property) and
[`normal`](/documentation/RealityKit/CustomMaterial/normal-swift.property).

The [`CustomMaterial.LightingModel.unlit`](/documentation/RealityKit/CustomMaterial/LightingModel-swift.enum/unlit) lighting model
renders the entity with no shadows or surface effects. This lighting
model only supports [`baseColor`](/documentation/RealityKit/CustomMaterial/baseColor-swift.property) and
[`blending`](/documentation/RealityKit/CustomMaterial/blending-swift.property).

---

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)