GithubHelp home page GithubHelp logo

ic-light's Introduction

ic-light's People

Contributors

lllyasviel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ic-light's Issues

Can the color be controlled?

I found that this thing can change the original color of the item during use. If this function is mainly used for lighting, the original color should not be changed. I hope the following improvements can be made.

is there a paper of this method?

Dear Lvmin,

Thank you for your great work. I really like it.

Is there a paper explaining this method? The explanation at the bottom of the webpage is a bit vague.

I appreciate your help.

Best Wishes,

Zongze

Even lighting (or) No lighting Option - For creating Unlit/evenly lit diffuse maps:

Can an addition be made to completely remove any existing lighting in a image and create a unlit diffuse map from an image, this is an important part of PBR texture process from real life pics and there are different workflows (ex:https://github.com/Unity-Technologies/DeLightingTool?tab=readme-ov-file) that are very convoluted to achieve this.

But with this extension, if it can have an option to add a no lighting or an evenly lit lighting option (no directional light) , it would be a valuable addition to any PBR texture process

Example of potential use case, left is texture with lighting, right is unlit albedo/diffuse map, with lighting effects removed:

image

A even more detailed option would be to remove direction light from an existing texture, as in above example it was evenly lit, but in most real life PBR uses, light is angled (as in this below pic, stone is lit from right side to left)

a

Thanks

Error loading shm.dll, The specified module could not be found.

(cuda) C:\Users\palam\OneDrive\Desktop\IC light\IC-Light>python gradio_demo.py
Traceback (most recent call last):
File "C:\Users\palam\OneDrive\Desktop\IC light\IC-Light\gradio_demo.py", line 5, in
import torch
File "C:\Users\palam\AppData\Roaming\Python\Python310\site-packages\torch_init_.py", line 141, in
raise err
OSError: [WinError 126] The specified module could not be found. Error loading "C:\Users\palam\AppData\Roaming\Python\Python310\site-packages\torch\lib\shm.dll" or one of its dependencies

Preserve the high-frequency component (fine details) in the original image

Nice work! I'm already using it in our indie game dev. I see some people complaining that the AI will change details in the original image, so I just want to mention that we can separate the high-frequency component from the original image and replace it into the processed image.

We can use, e.g. Erasing Appearance Preservation to separate the base color and the high-frequency component, for which I have a Python implementation here

Result of replacing high-frequency component

[Errno 2] No such file or directory

Cannot import /Users/Myname/Documents/ComfyUI/custom_nodes/ComfyUI-IC-Light module for custom nodes: [Errno 2] No such file or directory: '/Users/Myname/Documents/ComfyUI/custom_nodes/ComfyUI-IC-Light/init.py'

Huggingface page not working

The demo on the huggingface page doesn't work, on pc it says error 500, while on my smartphone it doesn't say anything, it's blank

Relight transparent object incorrectly

As you can see, the relight program treats the transparent part like opaque screen. The relight process only takes reflection light into consideration while for transparent object, both reflection light and transmission light have to be taken into account. Just a suggestion, and I encountered the same problem when I used Switchlight before.
duralex_toddler_cup_130ml_29227099-4b55-4e7c-b005-aa6e5cbe801e
image (5)
276925
image (6)

[data] Datset used

This is an amazing model, really impressed by this!

I was wondering what dataset you're using to train this, I tried to find an opensource OLAT dataset to recreate switchlight, but didn't have any luck.
Also, any chance you are going to release the training code?

[feature] Is it now possible to get different map like albedo metallic and AO map?

As we can already relight it, maybe it's possible to get them all to generate propriate model in UE5? Well I'm not sure whether it can distinguish albedo and metallic.
Well by asking this, is because, of course, it's not suitable to have only one light. A common lighting should have a composite light, including at least front light, backlight, side light and etc. Yet in some case we do want them seperately.

two stage denosing

Thanks for your wonderful work!
I have a question that, in your codes, the process function contains two stage denosing steps, I don't know why it needs two.
image

can not running on local URL

Screenshot (19)
Hi, when I try to access the local site I can't load the page, my browser (it doesn't matter which one because all the browsers I've tried give the same message) reports this error: "
Unable to reach site The web page at http://0.0.0.0:7860/ may be temporarily unavailable or has been permanently moved to a new web address.
ERR_ADDRESS_INVALID "

Does the background need to be changed in order to achieve lighting rendering?

Thank you very much for your contributions to this field. I have a question: Currently, there are two implementation methods for this algorithm, both of which achieve foreground lighting rendering by replacing the background. Is it currently only possible to achieve lighting rendering on the foreground by replacing the background?

ERROR: Exception in ASGI application

You can upload files after running, like this.
Is there anyone who knows how to solve solutions?

ERROR: Exception in ASGI application
Traceback (most recent call last):
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\uvicorn\protocols\http\h11_impl.py", line 407, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\uvicorn\middleware\proxy_headers.py", line 69, in call
return await self.app(scope, receive, send)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\fastapi\applications.py", line 1054, in call
await super().call(scope, receive, send)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette\applications.py", line 123, in call
await self.middleware_stack(scope, receive, send)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette\middleware\errors.py", line 186, in call
raise exc
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette\middleware\errors.py", line 164, in call
await self.app(scope, receive, _send)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette\middleware\cors.py", line 85, in call
await self.app(scope, receive, send)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette\middleware\exceptions.py", line 65, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette_exception_handler.py", line 64, in wrapped_app
raise exc
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette\routing.py", line 756, in call
await self.middleware_stack(scope, receive, send)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette\routing.py", line 776, in app
await route.handle(scope, receive, send)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette\routing.py", line 297, in handle
await self.app(scope, receive, send)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette\routing.py", line 77, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette_exception_handler.py", line 64, in wrapped_app
raise exc
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette\routing.py", line 72, in app
response = await func(request)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\fastapi\routing.py", line 278, in app
raw_response = await run_endpoint_function(
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\fastapi\routing.py", line 193, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\starlette\concurrency.py", line 42, in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\anyio\to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\anyio_backends_asyncio.py", line 2144, in run_sync_in_worker_thread
return await future
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\anyio_backends_asyncio.py", line 851, in run
result = context.run(func, *args)
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\gradio\routes.py", line 282, in api_info
return gradio.blocks.get_api_info(config, serialize) # type: ignore
File "C:\Users\naver\AppData\Roaming\Python\Python310\site-packages\gradio\blocks.py", line 504, in get_api_info
serializer = serializing.COMPONENT_MAPPINGtype
KeyError: 'dataset'

GPU memory problems

GPU memory problems, 3050 TI 4gb card, used Fooocus and other image generation AIs they worked fine on this video card

Снимок экрана_2024-05-14_14-23-59

Frontal and surrounding Light

That tool is really cool! :)
But we have lights from almost all angles, but not frontal or surrounding, like "I want the faces lighted up"...

Why change the unet.conv_in?

the channel of unet.conv_in is 8/12 in gradio_demo.py/gradio_demo_bg.py, curious how it works in t2i_pipe/i2i_pipe, and how does it get 8/12 channel? Especially if foreground information pass to unet via cross_attention_kwargs.

about albedo

where can I find the function or model to generate albedo map ?

some small badcases

Great work,overall performance is very good! But, when the person's face takes up a relatively small proportion in the image, the face in the generated image collapses significantly. As follows:

Relighting with Foreground Condition

original image left light right light
image image image
image image image
image image image

Relighting with Foreground and Background Condition

original image bg 1 bg 2
image image image
image image image
image image image

Normal map calculation reference?

Hi community,

Can anyone refer me to a tech report or paper on calculating normal maps from images with different lighting directions (left, right, bottom, top)? Thanks in advance!

IC-Light/gradio_demo_bg.py

Lines 352 to 380 in 9365406

ambient = (left + right + bottom + top) / 4.0
h, w, _ = ambient.shape
matting = resize_and_center_crop((matting[..., 0] * 255.0).clip(0, 255).astype(np.uint8), w, h).astype(np.float32)[..., None] / 255.0
def safa_divide(a, b):
e = 1e-5
return ((a + e) / (b + e)) - 1.0
left = safa_divide(left, ambient)
right = safa_divide(right, ambient)
bottom = safa_divide(bottom, ambient)
top = safa_divide(top, ambient)
u = (right - left) * 0.5
v = (top - bottom) * 0.5
sigma = 10.0
u = np.mean(u, axis=2)
v = np.mean(v, axis=2)
h = (1.0 - u ** 2.0 - v ** 2.0).clip(0, 1e5) ** (0.5 * sigma)
z = np.zeros_like(h)
normal = np.stack([u, v, h], axis=2)
normal /= np.sum(normal ** 2.0, axis=2, keepdims=True) ** 0.5
normal = normal * matting + np.stack([z, z, 1 - z], axis=2) * (1 - matting)
results = [normal, left, right, bottom, top] + inner_results
results = [(x * 127.5 + 127.5).clip(0, 255).astype(np.uint8) for x in results]
return results

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.