<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/PortalMaterial/init(program:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation14PortalMaterialV7programA2C7ProgramV_tcfc"
  },
  "title" : "init(program:)"
}
-->

# init(program:)

Creates a portal material from a previously compiled program.

```
init(program: PortalMaterial.Program)
```

## Parameters

`program`

A compiled portal program. The resulting material
shares the program’s compiled shader artifact.

## Discussion

Because [`init(descriptor:)`](/documentation/RealityKit/PortalMaterial/Program-swift.struct/init(descriptor:)) is asynchronous,
preload the programs your scene needs once during setup, then use this
initializer to instantiate portal materials from them synchronously at
runtime — for example, when populating a model component each frame.

After creating the material, bind its shader inputs by calling
[`setParameter(name:value:)`](/documentation/RealityKit/PortalMaterial/setParameter(name:value:)) or [`setParameter(handle:value:)`](/documentation/RealityKit/PortalMaterial/setParameter(handle:value:)).

---

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)