Nodes/AnimateDiff Evolved/Multival Scaled Mask πŸŽ­πŸ…πŸ…“
ComfyUI Node Runs on cloud

Multival Scaled Mask πŸŽ­πŸ…πŸ…“

Remapping a mask's grayscale into a real strength range

By KosinkadinkΒ·Created 3 years agoΒ·Updated 8 days agoΒ· 3,519
Multival Scaled Mask πŸŽ­πŸ…πŸ…“
  • mask
  • MULTIVAL
β—„min_float_val0.000β–Ί
β—„max_float_val1.000β–Ί
β—„scalingβ–Ύβ–Ί

A plain mask is 0 to 1 - black to white. Plenty of the pack's strength dials aren't naturally happy sitting in that range: motion scale and effect strength both regularly go well past 1 for a stronger-than-default effect. Feeding a raw mask straight in as your strength value locks you into that narrow 0–1 window whether it makes sense or not. This node fixes that: it remaps a mask's grayscale into whatever min/max range you actually want, then hands back a proper MULTIVAL built from that remapped range.

How it works

Paint or generate a mask the normal way - soft gradients, hard edges, whatever shape you need - then set min_float_val and max_float_val to the actual strength range you want that mask to represent. Black in the mask becomes min_float_val, white becomes max_float_val, and everything in between gets scaled proportionally. Say you want a region to range from a gentle 0.5 motion scale up to an exaggerated 2.0: paint the mask normally, set min_float_val to 0.5 and max_float_val to 2.0, and the node handles the remapping so you don't have to pre-scale the mask's actual pixel values by hand.

scaling is an optional dropdown controlling how that remapping happens across the range - the shape of the mapping between the mask's grayscale and your min/max values, rather than the flat linear stretch you'd get by default.

The inputs and outputs that matter

Required: min_float_val (default 0) and max_float_val (default 1) - the real-world range the mask's black-to-white values get stretched into, and mask - the source mask defining the spatial pattern.

Optional: scaling - picks how the grayscale-to-range mapping is shaped.

Output is a single MULTIVAL, wired into whichever scale_multival/effect_multival slot you're targeting.

How to install it

ComfyUI Manager: search AnimateDiff Evolved, confirm the author is Kosinkadink, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved

then restart. No model download for this node - it's a value-building utility on top of whatever motion setup you already have working.

Common issues & troubleshooting

Effect looks inverted from what you expected. Check your mask's actual black/white orientation before assuming this node is misbehaving - a mask that's white where you meant "low strength" and black where you meant "high strength" will map exactly backward from your intent, since white always maps to max_float_val and black to min_float_val regardless of what you meant by them.

Set min_float_val and max_float_val and the range didn't change anything visible. Confirm the mask itself actually has grayscale variation rather than being flat black or flat white - a uniform mask maps to a single value no matter how wide you set the range, since there's no gradient for the range to stretch across.

Not sure whether you need this over a plain masked Multival. If a mask's raw 0–1 values already work fine for whatever you're driving - a straightforward on/off or 0-to-1 blend - the base Multival node with mask_optional wired in is simpler. Reach for this one specifically when the natural 0–1 mask range doesn't match the strength range the target input actually wants.

CategoryAnimate Diff πŸŽ­πŸ…πŸ…“/multival

Inputs (4)

NameTypeDefaultDescription
min_float_valFLOAT0.000β€”
max_float_valFLOAT1.000β€”
maskMASKβ€”
scalingoptCOMBO2 options: absolute, relative

Outputs (1)

NameTypeDescription
MULTIVALMULTIVALβ€”