---
title: "cullMeshInstances(_:indices:outIndices:configuration:)"
framework: realitykit
role: symbol
role_heading: Type Method
path: "realitykit/lowlevelrenderer/cullmeshinstances(_:indices:outindices:configuration:)"
---

# cullMeshInstances(_:indices:outIndices:configuration:)

Culls mesh instances against a frustum, writing surviving indices to an output span.

## Declaration

```swift
static func cullMeshInstances(_ meshInstances: LowLevelMeshInstanceArray, indices: Span<Int>, outIndices: inout OutputSpan<Int>, configuration: LowLevelRenderer.CullConfiguration)
```

## Parameters

- `meshInstances`: The mesh instance array to test.
- `indices`: The candidate indices to test.
- `outIndices`: The span that receives surviving indices. Must have free capacity of at least indices.count.
- `configuration`: The cull configuration supplying the frustum planes.

## Discussion

Discussion Tests each instance’s bounds against the planes in configuration.frustum, using meshInstance.bounds when set and falling back to the mesh part’s bounds otherwise. Instances whose bounds lie entirely outside any single plane are discarded; the rest are appended to outIndices in the same order as indices. nil slots in meshInstances are skipped.

## See Also

### Culling and sorting instances

- [cullMeshInstances(_:indices:configuration:)](realitykit/lowlevelrenderer/cullmeshinstances(_:indices:configuration:).md)
- [LowLevelRenderer.CullConfiguration](realitykit/lowlevelrenderer/cullconfiguration.md)
- [sortMeshInstances(_:indices:configuration:)](realitykit/lowlevelrenderer/sortmeshinstances(_:indices:configuration:).md)
- [LowLevelRenderer.SortConfiguration](realitykit/lowlevelrenderer/sortconfiguration.md)
