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: side-by-sidebakingDemoA_uvs 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: bakingDemoB_side-by-sidebakingDemoB_uvsbakingDemoC

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. bakingDemoD_02cloth-bake-settings

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


Kent Trammell
Add a Comment

Get the latest

Sign up with your email address and get the latest, straight to your inbox.