This repository has been archived on 2026-10-29. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
This tutorial walks you through creating a script that turns any mesh into voxels.
> This tutorial requires Blender 3.4+ for the *Distribute Points In Volume* node.
## Setting Up
Create a base mesh. I'll be using a Monkey primitive.

Next, create a new script. Setting up an [external editor](../setup/external-editing.md) is recommended.
Import Geometry Script, and create a basic tree builder function. We'll add a `geometry` argument and annotate it with the `Geometry` type to receive our base mesh (in this case, a monkey).
```python
from geometry_script import *
@tree("Voxelize")
def voxelize(geometry: Geometry):
return geometry
```
Run the script to create the tree, then add a *Geometry Nodes* modifier to your mesh and select the *Voxelize* node group.

## Arguments
Add a new argument `resolution: Float`. Give it a default value of `0.2`. This value will be used throughout the script to configure spacing and voxel density.
Next, we need to create points to instance each voxel cube on. Use `distribute_points_in_volume` with the mode set to `DENSITY_GRID` to create a uniform distribution of points.