Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

What does it mean to bake lightmap ? I heard this in Unity3d, and again found this LightUp plugin for sketchup that bakes lightmap.

From what I observe, the lightmap baked gives the 3d object a much more realistic feel. Is the purpose of baking light on object to give that cg animation look you see on pre-rendered animations?

share|improve this question
    
Also, anytime you bake something, whether its physics, lighting or anything else. It means you have set up something that will take a long time to render/process in real time, or you want it to play the same way each time, so you only do it once, and save the results for later use, and because all of thecalculations are done, displaying what has been baked is fast, and always the same across all playthroughs. –  AttackingHobo Mar 20 '11 at 18:21
    
AttackingHobo, that is a great way to put it. I understand it now. But curious, how would physics be baked? Does Luxrender produce photorealistic renders because they can calculate the physics of the light? –  Kim Jong Woo Mar 20 '11 at 23:40
1  
Physics can be baked for complex scenes by once simulating and storing all the objects positions, and rotations etc for every timestep. Then instead of recalculating all the values again live, they are just played back from the stored values. –  AttackingHobo Mar 21 '11 at 3:02

1 Answer 1

up vote 29 down vote accepted

When you have a static (non-moving) light in a game, you have two options for rendering this light. You could render it the same as a dynamic light; that is, feed it through the shader pipeline which will calculate its effect on everything around it, every frame, on its way to the screen. This is obviously pretty expensive. Or, an editor can bake the light into the scene.

What I've always thought of baking was perhaps a more simple version: basically the editor just takes the textures of everything around the light, calculates the effect of the light on those textures (brightens them, perhaps colors them, shadows, etc.), and saves them as replacement textures to use. So all the textures around the "light" look like they have a light cast on them, but at runtime there actually isn't a light from a calculation standpoint; it's an optical illusion, essentially.

Unity, however, seems to be generating a lightmap. This is similar to the above notion, but the baked lighting is kept separately instead of modifying the underlying texture, and I assume a shader merges the two at runtime. This would have the advantage of keeping the advantage of tiled textures (i.e. low memory usage), since they wouldn't have the light baked right into them therefore they could remain tiled, and the shader would be very lightweight, especially compared to treating the light as dynamic.

A light obviously needs to be static for this to work; that is, you can't move it during gameplay, because the light has been baked into the textures. Also, any dynamic objects in the room (such as the player character) won't have the light shining on them so there needs to be some sort of exception, where the light is rendered for dynamic objects but not (re-)rendered on the static scenery.

share|improve this answer
8  
And most of the time because the lighting is softish, the lightmap can be saved in lower resolution than the rest of the textures, still looks good, but renders faster, and takes less memory. –  AttackingHobo Mar 20 '11 at 9:03
    
+1, this is a really nice and extensive answer, thank you. :) –  Xeo Mar 20 '11 at 14:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.