KJNodes/masking/conditioninggenerated

ConditioningSetMaskAndCombine4

This node technically replicates the functionality of multiple native ComfyUI 'Set Mask and Combine' nodes and integrates them into a single node.

Conditioning Set Mask And Combine4

positive_1
negative_1
positive_2
negative_2
positive_3
negative_3
positive_4
negative_4
mask_1
mask_2
mask_3
mask_4
combined_positive
combined_negative
mask_1_strength
1.00
mask_2_strength
1.00
mask_3_strength
1.00
mask_4_strength
1.00
set_cond_area
COMBO
KJNodes

The ConditioningSetMaskAndCombine4 node technically replicates the functionality of multiple native ComfyUI "Set Mask and Combine" nodes and integrates them into a single node.

ConditioningSetMaskAndCombine4 is a powerful combination node for image generation, capable of combining up to four distinct sets of positive and negative prompts (Conditioning) with their corresponding masks. Its core functionality allows users to apply different generation guidance conditions to different areas of the same image, enabling complex local control and editing.

Node Functionality

This node technically replicates the functionality of multiple native ComfyUI "Set Mask and Combine" nodes and integrates them into a single node. It accepts four independent sets of Conditioning inputs (each containing positive and negative prompts) along with four corresponding MASK inputs, and allows setting individual strength for each mask. Internally, the node handles mask dimensions and determines the area where conditions are applied based on the set_cond_area parameter, ultimately outputting merged positive and negative Conditioning data streams.

Node Parameter Description - ConditioningSetMaskAndCombine4

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
positive_1CONDITIONINGYes--positive_1 (Input Parameter): The first set of positive prompts (Conditioning), describing the content you wish to generate within the corresponding mask area.
negative_1CONDITIONINGYes--negative_1 (Input Parameter): The first set of negative prompts (Conditioning), describing the content you wish to avoid within the corresponding mask area.
positive_2CONDITIONINGYes--positive_2 (Input Parameter): The second set of positive prompts (Conditioning), for the second mask area.
negative_2CONDITIONINGYes--negative_2 (Input Parameter): The second set of negative prompts (Conditioning), for the second mask area.
positive_3CONDITIONINGYes--positive_3 (Input Parameter): The third set of positive prompts (Conditioning), for the third mask area.
negative_3CONDITIONINGYes--negative_3 (Input Parameter): The third set of negative prompts (Conditioning), for the third mask area.
positive_4CONDITIONINGYes--positive_4 (Input Parameter): The fourth set of positive prompts (Conditioning), for the fourth mask area.
negative_4CONDITIONINGYes--negative_4 (Input Parameter): The fourth set of negative prompts (Conditioning), for the fourth mask area.
mask_1MASKYes--mask_1 (Input Parameter): The first mask, used to define the image area where the first set of conditions takes effect. White areas indicate effect.
mask_2MASKYes--mask_2 (Input Parameter): The second mask, used to define the image area where the second set of conditions takes effect.
mask_3MASKYes--mask_3 (Input Parameter): The third mask, used to define the image area where the third set of conditions takes effect.
mask_4MASKYes--mask_4 (Input Parameter): The fourth mask, used to define the image area where the fourth set of conditions takes effect.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
set_cond_areaCOMBOYesdefault"default", "mask bounds"set_cond_area (Input Parameter): Sets the application scope of the conditions (prompts). Options are "default" (entire image by default) or "mask bounds" (only within the mask bounding box).
mask_1_strengthFLOATYes1.00.0 - 10.0 (Step: 0.01)mask_1_strength (Input Parameter): Controls the strength coefficient for the first mask condition. Range 0.0 to 10.0, step 0.01.
mask_2_strengthFLOATYes1.00.0 - 10.0 (Step: 0.01)mask_2_strength (Input Parameter): Controls the strength coefficient for the second mask condition. Range 0.0 to 10.0, step 0.01.
mask_3_strengthFLOATYes1.00.0 - 10.0 (Step: 0.01)mask_3_strength (Input Parameter): Controls the strength coefficient for the third mask condition. Range 0.0 to 10.0, step 0.01.
mask_4_strengthFLOATYes1.00.0 - 10.0 (Step: 0.01)mask_4_strength (Input Parameter): Controls the strength coefficient for the fourth mask condition. Range 0.0 to 10.0, step 0.01.

Output

Parameter NameData TypeDescription
combined_positiveCONDITIONINGcombined_positive (Output Parameter): The output after merging all four sets of positive conditions, to be connected to the sampler.
combined_negativeCONDITIONINGcombined_negative (Output Parameter): The output after merging all four sets of negative conditions, to be connected to the sampler.

Usage Scenarios

In practical workflows, you can use it to create a scene image containing multiple independent elements. For example, you could use one set of prompts and a mask for the "sky" area, another set for a "foreground character", a third set for "background architecture", and a fourth set for a "decorative object" requiring a specific style. By connecting different text prompts and precisely drawn masks, this node can guide the AI to generate distinctly different content in specific parts of the image.

Notes

When using this node, ensure that the input masks (MASK) match the dimensions of the target image. It is also advisable for the masks to be non-overlapping or carefully designed in terms of spatial arrangement to avoid conflicting conditions leading to unpredictable generation results. The mask strength parameters can amplify or weaken the influence of the corresponding conditions.

ConditioningSetMaskAndCombine4 node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…