<!--
{
  "availability" : [
    "macOS: 10.11.0 - 10.12.0"
  ],
  "documentType" : "symbol",
  "framework" : "ModelIO",
  "identifier" : "/documentation/ModelIO/MDLVoxelArray/init(asset:divisions:interiorNBWidth:exteriorNBWidth:patchRadius:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Model I/O"
    ],
    "preciseIdentifier" : "c:objc(cs)MDLVoxelArray(im)initWithAsset:divisions:interiorNBWidth:exteriorNBWidth:patchRadius:"
  },
  "title" : "init(asset:divisions:interiorNBWidth:exteriorNBWidth:patchRadius:)"
}
-->

# init(asset:divisions:interiorNBWidth:exteriorNBWidth:patchRadius:)

Initializes a voxel array that models the volume of 3D objects in the specified asset, creating voxel shells for the specified distances from the object’s surface.

```
init(asset: MDLAsset, divisions: Int32, interiorNBWidth: Float, exteriorNBWidth: Float, patchRadius: Float)
```

## Parameters

`asset`

An asset containing meshes whose volume is to be modeled as voxels.

`divisions`

The number of divisions to create along the y-axis of the asset’s bounding box; that is, the height in voxels of the resulting voxel array.

`interiorNBWidth`

The distance, in units of the asset’s root coordinate space, inside the object’s surface for which to generate additional voxels.

`exteriorNBWidth`

The distance, in units of the asset’s root coordinate space, outside the object’s surface for which to generate additional voxels.

`patchRadius`

The largest radius, in world space units, of patches to apply to create closed volumes from meshes in the asset.

## Return Value

A new voxel array.

## Discussion

When you create a voxel array from an asset, Model I/O analyzes any meshes contained in the asset to determine the volume of the 3D objects modeled by those meshes. This initializer discretizes that volume by dividing the asset’s [`boundingBox`](/documentation/ModelIO/MDLAsset/boundingBox) coordinates into a three-dimensional grid. The `divisions` parameter determines the height of the grid in voxels. A single voxel is a cubic unit, so the width and depth of the grid in voxels is proportional to its height and the bounding box of the asset.

After dividing the bounding box into a grid, Model I/O generates a shell of voxels at the grid positions corresponding to points on the mesh’s surface. Each voxel is a [`MDLVoxelIndex`](/documentation/ModelIO/MDLVoxelIndex) value whose x, y, and z coordinates locate the voxel in the grid and whose w coordinate value is 0, indicating that the voxel is on the surface of the object.

If you pass a value greater than zero for the `interiorNBWidth` or `exteriorNBWidth` parameter, this initializer also generates voxel data for the grid positions within or outside of the surface. For example, if you pass an `interiorNBWidth` value of `2.5`, Model I/O generates concentric shells of voxels inside the surface such that the distance from each voxel to the surface is no greater than 2.5 units. For those voxels, the w coordinate indicates how many shells lie between that voxel and the surface shell.

---

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)