Inspire Pack
Run ComfyUI Easily with InstaSD
Skip the complex setup. InstaSD helps creative professionals build workflows and deploy them to the world:
- One-click deployment
- Any model, any node
- Powerful GPUs for rapid iteration
This extension provides various nodes to support Lora Block Weight, Regional Nodes, Backend Cache, Prompt Utils, List Utils and the Impact Pack.
Available Nodes
ColorMaskToDepthMask //Inspire
Color Mask To Depth Mask (Inspire) Node Documentation
Overview
The Color Mask To Depth Mask (Inspire) node is part of the ComfyUI-Inspire-Pack. This node allows users to convert a color map, defined by a textual specification, into a depth mask. Depth masks have values ranging from 0.0 to 1.0, which can be used to represent varying depth levels in graphical applications.
Functionality
This node is designed to transform an input color mask into a depth mask by interpreting specified colors and their corresponding depth values. It is particularly useful in workflows where visual elements need to be layered or adjusted based on perceived depth.
Inputs
The node requires the following inputs:
-
Color Mask (IMAGE):
- The input image that serves as the color mask. This image will have various colors used to identify regions for depth mapping.
-
Spec (STRING):
- A multiline string that specifies the mapping between colors and depth values. For example,
#FF0000:1.0\n#000000:0.0maps the color red to a depth of 1.0 and black to a depth of 0.0.
- A multiline string that specifies the mapping between colors and depth values. For example,
-
Base Value (FLOAT):
- The default value for the base mask. This value sets a starting point for the mask before any color mappings are applied. It ranges from 0.0 to 1.0.
-
Dilation (INT):
- Determines the number of pixels by which to expand or contract each mask layer before combining them. This can be positive or negative and ranges from -512 to 512.
-
Flatten Method (STRING):
- Specifies the method for flattening the mask layers. Options include:
- Override: Each pixel is set by the uppermost non-zero value among the layers.
- Sum: Layers are summed to determine the depth of each pixel.
- Max: The maximum value among all layers is used for each pixel.
- Specifies the method for flattening the mask layers. Options include:
Outputs
The node produces the following output:
- Mask (MASK):
- The final depth mask created from the color mask and specifications. The mask is a single-layer image with values ranging from 0.0 to 1.0, representing depth across the image.
Usage in ComfyUI Workflows
The Color Mask To Depth Mask (Inspire) node is useful in complex workflows where image manipulation based on depth is required. It can be used in conjunction with other nodes to:
- Create layered effects based on depth.
- Adjust visual focus and blurring based on region depth.
- Simulate 3D-like effects by modifying elements based on their distance or importance in an image.
To use this node effectively, it should be connected in a workflow where an initial image provides a color-coded depth map, and subsequent nodes use the output depth mask for further processing.
Special Features and Considerations
- Color Specification: Pay careful attention to the color specifications (spec input) as they define how the color map translates into depth values.
- Dilation Effect: Adjusting the dilation input can significantly change the appearance of the depth mask, affecting how distinct or blended depth transitions are.
- Flattening Methods: The choice of flatten method can drastically change the mask’s outcome, so it's important to select the method that aligns best with the desired effect.
- Base Value: Setting the base value appropriately ensures a smooth starting point for depth mapping before applying specific color-to-depth translations.
The Color Mask To Depth Mask (Inspire) node is a powerful tool for artists and developers working with complex image compositions, providing an added dimension of depth manipulation in the ComfyUI environment.