---
title: Compute Graph
framework: ComputeGraph
role: collection
role_heading: Framework
platforms: [iOS 27.0+, iPadOS 27.0+, Mac Catalyst 27.0+, macOS 27.0+, tvOS 27.0+, visionOS 27.0+, reality composer pro 3.0+]
path: computegraph
---

# Compute Graph

Build and run custom particle effects and compute simulations for RealityKit using a programmable node graph.

## Overview

Overview Compute Graph is a node-based framework for building particle simulations and general-purpose GPU compute graphs in RealityKit. Where ShaderGraph lets you build material appearance through a node-based visual editor, Compute Graph provides the same graph-driven, connection-based authoring for simulation behavior. Use Compute Graph when you build tools or editors that need fine-grained, per-stage control over how simulations execute on the GPU. Reality Composer Pro uses this framework to author and preview particle systems for RealityKit scenes. The Swift API centers on a three-step compilation pipeline. Describe a simulation as a ComputeNodeGraph, a directed graph of typed nodes and edges. Then produce a ComputeNodeGraph.Assembly from the graph, which resolves the buffer, uniform, and texture layout the simulation requires. Compile that assembly into ComputeNodeGraph.Pipelines to produce GPU shader code; a single set of pipelines can back multiple ComputeGraphSimulation instances running concurrently. Supply custom Metal Shading Language functions through a ComputeNodeGraph.Library alongside the framework’s built-in node namespaces. At runtime, ComputeGraphSimulation drives GPU execution. Call advance(_:) each frame, passing a ComputeGraphSimulation.AdvanceParams that carries the time delta, a Metal command buffer, a compute encoder, and optional world-space transforms. To inject elements programmatically, call spawn(elements:in:using:) with ElementSpawnParameters values that set each element’s initial position, velocity, size, color, and lifetime.

## Topics

### Graph definition and assembly

- [ComputeNodeGraph](computegraph/computenodegraph.md)
- [ComputeNodeGraph.Assembly](computegraph/computenodegraph/assembly.md)
- [ComputeNodeGraph.Pipelines](computegraph/computenodegraph/pipelines.md)
- [ComputeNodeGraph.PipelinesDescriptor](computegraph/computenodegraph/pipelinesdescriptor.md)
- [ComputeNodeGraph.NodeDefinition](computegraph/computenodegraph/nodedefinition.md)
- [ComputeNodeGraph.Library](computegraph/computenodegraph/library.md)
- [ComputeNodeGraph.LibraryReference](computegraph/computenodegraph/libraryreference.md)

### Node parameters and connections

- [PortReference](computegraph/portreference.md)
- [BinaryOperation](computegraph/binaryoperation.md)
- [UnaryOperation](computegraph/unaryoperation.md)
- [StandardLibraryFunction](computegraph/standardlibraryfunction.md)

### Simulation-stage nodes

- [element](computegraph/element.md)
- [emitter](computegraph/emitter.md)
- [initialize](computegraph/initialize.md)
- [module](computegraph/module.md)
- [output](computegraph/output.md)
- [force](computegraph/force.md)

### Utility nodes

- [graph](computegraph/graph.md)
- [group](computegraph/group.md)
- [texture](computegraph/texture.md)
- [random](computegraph/random.md)
- [matrix4x4f](computegraph/matrix4x4f.md)
- [matrix4x4h](computegraph/matrix4x4h.md)
- [viewpoint](computegraph/viewpoint-swift.func.md)
- [element_integrate](computegraph/element_integrate.md)
- [texture_sample](computegraph/texture_sample.md)
- [texture_sample1d](computegraph/texture_sample1d.md)
- [orient_to_velocity](computegraph/orient_to_velocity.md)
- [gridDebugCells](computegraph/griddebugcells.md)
- [gridFromPoints](computegraph/gridfrompoints.md)
- [spawn_demo](computegraph/spawn_demo.md)

### Running a simulation

- [ComputeGraphSimulation](computegraph/computegraphsimulation.md)
- [ElementSpawnParameters](computegraph/elementspawnparameters.md)
- [ElementGrouping](computegraph/elementgrouping.md)
- [ComputeGraphSimulation.SimulationRate](computegraph/computegraphsimulation/simulationrate-swift.struct.md)
- [Sorting](computegraph/sorting.md)

### Graph resources

- [ComputeNodeGraph.SamplerSettings](computegraph/computenodegraph/samplersettings.md)
- [ComputeNodeGraph.SwizzleChannels](computegraph/computenodegraph/swizzlechannels.md)
- [AddressSpace](computegraph/addressspace.md)

### Geometry and simulation inputs

- [ComputeNodeGraph.Topology](computegraph/computenodegraph/topology.md)
- [CoordinateSpace](computegraph/coordinatespace.md)
- [ComputeNodeGraph.StructureLayout](computegraph/computenodegraph/structurelayout.md)
- [StripOrientation](computegraph/striporientation.md)
- [Viewpoint](computegraph/viewpoint-swift.struct.md)
- [MouseParams](computegraph/mouseparams.md)

### Functions

- [filteredLinesFromNeighbors](computegraph/filteredlinesfromneighbors.md)
- [linesFromNeighbors](computegraph/linesfromneighbors.md)
