Contents

PhysicallyBasedMaterial.Program

An object that represents the backing shader compilation required for physically based materials.

Declaration

final class Program

Overview

You can use this type to control when RealityKit compiles shaders, and to initialize PhysicallyBasedMaterial objects with more predicitable loading performance.

When initializing a PhysicallyBasedMaterial this way, a Program object is created first asynchronously, which is used to cache the material’s shader program so the PhysicallyBasedMaterial can be loaded immediately later.

For example:

// Initialize descriptor with desired properties
var descriptor = PhysicallyBasedMaterial.Descriptor()
descriptor.blendMode = .add

// Create program object
let program = await PhysicallyBasedMaterial.Program(descriptor: descriptor)

// Create material (returns immediately)
let material = PhysicallyBasedMaterial(program: program)

Topics

Structures

Initializers

Instance Properties