Big Idea: "Baking"

 

“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

  • Alan Anderson

    Kudos to Kent and CGCookie for this. Baking is mentioned often in tutorials without an explanation of what it is and requires a "time out" while one takes the time to learn about it, usually half-hassed.
    So thanks for this CGC, more of the same please, i.e., over looked tips we ALL don't know about.
    Right on target.

  • crew
    Kent Trammell

    Thanks for the positive feedback! Indeed we've got more planned :)

  • Luis Monteiro

    It is a good way to put the baking issue, Thanks Kent ! (at least if it was as easy as putting in the oven...)

  • cocheret

    Nice writeup. I never looked into the Mesh Cache modifier. So with that, you could reuse an animation on, say, a flag and use it over and over again in different parts of a scene?

    Can you do something similar with things like smoke and fire simulations? That is, can you bake a torch simulation and use the same bake for many torches in your scene? I've tried to figure this out but it wasn't obvious to me.

  • Jasmine Wongus

    Thanks, Kent! I needed to really understand baking, so your explanation is very helpful for me. :D

  • cpmodeling

    Oh this was a great article I had no idea there was so many types always thought baking just referred to creating bump maps to give low poly models the appearance of detail seen in the detailed high poly model used to make the map.

  • bethjett

    This was ver informative, and was very helpful in understanding the different types of baking. Thank you!

  • holsoft

    Please, don't think I don't appreciate Kent's article about baking. It is really good, but it has knocked my hopes of reading announcement of extensive baking tutorial. :-)

    I run into problems far too often when baking and after performing a lot of searches through the internet, I have found out that I am not alone who is longing after some full explanatory tutorial, which would point out most common problems. I usually end with things like HOW THE F**K I BAKE NORMALS THIS CYLINDER?! That qualifies me as amateur and that's exactly what I am. :-) Does anyone have same experience, or I didn't search long enough?

  • Mary E Glass

    Excellent article, now I get it! Thanks so much for taking the time to explain it so well. :)

  • crew
    Kent Trammell

    Thanks for reading!

  • crew
    Kent Trammell

    This article doesn't negate the potential for an in-depth baking course. We very well may do that in the future. Baking is such a weird topic around here because we've covered baking many times:

    https://cgcookie.com/course/introduction-to-texturing/

    https://cgcookie.com/lesson/map-baking/

    https://cgcookie.com/course/texturing-game-assets-with-blender/

    But still users seem confused about it frequently..

  • Omar Domenech

    My conundrum with baking is when I have to decide a texture resolution. Too little and it is specs friendly but then the pixelation kills me, too much res and too much texture files and I fear Blender wont be able to take it.

  • Roi Díaz

    Thanks!, great article!

  • Michael Yoseph

    Great article! Thanks Kent :)

  • crew
    Kent Trammell

    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.

  • Jim McLachlan

    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.

  • holsoft

    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!

  • pizzity13

    Thanks Kent!! Great article!

  • Robyn Hahn

    Thanks Kent. This was a very worthwhile read. Stimulates the imagination, too, thinking of the possibilities!

  • Chuck Shultz

    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.

CG Cookie

Learn Art. Make Dough.

Enroll in to our digital arts program and choose from four different disciplines; each with quick paths to measured success baked just for you.

Start a Free TrialorLearn More