ComfyUI > Nodes > ComfyUI_Seamless_Patten

ComfyUI Extension: ComfyUI_Seamless_Patten

Repo Name

ComfyUI_Seamless_Patten

Author
moyi7712 (Account age: 2331 days)
Nodes
View all nodes(4)
Latest Updated
2024-08-06
Github Stars
0.01K

How to Install ComfyUI_Seamless_Patten

Install this extension via the ComfyUI Manager by searching for ComfyUI_Seamless_Patten
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI_Seamless_Patten in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

ComfyUI_Seamless_Patten Description

ComfyUI_Seamless_Patten enables the creation of seamless patterns from text-to-image processes, ensuring smooth, continuous designs without visible edges or interruptions.

ComfyUI_Seamless_Patten Introduction

ComfyUI_Seamless_Patten is an extension designed to enhance the capabilities of AI artists by enabling the creation of seamless patterns in text-to-image generation processes. This extension modifies the UNetModel and VAE Conv2d layers to use circular padding, which ensures that the generated images can tile seamlessly without visible borders or mismatches. This is particularly useful for creating textures, wallpapers, and other designs that require a continuous, repeating pattern.

How ComfyUI_Seamless_Patten Works

The core functionality of ComfyUI_Seamless_Patten revolves around changing the padding mode of convolutional layers in the neural network models used for image generation. Normally, these layers use a standard padding mode that can result in visible seams when images are tiled. By switching to circular padding, the extension ensures that the edges of the images wrap around seamlessly.

Basic Principles

  1. Circular Padding: Imagine wrapping the edges of an image around a cylinder so that the left edge meets the right edge and the top edge meets the bottom edge. This is essentially what circular padding does, allowing the image to tile seamlessly.
  2. UNetModel and VAE Conv2d Layers: These are specific layers in the neural network that handle image processing. By modifying their padding mode, the extension ensures that the entire image generation process supports seamless tiling.

ComfyUI_Seamless_Patten Features

SeamlessVae Node

The SeamlessVae Node modifies the VAE (Variational Autoencoder) model to use circular padding. This involves registering hooks that change the padding mode of Conv2d layers before and after the forward pass of the model.

patcher = vae.patcher.clone()
for layer in patcher.model.modules():
  if (isinstance(layer, nn.Conv2d)):
    pre_hook = layer.register_forward_pre_hook(vae_circular_hook_pre)
    hook = layer.register_forward_hook(vae_circular_hook)
    setattr(layer, 'circular_pre_hook', pre_hook)
    setattr(layer, 'circular_hook', hook)
vae.patcher = patcher
vae.first_stage_model = patcher.model

SeamlessKSampler Node

The SeamlessKSampler Node modifies the KSampler model to use circular padding during the sampling process. This ensures that the diffusion model, which generates the images, also supports seamless tiling.

padding_mode_list = []
for layer in model.model.diffusion_model.modules():
  if (isinstance(layer, nn.Conv2d)):
    padding_mode_list.append(layer.padding_mode)
    layer.padding_mode = 'circular'

ret = common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise)

ind = 0
for layer in model.model.diffusion_model.modules():
  if (isinstance(layer, nn.Conv2d)):
    padding_mode_list.append(layer.padding_mode)
    layer.padding_mode = padding_mode_list[ind]
    ind += 1

ComfyUI_Seamless_Patten Models

Currently, the extension modifies existing models (UNetModel and VAE) rather than providing new models. The changes ensure that these models can generate seamless patterns by using circular padding.

What's New with ComfyUI_Seamless_Patten

2024-6-19 Update

  • SeamlessVae Node: Introduced hooks to modify the VAE model's Conv2d layers to use circular padding.
  • SeamlessKSampler Node: Added functionality to change the padding mode of the KSampler model's Conv2d layers to circular during the sampling process. These updates are crucial as they ensure that both the VAE and KSampler models can generate seamless patterns, enhancing the overall capability of the extension.

Troubleshooting ComfyUI_Seamless_Patten

Common Issues and Solutions

  1. Images Not Tiling Seamlessly:
  • Solution: Ensure that the extension is correctly installed and that the SeamlessVae and SeamlessKSampler nodes are properly configured in your workflow.
  1. Performance Issues:
  • Solution: Circular padding can be computationally intensive. Ensure your hardware meets the recommended specifications for running the models efficiently.

Frequently Asked Questions

  • Q: Why are there still seams in my generated images?
  • A: Make sure that the circular padding mode is correctly applied to all Conv2d layers in the models. Double-check the configuration of the SeamlessVae and SeamlessKSampler nodes.
  • Q: How can I customize the padding mode?
  • A: The extension currently supports circular padding to ensure seamless tiling. Customizing padding modes beyond this would require modifying the extension's code.

Learn More about ComfyUI_Seamless_Patten

For additional resources, tutorials, and community support, consider the following:

  • Documentation: Detailed documentation on how to use and configure the extension.
  • Tutorials: Step-by-step guides on creating seamless patterns using ComfyUI_Seamless_Patten.
  • Community Forums: Join discussions with other AI artists and developers to share tips, ask questions, and get support. By leveraging these resources, you can maximize the potential of ComfyUI_Seamless_Patten and create stunning, seamless patterns for your projects.

ComfyUI_Seamless_Patten Related Nodes

RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.