Nodes/BrainDead Nodes/BD Mesh to OVoxel
ComfyUI Node

BD Mesh to OVoxel

Turn a textured mesh back into a voxelgrid — the round-trip that unlocks retexturing

By BizaNator·Created 8 months ago·Updated 3 days ago· 15
BD Mesh to OVoxel
  • mesh
  • voxelgrid
  • status
grid_size512
face_weight1.0
boundary_weight0.20
regularization_weight0.010

BD Mesh To OVoxel converts a textured mesh into the pack's VOXELGRID format - the sparse voxel representation at the heart of its TRELLIS2 baking pipeline. If you've only ever seen the voxelgrid → mesh direction (TRELLIS2 spits out a voxelgrid, BD OVoxel Bake turns it into a mesh + PBR textures), this is the reverse direction, and it's what makes the whole system a loop instead of a one-way street.

Why reverse direction? The headline use case is retexturing a mesh onto different topology. You have a mesh you like - say, an imported GLB or a previously baked result - and you want to bake its PBR material onto a different mesh with a different UV layout. The voxelgrid is the neutral intermediate: this node voxelizes the geometry and extracts the PBR attributes (albedo, normal, roughness, metallic) into a sparse voxel tensor, then BD OVoxel Bake or BD OVoxel Texture Bake can re-bake from that grid onto the new mesh. The material survives the topology change because it lives in the voxels, not in the old mesh's UVs.

The KB's 3D essay is the background here: TRELLIS.2's "O-Voxel" is a field-free sparse-voxel latent, and this pack's whole bake system is built around that representation. This node is the "import anything → voxelgrid" gate, so the pipeline isn't locked to meshes that came out of TRELLIS2.

How it works

It voxelizes the geometry (flexible dual grid with QEF-style weights) and samples the mesh's material into voxels:

  • grid_size (default 512) - voxel grid resolution. Higher = more detail and more memory. This is the main quality/cost dial; 512 is a sane default, and you'll feel it if you jump toward 1024.
  • face_weight (default 1) - the geometry term weight for voxelization.
  • boundary_weight (default 0.2) - the boundary term weight.
  • regularization_weight (default 0.01) - the smoothness term.

The three weights are QEF-style tuning knobs for how faithfully the voxel grid captures the surface. Defaults are reasonable for a first pass; if the re-baked result looks faceted or the geometry reads soft, that's when you nudge face_weight up.

The mesh input needs to actually carry PBR material/textures - the node's own tooltip is explicit that the mesh "needs PBR material/textures for attribute extraction." A bare white geometry mesh in will give you a bare voxelgrid out, because there's nothing to extract.

Outputs

voxelgrid (the VOXELGRID - feed it to BD OVoxel Bake or BD OVoxel Texture Bake) and a status string.

Installing

Standard BrainDead install - ComfyUI Manager search "BrainDead" or clone + pip install -r requirements.txt, restart. It uses the pack's vendored o_voxel code plus trimesh, and requires a current ComfyUI (V3 API).

The honest gotcha

Voxelizing is a lossy intermediate step - you're rasterizing surface detail into a 512³ grid, so very fine texture detail (thin seams, tiny text) can smear. For game-scale parts (the pack's actual use: character parts, props, baked PBR), it's more than adequate and the re-bake is consistent. For a model where sub-pixel texture detail is the whole point, keep the original mesh and skip the round-trip.

Category🧠BrainDead/Mesh

Inputs (5)

NameTypeDefaultDescription
meshTRIMESHTextured mesh to voxelize (needs PBR material/textures for attribute extraction)
grid_sizeINT512128–1024Voxel grid resolution. Higher = more detail, more memory
face_weightFLOAT1.00.1–5QEF face term weight for geometry voxelization
boundary_weightFLOAT0.200.01–2QEF boundary term weight
regularization_weightFLOAT0.0100.001–0.5QEF regularization weight

Outputs (2)

NameTypeDescription
voxelgridVOXELGRID
statusSTRING