Big Idea: "Baking"
May 3rd 2016
Â
âBakingâ is a term frequently used in computer graphics (CG) in regards to game development and traditional, non-realtime rendering (Cycles or Blender Render). But âbakingâ brings with it certain real-world connotations that could make it confusing. With this article, my goal is to reconcile this term and clarify what baking really means.
Different Types of Baking
 In further convoluting the term, there are several different kinds of baking. But before I list and discuss them, I want to offer a general summary of the term as it relates to CG. Think of baking as consolidating a system of data into a simplified, more permanent form. This concept is commonly applied in 3 ways:
1. Texture Baking
The most common type is Texture Baking (or Map Baking). The power of texture baking lies in the ability to transpose characteristics of 3D geometry into a 2D image texture. There are many characteristics that can be baked, from isolated attributes (ambient occlusion, normals, vertex colors, etc) to multiple, combined characteristics including materials, textures, and lighting all baked into a single texture. Pictured below is an example of the latter: So thatâs awesome at face value! The complexity of materials and lighting nicely consolidated into a simple image texture is a great trick. You can probably imagine how useful this technique is for games and other realtime applications. But itâs important to understand that the texture is limited because itâs static, not dynamic. In other words, moving the monkey head would leave its shadow on the floor instead of updating realistically as the persistent render of the Cyclesâ viewport. So the technique is limited, though extremely valuable when used appropriately. In addition to baking the result of render characteristics like lighting and materials, we can also approximate high-resolution geometric detail on a low-resolution model through the baking of Normals. This saves tremendous resources at the cost of minor perceivable differences between the low-resolution and high-resolution. Again, you can imagine how much games benefit from the technique. Hereâs an example:
Finally, texture baking certain geometric attributes can assist in the texture painting process. For example, instead of painting darkness in a modelâs crevices by hand, overlaying a baked-out ambient occlusion map can do that for you. Similarly, if you wanted to highlight the edges of a model to represent wear and tear, baking dirty vertex colors makes that easy. And thereâs more where those examples come from.
2. Animation/Simulation Baking
The same idea of consolidating a system of data into a simplified form continues into animation and simulation. If you think of a keyframed character animation, thereâs a lot for the computer to process: The characterâs rig with all its hierarchy, constraints, and mesh deformation along with hundreds or thousands of keyframes, each with its own interpolation. Thatâs a lot of stuff. So thereâs a couple way to simplify all that stuff with baking. First, with Blender you can perform an operation called "Bake Action". This simply adds a keyframe for all transforms of every bone for every frame of the animation. While that might not sound âsimplerâ, it is a simplification in that the animation no longer relies on bone constraints and other relational dependencies. Bake Action also serves to âlock downâ the animation in a way, to preserve its integrity.
 Even further than that, animation can be baked down into a geometric sequence or "cache", which does away with the character rig entirely. So imagine youâre 100% happy with your animation and youâre ready to move it down the pipeline into the rendering stage. Itâs very convenient to strip away the unneeded calculations of the character rig in exchange for a clean, geometry sequence. That way your render-ready scene isnât cluttered with a ton of keyframes that youâll never change - because youâre 100% happy with it, remember. You can simply focus on lighting and rendering your animated geometry, which will be a little faster since the computer doesnât have to calculate the rigâs intricacies. In Blender, this is made possible with an .MDD point cache export and the Mesh Cache modifier.
Effects simulations - like fire, smoke, particles, and cloth - can all be baked as well. Itâs essentially the same concept as the mesh cache for animation. Simulations require a lot of calculations and, with the exception of some particle systems, they never run in real time. So to even visualize an effect at full speed, you have to bake it out. Bakes are stored in RAM by defualt but can also be saved to your hard drive. An example of Blender's cloth baking/cache settings are pictured to the right.
3. Light Baking
This type of baking is more specific to game engines. But since games are closely related to the broader field of computer graphics, I think itâs appropriate to touch on yet another version of the term âbakingâ. The point here is to save resources so a game can run as efficiently as possible. There are 2 kinds of lights that can be used for games: Static and Dynamic. Dynamic lights interactively respond to the 3D scene, like shifting shadows and informing the materials they touch. Static lights are stationary and can be excluded from dynamic calculation to save game resources. [gallery columns="2" link="file" size="full" ids="192161,192162"] Mobile and Web games often implement baked lightmaps, which produces a texture map of all the lighting information in a certain scene or level of a game. This means that you can create well-lit areas at a fraction of the performance cost of using Dynamic lights. When baking lightmaps, both static and dynamic lights can be used simultaneously to create a more realistic lighting environment. Unity also utilizes a light probe system that allows non-static (animated or dynamic) objects to receiving lighting information from baked lightmaps, which allows you to benefit from the performance savings of baked lighting while simulating dynamic lights.
I hope this helps to clarify what the term "baking" means. If you'd like to see additional material about texture baking and its practical application, please see these courses:
CC Image Attribution: "Huge oven" by Jacob Bøtter
Appreciate this break down. I need to record it or did i miss a PDF version for my note book?
Anyway.... I noticed in the animation bake a none/light/heavy bake capability. Other then the obvious render time, file size, why would you select NONE? Heavy?
I tried heavy and not seeing any really difference but then i'm 65. lol
Hey, so baking is always used to describe consolidating something into a simplified, more permanent form like Kent mentioned. However, there are different types of baking and they all do different things. Like a button that says "finalize", what is actually being finalized depends on the context. In this case - what you are baking.
Baking in the render panel will bake the rendered detail on to an image texture as seen in example 1 in the article, and in the Fundamentals of Texturing course: https://cgcookie.com/lesson/map-baking-with-blender-render/
Baking a simulation, like in the smoke domain settings, will finalize the simulation so that it is no longer real time.
Thanks a ton for this article! Now I have something to easily reference when I try to explain to people how awesome baking is, and how low-poly models can have such extreme detail in a realtime environment. :D
Like the basics.... but i just found out that setting the bake start-stop in the render section is not the same as setting the bake in the smoke domain. Obviously they are not the same. Maybe I missed it, but in baking....what are the differences and when should you be choosing one over the other? should you be combining them? are there other bake areas I have not found yet?
Also I noticed that in the smoke-domain bake there are more icons. Could you give me a basic fyi on those?
Thanks for all your support....i really appreciate it.
Thanks Kent. This was a very worthwhile read. Stimulates the imagination, too, thinking of the possibilities!
Thanks Kent!! Great article!
Well, it may be caused by the fact, that idea is pretty simple. But there are lot of traps on the way to perfect bake. Anyway thanks and keep up great job!
Aha! I've wondered for a while what was meant by "light probes", but I hadn't got round to looking it up.
Now I understand :-)
Thanks.
In general I always err on the side of baking too big. One can easily scale down for smaller sizes, but scaling up requires a new bake.
Great article! Thanks Kent :)