Nodes/ComfyUI Layer Style/LayerMask: MaskGradient
ComfyUI Node Runs on cloud

LayerMask: MaskGradient

Fade a mask off from one edge

By chflame163·Created 3 years ago·Updated 8 days ago· 3,118
LayerMask: MaskGradient
  • mask
  • mask
â—„invert_masktrueâ–º
◄gradient_side▾►
â—„gradient_scale100â–º
â—„gradient_offset0â–º
â—„opacity100â–º

This node takes a mask and fades it out toward one side - top, bottom, left, or right - so instead of a hard-edged region you get a smooth falloff. Think reflections that dissolve into nothing, a subject that fades at the bottom of the frame, a gradient composite where one layer melts into another, or a directional vignette. It's the "make this mask disappear gradually" tool.

Where it earns its place is any effect that needs a transition rather than a switch. A gradient mask feeding a composite gives you a soft blend along an axis; a gradient mask feeding a color adjustment gives you a graduated filter like the ND grads landscape photographers clip on their lenses.

How it works

It multiplies your incoming mask by a linear ramp running in the direction you choose. Pixels near the "full" side stay at their mask value; pixels toward the fade side get scaled down to zero across the ramp. gradient_scale sets how long the ramp is (how gradual the fade), and gradient_offset slides where it starts.

The inputs and outputs that matter

  • mask (MASK) - the region to fade.
  • invert_mask (BOOLEAN, default true) - note the default. If the fade is happening on the wrong content, this flip is usually why.
  • gradient_side - which edge the fade runs toward: top, bottom, left, right.
  • gradient_scale (INT, 1–9999, default 100) - the length of the falloff. Bigger = longer, more gradual fade. This is your main shape control.
  • gradient_offset (INT, −9999 to 9999, default 0) - shifts the ramp's start point up/down or left/right so the fade begins where you want.
  • opacity (INT, 0–100, default 100) - overall strength of the gradient's effect on the mask.

Output is a single faded mask (MASK).

How to install it

ComfyUI Manager → search ComfyUI Layer Style → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle

Restart to install requirements. No model needed.

Common issues & troubleshooting

A missing node here is the pack-level IMPORT FAILED problem - ComfyUI_LayerStyle didn't load. Check the startup console. The two recurring causes across this pack: a stale install from before it split into ComfyUI_LayerStyle and ComfyUI_LayerStyle_Advanced (delete the old folder, reinstall clean), or a broken dependency in your environment crashing the import. Reinstall via Manager.

For the effect: the invert_mask default of true is the usual "why is it fading the wrong part" surprise - toggle it. If the fade is too abrupt, raise gradient_scale; too gradual, lower it. If the transition starts in the wrong spot, that's gradient_offset. And this fades along a straight axis only - if you need a radial or circular falloff, this isn't the node; look at a shape/vignette generator instead.

Category😺dzNodes/LayerMask

Inputs (6)

NameTypeDefaultDescription
maskMASK—
invert_maskBOOLEANtrue—
gradient_sideCOMBO4 options: top, bottom, left, right
gradient_scaleINT1001–9999—
gradient_offsetINT0-9999–9999—
opacityINT1000–100—

Outputs (1)

NameTypeDescription
maskMASK—