Nodes/BrainDead Nodes/BD Sample Voxelgrid Colors
ComfyUI Node

BD Sample Voxelgrid Colors

Pull TRELLIS2's color data out of the voxels and onto the mesh

By BizaNator·Created 8 months ago·Updated 3 days ago· 15
BD Sample Voxelgrid Colors
  • mesh
  • voxelgrid
  • mesh
  • color_field
  • status
sampling_modeface
default_color0.5,0.5,0.5,1.0
distance_threshold3.0

TRELLIS.2's textured output is a voxelgrid - a sparse 3D field of color-bearing voxels - plus a mesh to sample it onto. The mesh doesn't inherently know its colors; something has to transfer them. BD Sample Voxelgrid Colors is that something: it samples color from a TRELLIS2 voxelgrid onto the vertices of a mesh, in three different modes that control the crucial question of whether your colors bleed across triangle edges or stay cleanly per-face.

What it is

A TRIMESH + VOXELGRID in, TRIMESH + COLOR_FIELD out. You feed it the mesh and voxelgrid outputs of a TRELLIS.2 node (or the loaded .vxz from BD Load OVoxel), pick a sampling_mode, and get a mesh carrying vertex colors plus a COLOR_FIELD for deferred color application.

How it works

The three modes are really a tradeoff between color cleanliness and edge detectability:

  • face (default) - one solid color per face, sampled at the face's corner. No bleeding between faces, because it splits vertices so each face gets its own copies. The side effect that matters: because colors change discretely at face boundaries, edge marking works - feed this to BD Blender Edge Marking (or anything that detects hard edges from color) and it can see the seams.
  • sharp - per-vertex nearest-neighbor (k=1). Colors are shared at edges, which is smoother but means edge marking can't detect boundaries - the color gradient is continuous across them.
  • smooth - per-vertex k=4 blended. Smooth gradients for a high-poly look; same caveat, edge marking won't see boundaries.

The other controls: default_color (RGBA, used for vertices too far from any voxel - default mid-gray 0.5,0.5,0.5,1.0) and distance_threshold (max voxel distance before falling back to default, default 3).

Outputs: the colorized mesh, a color_field (the raw sampled color field, if you want to apply it later via BD Apply Color Field instead of baking now), and status.

Where it fits

This is the front half of the low-poly pipeline. The README's recommended flow:

BD Sample Voxelgrid Colors (face mode) → BD Smart Decimate → BD Transfer Vertex Colors (face mode)

Sample colors onto the high-poly mesh, decimate it, then transfer the colors back in face mode so the decimated mesh keeps crisp, non-bleeding per-face colors - the stylized game-asset look. If your end goal is a textured mesh rather than vertex colors, you'd reach for BD OVoxel Bake instead, which bakes a full PBR material. Vertex colors and textures are different deliveries, and this node is squarely the vertex-color one.

Gotchas

The mode choice is the thing people get wrong. If you sample in smooth and then wonder why edge marking finds nothing, that's not a bug - the mode is the cause. And if the mesh comes out gray in patches, distance_threshold is too low for your voxel resolution; nudge it up. The TRIMESH/VOXELGRID types come from the pack's TRELLIS2 integration, which needs the separate ComfyUI-TRELLIS2 pack installed (see below).

Installing it

ComfyUI Manager: search "BrainDead" → install. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/BizaNator/ComfyUI-BrainDead
cd ComfyUI-BrainDead
pip install -r requirements.txt

Restart, find it under 🧠BrainDead/Mesh. For anything voxelgrid-related you also need ComfyUI-TRELLIS2 installed - the BrainDead TRELLIS2 nodes import the trellis2 package from that sibling pack, so without it the node reports that TRELLIS2 is unavailable. With both in place, wire voxelgrid from your TRELLIS.2 texture node and start in face mode.

Category🧠BrainDead/Mesh

Inputs (5)

NameTypeDefaultDescription
meshTRIMESH
voxelgridVOXELGRID
sampling_modeoptCOMBOfaceface=CORNER domain (edge marking works) | sharp=POINT k=1 | smooth=POINT k=4 blended
default_coloroptSTRING0.5,0.5,0.5,1.0
distance_thresholdoptFLOAT3.01–10Max voxels distance before using default color

Outputs (3)

NameTypeDescription
meshTRIMESH
color_fieldCOLOR_FIELD
statusSTRING