Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Soft Inpainting" feature from A1111 dev branch #12

Closed
LuLmaster69 opened this issue Feb 13, 2024 · 8 comments
Closed

"Soft Inpainting" feature from A1111 dev branch #12

LuLmaster69 opened this issue Feb 13, 2024 · 8 comments

Comments

@LuLmaster69
Copy link

Thank you for greatly expanding the inpainting for ComfyUI.

It is not really an issue but I don't know how to raise this suggestion otherwise.

I was thinking that you may be interested in the new "soft inpainting" feature from the latest dev branch of Automatic1111. It seems that ComfyUI is currently lacking such a feature.

Here's more details on it:
AUTOMATIC1111/stable-diffusion-webui#14208

@Acly
Copy link
Owner

Acly commented Feb 14, 2024

I noticed that, and while I'm not 100% sure I think that is how denoise masks have always worked in ComfyUI.
If you use only "VAE Encode (for Inpainting)" you get a binary mask.
But "Set Latent Noise Mask" and relatively new "InpaintModelConditioning" use soft masks to add noise and for conditioning.

@LuLmaster69
Copy link
Author

Thanks for clarification!

@nomadoor
Copy link

InpaintModelConditioning
InpaintModelConditioning.json
I found it interesting and gave it a try, but it seems that neither InpaintModelConditioning nor Set Latent Noise Mask support non-binary masks.
I apologize if I am mistaken.

@LuLmaster69
Copy link
Author

Reopening so that people could check if nomadoor's workflow is correct for non-binary masks.

@LuLmaster69 LuLmaster69 reopened this Feb 16, 2024
@Acly
Copy link
Owner

Acly commented Feb 16, 2024

You'd see a hard cut if it was rounded into a binary mask. Instead you see some kind of transition, but only for mask values close to 1, it seems to vanish quickly. Exactly how it uses mask values between 0 and 1 I don't know. The A1111 soft mask implements some kind of blending between denoised and original latent, probably this is different.

denoise-mask
Comparison smooth vs binary

@Acly
Copy link
Owner

Acly commented Feb 16, 2024

I think ComfyUI behavior works well enough for masks that are primarily fully opaque or transparent, but use soft edges / feathering at the borders for better transition.
It's not suited if you need intuitive and arbitrary per-pixel denoise strength.

@LuLmaster69
Copy link
Author

LuLmaster69 commented Feb 16, 2024

Thanks, hopefully this would clarify things for people who may seek to implement per-pixel denoise inpainting in ComfyUI.

I also noticed that "soft inpainting" in dev Auto1111 with max blur changes the picture beyond the mask, as in the example provided in their pull request thread.

@CodeHatchling
Copy link

Thanks, hopefully this would clarify things for people who may seek to implement per-pixel denoise inpainting in ComfyUI.

I also noticed that "soft inpainting" in dev Auto1111 with max blur changes the picture beyond the mask, as in the example provided in their pull request thread.

Yes, in contrast to vanilla inpainting, any area within "blur radius" from a masked pixel may be modified. This is intended to help inpaint-sketch by expanding the influence of the denoiser to include all pixels that are affected by the sketch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants