Nodes/KJNodes for ComfyUI/Create Fluid Mask
ComfyUI Node Runs on cloud

Create Fluid Mask

An animated mask from a tiny fluid sim

By kijai·Created 3 years ago·Updated about 9 hours ago· 2,930
Create Fluid Mask
    • IMAGE
    • MASK
    invertfalse
    frames1
    width256
    height256
    inflow_count3
    inflow_velocity1
    inflow_radius8
    inflow_padding50
    inflow_duration60

    Most procedural mask generators give you clean geometry - a wipe, a fade, a hard-edged shape. This one gives you something that actually looks like it's flowing: a small fluid simulation with a handful of inflow sources emitting into a canvas, rendered out as an animated sequence. If a straight geometric wipe reads as too mechanical for a reveal or transition, this is the organic alternative in the same pack.

    The inputs that matter

    • frames (default 1) - total output length.
    • width / height (default 256 each) - canvas size.
    • inflow_count (default 3) - how many separate fluid sources are placed on the canvas.
    • inflow_velocity (default 1) - how fast fluid emits from each source.
    • inflow_radius (default 8) - the size of each source.
    • inflow_padding (default 50) - margin from the frame edge sources are placed within.
    • inflow_duration (default 60) - how many frames each source keeps actively emitting before it stops.
    • invert (default false) - flips the result.

    Outputs: IMAGE and MASK, both at once - unlike this pack's older CreateAudioMask, which only produced an IMAGE and left you to convert it separately, this node hands you a ready-to-use mask directly alongside the viewable image.

    How to install it

    Via ComfyUI Manager: search KJNodes for ComfyUI, install, restart. Manually:

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

    Then restart. No models - this is a self-contained simulation, nothing to download.

    Common issues & troubleshooting

    The fluid stops moving partway through the clip. Check inflow_duration against frames - if inflow_duration is shorter than your total frame count, the sources stop emitting once it runs out, and what you see afterward is the existing fluid drifting under its own momentum rather than continuing to grow. Set inflow_duration close to or equal to frames if you want active churn for the entire clip.

    The mask never covers enough of the frame by your target frame count. Raise inflow_count or inflow_radius before extending frames itself - both push toward a fuller mask faster than simply giving the same sources more time.

    Generation is slower than you expected for a "simple" mask. This is an actual simulation, not a static pattern - run time scales with both frames and inflow_count. A long clip with several sources is meaningfully more work than a short one with a single source; budget accordingly if this feeds into a heavier downstream video sampler.

    Sources are clipping right at the frame edge. That's what inflow_padding controls - raise it if sources are spawning too close to the border for your taste, since it sets the margin they're placed within, not just a visual buffer.

    CategoryKJNodes/masking/generate

    Inputs (9)

    NameTypeDefaultDescription
    invertBOOLEANfalse
    framesINT11–4096
    widthINT25616–4096
    heightINT25616–4096
    inflow_countINT30–255
    inflow_velocityINT10–255
    inflow_radiusINT80–255
    inflow_paddingINT500–255
    inflow_durationINT600–255

    Outputs (2)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK