Spline Mask — Edit/Track/Flow-Path (C2C):
The SplineMaskMEC node is a versatile tool designed for creating and manipulating masks using spline-based techniques within the ComfyUI environment. It unifies the functionalities of three previously separate nodes: the SplineMaskEditorMEC for interactive mask editing, the SplineMaskTrackerMEC for tracking masks across multiple frames using optical flow, and the SplinePathFlowMaskMEC for generating procedural effects like ribbons, waves, and dust along a spline path. This node allows you to switch between these modes using a single interface, providing a seamless experience for both static and animated mask creation. The integration of a rich JavaScript spline canvas widget ensures that you can interactively edit control points, making it easier to achieve precise and dynamic mask effects. Whether you are working on a single frame or a sequence of frames, SplineMaskMEC offers a comprehensive solution for mask editing, tracking, and procedural path effects, enhancing your creative workflow with its robust and flexible capabilities.
Spline Mask — Edit/Track/Flow-Path (C2C) Input Parameters:
mode
The mode parameter determines which of the three functionalities of the SplineMaskMEC node is active: editing, tracking, or flow-path generation. This selection dictates the behavior of the node and the type of mask manipulation that will be performed. The available options are edit, track, and flow_path. Choosing the correct mode is crucial for achieving the desired effect, as each mode offers distinct capabilities tailored to specific tasks.
spline_data
The spline_data parameter is a structured input that contains the spline's control points and other relevant data. This input is essential for defining the shape and behavior of the spline used in mask creation or manipulation. It allows for precise control over the spline's geometry, which is critical for accurate mask editing and procedural effects.
pattern
The pattern parameter is used in the flow-path mode to define the type of procedural effect applied along the spline path. Options include ribbon, wave, flow, dust, river, and smoke, each offering a unique visual effect. This parameter influences the appearance and dynamics of the generated mask, allowing for creative and varied outcomes.
frames
The frames parameter specifies the number of frames to be processed or generated, particularly relevant in tracking and flow-path modes. It determines the temporal extent of the mask effect, enabling animations and dynamic transitions across multiple frames. The choice of frames impacts the smoothness and duration of the resulting animation.
thickness
The thickness parameter controls the width of the mask band along the spline path in flow-path mode. It affects the visual prominence of the mask and can be adjusted to achieve the desired aesthetic effect. A thicker band may be used for bold, striking effects, while a thinner band can create subtle, delicate visuals.
seed
The seed parameter is used to initialize random processes within the node, ensuring reproducibility of results. It is particularly useful in procedural generation, where randomness plays a role in the final output. By setting a specific seed value, you can achieve consistent results across different runs.
Spline Mask — Edit/Track/Flow-Path (C2C) Output Parameters:
MASK
The MASK output is a rasterized representation of the spline-based mask, applicable in all modes. It provides a binary or grayscale image where the mask is applied, serving as the primary output for further processing or compositing in your workflow.
STRING (coords_json)
The coords_json output is a JSON string containing the coordinates of the spline's control points, formatted for compatibility with SAM (Segment Anything Model) in edit mode. This output is useful for integrating with other systems or tools that require precise point data for mask generation or manipulation.
SPLINE_DATA
The SPLINE_DATA output is a structured payload that contains detailed information about the spline, including its geometry and attributes. This data can be used for downstream processing or analysis, providing a comprehensive representation of the spline's characteristics.
STRING (info_json)
The info_json output provides diagnostic information or parameters related to the tracking or flow-path processes. It includes details such as tracking diagnostics, flow parameters, or bounding box data, offering insights into the node's operation and results.
BBOX
The BBOX output is a bounding box array [x, y, w, h] that defines the spatial extent of the spline's control points. It is useful for understanding the area affected by the mask and can be used for alignment or positioning purposes in your projects.
Spline Mask — Edit/Track/Flow-Path (C2C) Usage Tips:
- Use the
editmode for precise mask creation on single frames, leveraging the interactive canvas to adjust control points easily. - In
trackmode, ensure that the input image sequence is well-lit and has distinct features for optimal optical flow tracking results. - Experiment with different
patternoptions inflow_pathmode to create unique procedural effects that enhance your visual storytelling. - Adjust the
thicknessparameter to balance between subtle and bold mask effects, depending on the visual impact you wish to achieve. - Utilize the
seedparameter to maintain consistency across different runs, especially when working with procedural effects that involve randomness.
Spline Mask — Edit/Track/Flow-Path (C2C) Common Errors and Solutions:
"track mode requires image input"
- Explanation: This error occurs when the
trackmode is selected, but no image input is provided for the tracking process. - Solution: Ensure that you supply a valid image sequence as input when using the
trackmode to enable the optical flow tracking functionality.
"Invalid mode selected"
- Explanation: This error indicates that an unsupported mode has been chosen, which is not recognized by the SplineMaskMEC node.
- Solution: Verify that the
modeparameter is set to one of the supported options:edit,track, orflow_path. Adjust the mode selection accordingly to proceed.
