SkinTokens Clean Weights
SkinTokens Clean Weights repairs skin weights with math, not magic
- glb
- cleaned_glb
At rest, a badly skinned character looks fine. You rig it, you pose it, nothing moves, nothing looks wrong. Then you animate it and the hand explodes - some fingertip vertices get dragged across the body toward a toe that's suddenly moving. Classic rigging horror story, and it's caused by skin weights that blend across the skeleton: a vertex weighted to a hand bone and a foot bone. That's the failure mode SkinTokens Clean Weights exists to kill.
It's a deterministic, offline repair pass over a rigged glb - no model, no GPU, no 14 GB download. It reads a rigged file, finds skin influences that are geometrically impossible, removes them, and writes a cleaned glb. It's the standalone sibling of the clean_weights flag baked into SkinTokens Rig, which runs this same repair automatically after rigging. So the obvious question is: if Rig does it by default, when do you ever need this node alone?
When to reach for it
Three situations. You turned clean_weights off during rigging to get a faster pass and are now seeing tearing. You have a rigged glb from another source - the older Blender-dependent SkinTokens packs, an external auto-rigger - and want the same cleanup without re-rigging. Or you just want to tune how aggressive the repair is after the fact, because the Rig node's internal pass uses the fixed default.
How it works
The insight is that good skinning is local: a vertex should only be influenced by bones that are near each other in the skeleton. So the repair measures distance not in metres but in skeleton-graph hops - scale-free, no thresholds that depend on mesh size. For each vertex weighted to two bones at least min_hops apart, it drops the influence on whichever contaminating bone is geometrically farther from the vertex, then renormalizes the survivors.
The default of 5 hops is chosen carefully: the widest legitimate anatomical blend (left leg ↔ right leg through the hips) is 4 hops, so contamination - a hand vertex on a toe, the maximally distant pair - starts at 5. The near, correct bone always survives, which is what keeps finger articulation intact. A blunt "collapse everything to the wrist" fix would kill your fingers; this one doesn't. It only rewrites the JOINTS_0/WEIGHTS_0 buffers - geometry and skeleton are untouched.
Inputs and output
- glb - a
FILE_3D_GLB,FILE_3D_GLTF, or genericFILE_3D. It must be rigged: the node raises "glb has no skin (not a rigged mesh)" on a bare mesh. - filename_prefix -
skintokens_cleanedby default; output goes to ComfyUI's output directory with collision-proof naming. - min_hops (optional) - the sensitivity knob, default 5. The tooltip says it best: flag an influence when a vertex is weighted to two bones at least this many hops apart. Crank it up if the repair is catching too much; drop it toward 4 if you're still seeing tearing and want a more aggressive pass. Going much below 4 starts eating legitimate blends, so don't.
Output is a single cleaned_glb on a FILE_3D_GLB socket - straight into Preview3DAdvanced or Save3D, or onward toward an animation stage.
Install
ComfyUI Manager (search SkinTokens-NoBlender), or:
cd ComfyUI/custom_nodes
git clone https://github.com/stevelittlefish/ComfyUI-SkinTokens-NoBlender
pip install -r ComfyUI-SkinTokens-NoBlender/requirements.txt
The repair engine is pure numpy plus pygltflib, so this is the cheapest node in the pack to run - no model load, and it'll work even before you've ever downloaded the big rigging weights.
One honest caveat: this fixes contamination - cross-body weight leaks. It won't fix skinning that's merely sloppy within a limb, or weights a rigger would just call bad. For everything else, this is the "exploding hand" cure, applied with actual reasoning about the skeleton instead of hoping.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| glb | FILE_3D_GLB,FILE_3D_GLTF,FILE_3D | — | |
| filename_prefix | STRING | skintokens_cleaned | — |
| min_hopsopt | INT | 52–20 | Flag an influence when a vertex is weighted to two bones at least this many skeleton-graph hops apart. 5 is above the widest anatomical blend (leg<->leg via hips = 4). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| cleaned_glb | FILE_3D_GLB | — |