Create Voronoi Mask(CreateVoronoiMask)
This node calculates Voronoi diagrams based on the SciPy library, simulating smooth point movement by randomly generating start and end points and performing linear interpolation across multiple frames according to specified speed parameters.
Create Voronoi Mask
The Create Voronoi Mask node calculates Voronoi diagrams based on the SciPy library. It simulates smooth point movement by randomly generating start and end points and performing linear interpolation between multiple frames according to specified speed parameters.
The Create Voronoi Mask node is used to generate dynamic Voronoi Diagram patterns and convert them into Masks. By controlling the movement of a set of points, it creates a time-varying geometric segmentation effect, ultimately outputting a standard mask and its inverted version.
Node Functionality
This node calculates Voronoi diagrams based on the SciPy library. It simulates smooth point movement by randomly generating start and end points and performing linear interpolation between multiple frames according to specified speed parameters. The generated pattern's line width is adjustable, and it is finally rendered as a single-channel binary image of the specified dimensions to be compatible with ComfyUI's mask format.
Node Parameter Description - Create Voronoi Mask
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
frames | INT | Yes | 16 | 2 - 4096 (Step: 1) | Specifies the total number of frames for the mask animation to generate. Value range is 2 to 4096, with a step of 1. |
num_points | INT | Yes | 15 | 1 - 4096 (Step: 1) | Defines the number of random points used to generate the Voronoi diagram. Value range is 1 to 4096, with a step of 1. |
line_width | INT | Yes | 4 | 1 - 4096 (Step: 1) | Sets the width (in pixels) of the dividing lines in the Voronoi pattern. Value range is 1 to 4096, with a step of 1. |
speed | FLOAT | Yes | 0.5 | 0.0 - 1.0 (Step: 0.01) | Controls the animation speed at which points move from their start to end positions. Value range is 0.0 to 1.0, with a step of 0.01. |
frame_width | INT | Yes | 512 | 16 - 4096 (Step: 1) | Sets the width (in pixels) of the output mask. Value range is 16 to 4096, with a step of 1. |
frame_height | INT | Yes | 512 | 16 - 4096 (Step: 1) | Sets the height (in pixels) of the output mask. Value range is 16 to 4096, with a step of 1. |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| mask | MASK | The output Voronoi pattern mask. |
| mask_inverted | MASK | The output inverted Voronoi pattern mask. |
Usage Scenarios
In video generation or image sequence processing workflows, the dynamic masks generated by this node can be used to control the application area of special effects. For example, the mask can be connected to an image blending node, allowing the Voronoi pattern to gradually reveal or cover specific parts of the image over time, creating unique transitions or texture overlay effects.
Notes
Please note that the dimensions of the generated mask are directly determined by the frame_width and frame_height parameters, and an excessive number of points and lines may increase the computational load. The number of masks output by the node equals the value of the frames parameter, making it suitable for batch processing.
Create Voronoi Mask Node Source Code Link
The Create Voronoi Mask node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.