KJNodes/masking/generategenerated

Create Fluid Mask(CreateFluidMask)

This node is implemented based on a stable fluid dynamics algorithm, simulating the diffusion process of dye in a fluid by setting multiple inflow points and controlling their physical properties such as velocity and radius.

Create Fluid Mask

IMAGE
MASK
invert
frames
1
width
256
height
256
inflow_count
3
inflow_velocity
1
inflow_radius
8
inflow_padding
50
inflow_duration
60
KJNodes

The Create Fluid Mask node, implemented based on a stable fluid dynamics algorithm, simulates the diffusion process of dye in a fluid by setting multiple inflow points and controlling their physical properties such as velocity and radius.

The Create Fluid Mask node is a tool for generating dynamic fluid effect masks. By simulating fluid motion, it creates a sequence of black-and-white images that change over time and possess a natural sense of flow. This node primarily serves image processing and generation workflows that require dynamic or organic-shaped masks.

Node Functionality

This node is implemented based on a stable fluid dynamics algorithm. It simulates the diffusion process of dye in a fluid by setting multiple inflow points and controlling their physical properties such as velocity and radius. It outputs an image sequence and corresponding mask data with a specified number of frames, width, and height. All parameters can be adjusted within defined integer ranges, and the core calculations rely on mathematical functions from the SciPy library.

Node Parameter Description - Create Fluid Mask

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
invertBOOLEANYesFalse-invert (input parameter): Inverts the black and white regions of the output mask. When True, originally white (highlighted) areas become black, and vice versa.
framesINTYes11 - 4096 (step: 1)frames (input parameter): Sets the total number of frames for the generated fluid animation. Range 1 to 4096, step 1.
widthINTYes25616 - 4096 (step: 1)width (input parameter): Sets the width in pixels for the generated fluid image. Range 16 to 4096, step 1.
heightINTYes25616 - 4096 (step: 1)height (input parameter): Sets the height in pixels for the generated fluid image. Range 16 to 4096, step 1.
inflow_countINTYes30 - 255 (step: 1)inflow_count (input parameter): Defines the number of "inflow points" in the fluid simulation. Range 0 to 255, step 1.
inflow_velocityINTYes10 - 255 (step: 1)inflow_velocity (input parameter): Controls the velocity intensity of the fluid inflow points. Range 0 to 255, step 1.
inflow_radiusINTYes80 - 255 (step: 1)inflow_radius (input parameter): Sets the radius of effect for each fluid inflow point. Range 0 to 255, step 1.
inflow_paddingINTYes500 - 255 (step: 1)inflow_padding (input parameter): Controls the minimum distance between inflow points and the canvas edge. Range 0 to 255, step 1.
inflow_durationINTYes600 - 255 (step: 1)inflow_duration (input parameter): Sets the duration (in frames) for which each inflow point continuously generates fluid. Range 0 to 255, step 1.

Output

Parameter NameData TypeDescription
IMAGEIMAGEIMAGE (output parameter): The output fluid simulation image sequence, in grayscale.
MASKMASKMASK (output parameter): The mask data corresponding to the image, which can be used to control the processing area of other nodes.

Usage Scenarios

In video generation or image animation workflows, you can use the dynamic masks generated by this node to control the application area of special effects. For example, connecting the output MASK to ControlNet can guide the generation of images with fluid texture characteristics; or using the IMAGE sequence as a dynamic background for compositing with other image layers.

Notes

Please note that higher resolution or frame count settings may significantly increase computation time and memory usage. Additionally, the fluid patterns generated by this node are random; identical parameter settings may produce slightly different results.

The Create Fluid Mask node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…