Nodes/Avatar Graph/Object Vertex Group Levels
ComfyUI Node

Object Vertex Group Levels

Offset and gain, the audio-engineer way

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Object Vertex Group Levels
  • BPY_OBJ
  • group_select_mode
  • BPY_OBJ
offset0.00
gain1.00

If you've ever tweaked a gain knob and an offset knob on an audio mixer, Object Vertex Group Levels will feel familiar: it remaps every weight in a group through the formula new_weight = (old_weight - offset) * gain. That's exactly what the Blender operator bpy.ops.object.vertex_group_levels() does, and the Avatar Graph pack wraps it as a node.

Why does a weight-remap matter in an avatar pipeline? Because influence is a curve, not a switch. Say your "smile" group drives a shape key, but at full weight the smile is too strong and at the edges it bleeds into the cheeks. You don't want to repaint - you want to compress the whole range: raise offset to trim the bottom of the curve (stop the weak-edge bleed), or lower gain to pull back the peaks (tame the overshoot). If the group barely moves the mesh, a gain above 1 amplifies everything. It's the cheapest form of weight sculpting there is, and it's fully automated.

The knobs: offset is a float from -1 to 1, default 0 - shift the weight distribution up or down (positive offset subtracts from every weight, thinning the group out). gain is a float from 0 up, default 1 - scale the spread; 1.5 boosts everything, 0.5 relaxes it. group_select_mode is the recurring B_ENUM input (a string passed through the pack's "ENUM (Blender)" node, resolved against Blender's enum at runtime) - leave it unwired for the default active-group target. Input is BPY_OBJ, output is the same object with the group's weights remapped.

A practical note on combining it with Object Vertex Group Invert: if a group is all-or-nothing (weights pinned at 1.0), there's no distribution left to adjust - an invert after that can come out empty. Running Levels with a small offset to break the all-ones ceiling first gives the group headroom, and then invert behaves. That pairing is a classic weight-pipeline trick in this pack.

Install is pack-wide: ComfyUI Manager → "Avatar Graph", or git clone https://github.com/avatechai/avatar-graph-comfyui into ComfyUI/custom_nodes and pip install -r requirements.txt on Python 3.10 (bpy==3.6.0). First launch downloads the ~2.4 GB SAM model.

Troubleshooting: the failure to watch is gain = 0, which zeroes every weight and empties the group - easy to fat-finger and hard to notice until a shape key goes dead. And since the pack resets the scene each run, Levels is per-run and deterministic; if a result looks wrong, tweak the numbers and re-run, there's no persistent state to fight.

Categoryblender

Inputs (4)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
group_select_modeoptB_ENUM
offsetoptFLOAT0.00-1–1
gainoptFLOAT1.000–3.402823466385289e+38

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ