Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: Vegeta on 2019-05-30, 20:35:38

Title: Corona Light bakes Black Textures (Texture Baking)
Post by: Vegeta on 2019-05-30, 20:35:38
Hello everyone. I am new to this forum. Tried searching for this problem but couldn't find proper response. So making this thread.

I have a Corona Scene in 3Ds Max which I need to export to Unity. I wanted to bake the Light maps using "Corona Light". When I tried baking, the Light map turns out to be a Black Texture. Can anyone explain me what I am doing wrong ?

I did find some people facing the same problem but couldn't find the correct solution. Would be grateful if anyone can help me out.

Thank You :)
Title: Re: Corona Light bakes Black Textures (Texture Baking)
Post by: romullus on 2019-05-30, 22:11:20
It's hard to tell what's wrong without knowing your setup.
Title: Re: Corona Light bakes Black Textures (Texture Baking)
Post by: Maros on 2019-05-30, 22:29:43
I never had success in light/texture baking with Corona and also in other topic you will find that Corona is not for baking.
Title: Re: Corona Light bakes Black Textures (Texture Baking)
Post by: romullus on 2019-05-30, 23:35:11
That's not entirely correct. Yes, Corona can't bake with projection, but it does fine job when there's no projection involved.
Title: Re: Corona Light bakes Black Textures (Texture Baking)
Post by: Vegeta on 2019-05-31, 16:52:37
It's hard to tell what's wrong without knowing your setup.

It was a simple setup. I made a small room. Placed a cube. Textured the room and cube with Corona Materials. Setup lighting with Corona Light material. Every other setting at default. (File is in my Office workstation so couldn't upload screenshots :()

When I rendered, the quality was good. I wanted to export the lighting to Unity which is what I have trouble with. I made UV maps and unwrapped the models. But when I bake, Corona_light produces a Black Texture.
Title: Re: Corona Light bakes Black Textures (Texture Baking)
Post by: confy247 on 2019-08-03, 23:28:22
Can someone from Corona staff confirm that the Corona_Light RTT is REALLY a working lightmap baking solution? It seems it's broken or just left incomplete, due to particular complexity of generating proper lightmap texture output. It should contain only indirect color information but NO initial diffuse, which seems the main difficulty of realization.

Please guys, don't ignore this thread.
Title: Re: Corona Light bakes Black Textures (Texture Baking)
Post by: maru on 2019-08-06, 15:14:40
Corona staff here.

Sorry for the delay. Can you guys explain what exactly you are doing? What I mean is not just "baking a light map", but also an explanation what this "light map" exactly is, and how exactly it will be used.

The Corona_Light element currently works ONLY with a Corona Light Material.
So if you:
- create a box
- apply a Corona Light Material to that box
- Optionally: plug some texture as the texmap of the Corona Light Material
- Set up RTT
- Render to texture
Then the Corona_Light element will show the texture used as the texmap of the Corona Light Material you applied to the box.

In all other cases, it will render black.
Title: Re: Corona Light bakes Black Textures (Texture Baking)
Post by: confy247 on 2019-08-06, 15:57:00
Thanks for the clarification. It all makes sense now, no lightmap baking supported in Corona currently.
Title: Re: Corona Light bakes Black Textures (Texture Baking)
Post by: leitecunha on 2021-01-14, 09:33:58
Hi there, I know this is an old thread, but in case anyone tries to use Corona to bake a lightmap, it is possible.
You have to render both these 2 render elements:

Diffuse
Diffuse Color.

The lightmap is just one divided by the other. What you gotta do is put both renders in photoshop, the one with just the Diffuse Color on top of the other. Then, on that top layer (Diffuse Color), change the blending mode to Divide. And that's it. Just merge both, and you have the lightmap, black and white, and even the color spills from other objects.

Note that in any lightmap rendering, you can render them as an HDR or a PNG (or other 8bit format). When rendering in HDR, you can set the intensity of light super high and everything will be correct, no clipping etc. But of course, on the game engine side, rendering HDR maps in realtime is overhead, specially for mobile or VR standalone (Quest).
So it's best to render the elements and save them as PNG, but in this case, first check if the light is not clipping the white values... or the final lightmix in the game engine won't be exactly correct.
One way to check if you're not clipping is to just temporarily remove the diffuse texture and render it with the white color (or lower the white to ~235, because no physical material is capable of reflecting 255, the full white).

And that's it!
Title: Re: Corona Light bakes Black Textures (Texture Baking)
Post by: romullus on 2021-01-14, 09:59:15
@leitecunha, thanks for the useful information. Would you mind if i'd ask you to also post it in this topic, so it could easily be find in the future: https://forum.corona-renderer.com/index.php?topic=9728.0
Title: Re: Corona Light bakes Black Textures (Texture Baking)
Post by: leitecunha on 2021-01-14, 12:26:13
Of course! I'll do it. Thanks.
Title: Re: Corona Light bakes Black Textures (Texture Baking)
Post by: romullus on 2021-01-14, 12:32:02
Thank you!