- Home /
How to bake emissive objects into lightmap?
I want to create a City Night environment with some lit windows on the buildings. I want those windows to get lit by the lightmap. When I use emissive shaders with the window mask as illumin map, the windows illuminate other objects, but don't get lit themselves. To show this, I did a simple test with a emissive ball and a plane.
What I got was this:
Only the plane gets the lighting from the bal. Nothing gets baked in the balls lightmap.
What I want to achieve is this:
I can't use emissive shaders in runtime due to performance reasons in mobile. I must use unlit(supports lightmap) shader. I need the sphere to get lit by the lightmap as shown above.
Is there a way to do this??
Thanks!
Answer by MakeCodeNow · Oct 08, 2014 at 04:15 AM
The usual trick is to paint the windows to be bright white in the diffuse texture. That matches the emissive behavior in the rendering even when you use a simple unlit shader in the real game. Basically, paint the building night texture as if it was a photo of the building at night.
That would not work because the building have tiled textures. If I paint the difuse, all windows will be lit. I want to have a few windows lit. $$anonymous$$y ideia was to bake all lit windows in a lightmap, erase some of them in photoshop and then use this as a mask for emissive shader using lightmap uvs, then bake the final lightmap with some lit windows. But I guess this wil not be possible.
You can still use tiled textures but have each tile contain a few windows. That way you can mix it up but still be memory efficient.