<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/LowLevelInstanceTransformResource",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:19RealityCoreRenderer33LowLevelInstanceTransformResourceC"
  },
  "title" : "LowLevelInstanceTransformResource"
}
-->

# LowLevelInstanceTransformResource

A GPU-managed buffer that stores an array of per-instance transforms for GPU instancing.

```
final class LowLevelInstanceTransformResource
```

## Overview

Assign a `LowLevelInstanceTransformResource` to a [`LowLevelMeshInstance`](/documentation/RealityKit/LowLevelMeshInstance) via
[`setInstanceTransforms(_:)`](/documentation/RealityKit/LowLevelMeshInstance/setInstanceTransforms(_:)) to issue a single instanced draw
call that renders multiple copies of the mesh. Each entry in the buffer is a `float4x4`
model-to-local transform. The renderer computes the final world transform for each
instance as `meshInstance.transform * instanceTransforms[i]`.

Create a `LowLevelInstanceTransformResource` using
[`makeInstanceTransformResource(instanceCapacity:)`](/documentation/RealityKit/LowLevelRenderContext/makeInstanceTransformResource(instanceCapacity:)).

> Important: After creation, ``doc://com.apple.RealityKit/documentation/RealityKit/LowLevelInstanceTransformResource/instanceCount`` is `0`. Set it to the number of transforms
> you write before rendering.

## Topics

### Inspecting instance counts

[`var instanceCount: Int`](/documentation/RealityKit/LowLevelInstanceTransformResource/instanceCount)

The number of active instances to draw.

[`var instanceCapacity: Int`](/documentation/RealityKit/LowLevelInstanceTransformResource/instanceCapacity)

The maximum number of instances the buffer holds.

### Reading transform data

[`func read<R, E>((consuming Span<float4x4>) throws(E) -> R) throws(E) -> R`](/documentation/RealityKit/LowLevelInstanceTransformResource/read(_:))

Reads the current transform data synchronously on the CPU.

[`func read(commandBuffer: (any MTLCommandBuffer)?) -> any MTLBuffer`](/documentation/RealityKit/LowLevelInstanceTransformResource/read(commandBuffer:))

Returns a Metal buffer containing the current transform data for GPU read operations.

### Replacing transform data

[`func replace<R, E>((inout MutableSpan<float4x4>) throws(E) -> R) throws(E) -> R`](/documentation/RealityKit/LowLevelInstanceTransformResource/replace(_:))

Replaces all transform data synchronously on the CPU.

[`func replace(commandBuffer: (any MTLCommandBuffer)?) -> any MTLBuffer`](/documentation/RealityKit/LowLevelInstanceTransformResource/replace(commandBuffer:))

Returns a Metal buffer you populate on the GPU with the new transform data.

### Instance Methods

[`func update<R, E>((inout MutableSpan<float4x4>) throws(E) -> R) throws(E) -> R`](/documentation/RealityKit/LowLevelInstanceTransformResource/update(_:))

Updates the transform data in place synchronously on the CPU.

---

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)