<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/LowLevelRenderer/sortMeshInstances(_:indices:configuration:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:19RealityCoreRenderer08LowLevelC0C17sortMeshInstances_7indices13configurationyAA0deG13InstanceArrayC_s11MutableSpanVySiGzAC17SortConfigurationVtFZ"
  },
  "title" : "sortMeshInstances(_:indices:configuration:)"
}
-->

# sortMeshInstances(_:indices:configuration:)

Sorts the given mesh instances by sort category and, for transparent instances,
by back-to-front distance from the camera.

```
static func sortMeshInstances(_ meshInstances: LowLevelMeshInstanceArray, indices: inout MutableSpan<Int>, configuration: LowLevelRenderer.SortConfiguration)
```

## Parameters

`meshInstances`

The mesh instance array whose elements to sort.

`indices`

The index span to sort in place.

`configuration`

The sort configuration supplying the camera position.

## Discussion

Call this before `render(using:_:)` to produce a draw order for the callback.
Opaque instances sort before transparent ones; within transparent instances, farther
instances sort before nearer ones.

---

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)