Home

Awesome

ComfyUI-IC-Light-Native

ComfyUI native implementation of IC-Light.

Install

Download the repository and unpack into the custom_nodes folder in the ComfyUI installation directory.

Or clone via GIT, starting from ComfyUI installation directory:

cd custom_nodes
git clone git@github.com:huchenlei/ComfyUI-IC-Light-Native.git

Download models

IC-Light main repo is based on diffusers. In order to load it with UnetLoader in ComfyUI, state_dict keys need to convert to ldm format. You can download models with ldm keys here: https://huggingface.co/huchenlei/IC-Light-ldm/tree/main

There are 2 models:

After you download these models, please put them under ComfyUI/models/unet and load them with UNETLoader node.

Recommended nodes

Workflows

Please make sure the fg image's masked/transparent area are grey before you pass it to the VAE. Otherwise, you will get background obscured in FC workflows or darkened background in FBC workflows. You can use IC Light Apply Mask Grey to make sure the masked area's color is correct. See following examples: 12 05 2024_16 22 48_REC 12 05 2024_16 19 02_REC

Given FG, Generate BG and relight

image If you want to keep the original color of the fg object, you can put the fg object in the latent space to further guide the generation. workflow image

Given FG and light map, Genereate BG and relight

Light from right image

Light from left image

Given FG and BG, Put FG on BG and relight

image

Recover high frequency detail (Text, etc) from original input image

06 06 2024_12 19 35_REC

Common Issues

IC-Light's unet is accepting extra inputs on top of the common noise input. FG model accepts extra 1 input (4 channels). BG model accepts 2 extra input (8 channels). The original unet's input is 4 channels as well.

If you see following error, it means you are using FG workflow but loaded the BG model.

RuntimeError: Given groups=1, weight of size [320, 8, 3, 3], expected input[2, 12, 64, 64] to have 8 channels, but got 12 channels instead

If you see following error, it means you are using FG workflow but loaded the BG model.

RuntimeError: Given groups=1, weight of size [320, 12, 3, 3], expected input[2, 8, 64, 64] to have 12 channels, but got 8 channels instead