Nodes/ComfyUI-Voxels/Voxel Block Saver
ComfyUI Node

Voxel Block Saver

Save a voxel block to disk so you can reload it without redoing the mesh

By DanielHabib·Created 2 years ago·Updated 2 years ago· 4
Voxel Block Saver
  • voxel_block
  • filename
filename_prefixvoxel_blocks

Voxel Block Saver is the pack's write-half: it takes a VOXEL_BLOCK, serializes it to disk as a JSON file, and tells you the filename. If you've just voxelized a mesh you like, this is how you stop re-running the mesh step every time you want to look at it again.

How it works

The node builds the pack's own "6dv" JSON format - a header (Version, Dimensions, Framerate, Framecount, block_count, Title, Description) plus a Blocks array holding the voxel data as one flat list. Each entry is either null (empty space) or a hex string like #ff8040ff (RGBA). Empty voxels are the Nones; occupied ones carry their color. The whole thing is written with a counter that starts from whatever voxel_block_*.json files already exist in the destination folder.

Two implementation details matter in practice:

  • Files land in output/<filename_prefix>/voxel_block_<N>.json, relative to ComfyUI's working directory. In a normal install that means ComfyUI/output/ - the same place your images go.
  • The counter only scans that one prefix folder. Change the prefix and the numbering restarts at 1, which is fine until you have two prefixes that both produced a voxel_block_1.json.

The inputs and outputs

Only two inputs:

  • voxel_block (VOXEL_BLOCK) - whatever you got out of Mesh To Voxel or the loader.
  • filename_prefix (STRING, default "voxel_blocks") - the subdirectory name, not the full filename. This is the one you'll actually set.

The output is filename (STRING) - the node returns voxel_block_<N> without the .json extension, so if you're feeding the name into something that expects a path, add it yourself. It's also marked an output node, so it won't get pruned out of the graph even if nothing downstream uses it.

Who reads these files

Only the pack's own loader can make sense of them. Voxel Block Loader takes a whole directory of these files and returns them as a list of blocks, which is exactly what the video node wants. That's the intended flow: save the frames you like, then feed the folder to the loader and on to Voxel Blocks Into Voxel Video.

One honest warning: this "6dv" format is the author's own invention, and it's not fully consistent even inside the pack - the saver writes block_count and Framecount, while the video maker writes Block_count. Both get read back correctly by their matching loader because each only reads the keys it needs, but don't expect this file format to interoperate with anything outside ComfyUI-Voxels.

Installing it

Same story as the rest of the pack - no requirements.txt, so dependencies are on you (numpy is really the only thing this node touches, and you almost certainly have it):

# ComfyUI Manager: search "ComfyUI-Voxels", or:
cd ComfyUI/custom_nodes
git clone https://github.com/DanielHabib/ComfyUI-Voxels
# restart ComfyUI

This is one of the more solid nodes in the pack: the save/load path actually round-trips, which is more than you can say for every node here. And like everything else, it's a single-commit project from September 2024 - don't expect updates, but the basic save feature works as advertised.

CategoryVoxels

Inputs (2)

NameTypeDefaultDescription
voxel_blockVOXEL_BLOCK
filename_prefixSTRINGvoxel_blocks

Outputs (1)

NameTypeDescription
filenameSTRING