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
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 Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
invert | BOOLEAN | Yes | False | - | invert (input parameter): Inverts the black and white regions of the output mask. When True, originally white (highlighted) areas become black, and vice versa. |
frames | INT | Yes | 1 | 1 - 4096 (step: 1) | frames (input parameter): Sets the total number of frames for the generated fluid animation. Range 1 to 4096, step 1. |
width | INT | Yes | 256 | 16 - 4096 (step: 1) | width (input parameter): Sets the width in pixels for the generated fluid image. Range 16 to 4096, step 1. |
height | INT | Yes | 256 | 16 - 4096 (step: 1) | height (input parameter): Sets the height in pixels for the generated fluid image. Range 16 to 4096, step 1. |
inflow_count | INT | Yes | 3 | 0 - 255 (step: 1) | inflow_count (input parameter): Defines the number of "inflow points" in the fluid simulation. Range 0 to 255, step 1. |
inflow_velocity | INT | Yes | 1 | 0 - 255 (step: 1) | inflow_velocity (input parameter): Controls the velocity intensity of the fluid inflow points. Range 0 to 255, step 1. |
inflow_radius | INT | Yes | 8 | 0 - 255 (step: 1) | inflow_radius (input parameter): Sets the radius of effect for each fluid inflow point. Range 0 to 255, step 1. |
inflow_padding | INT | Yes | 50 | 0 - 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_duration | INT | Yes | 60 | 0 - 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 Name | Data Type | Description |
|---|---|---|
| IMAGE | IMAGE | IMAGE (output parameter): The output fluid simulation image sequence, in grayscale. |
| MASK | MASK | MASK (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.
Create Fluid Mask Node Source Code Link
The Create Fluid Mask node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.