Table Of Contents


Introduction

Baking allows the rendering of AOVs onto texture maps using a specific UV channel. This can be useful in a variety of scenarios. One of these is "light mapping" where the user renders the diffuse lighting received by a particular object onto a texture and then re-uses the texture during animation rendering instead of having to compute the (potentially slow) diffuse lighting on each frame.

Baking Pros

  • Can help increase rendering performance
  • Textures can be tweaked by an external image editing program or script for quality or look reasons.

Baking Cons

  • Involves some setup effort
  • The quality of the baked results depends on the resolution of the texture. Extremely high resolution textures can take a long time to compute.
  • When used for light mapping, changes to the lighting due to animated geometry and lights won't be reflected on the baked texture

The image below shows a simple light-mapped scene containing a couple of objects. Both the teapot and the floor are using a 512x512 baked TotalDiffuseLightingRaw AOV image.

 

Original scene used to generate the baked lightmap textures. Rendered in 11 seconds.

Modified shader graphs to use the lightmap textures. Rendered in 2 seconds.



The floor's baked 512x512 image. Please note that the image appears darker because it's shown in linear space.

Using Baking

Generating baked images involves a few main steps:

  • Creating an appropriate unwrapped UV channel that will be used by baking
  • Creating and configuring one or more bake sets
  • Setting up the AOVs
  • Executing the bake

Redshift requires an appropriate UV channel to perform baking. In most 3d apps, there will be an "automatic UV" or "unwrap UV" option which will generate an appropriate UV layout for baking. Two important requirements for a baking UV channel is that the UVs should fit in the 0->1 UV range and the different parts of the object should not be overlapping in UV space. The unwrapped UVs generated by most 3d apps already satisfy these criteria.


Creating Bake Sets

Once we have our UV channel, one or more bake sets should be created and configured. Bake sets contain baking settings that can be applied to single object or a group of objects. Each object in the group will get its own baked image.

Finally, Redshift's AOV settings have to be configured to specify which AOVs should be baked as well. For example, if we wanted to bake diffuse lightmaps, we should use the "TotalDiffuseLightingRaw" AOV.

AOV Setup for Baking

Redshift's baking capabilities rely on the AOV system for rendering out the baked images. Setting up the AOVs for baking is identical to setting them up for a render (camera-based) render.
You can find general information on AOVs here and a short AOV tutorial here.

We advise that users set up a separate render pass/layer (depending on their 3d app's capabilities) to configure the AOVs used for baking, as these might differ to the AOVs required by your main render.

When configuring AOVs for baking, the user has to make a choice regarding the baked image filenames. Since all bake sets rely on the global AOV options (which include filenames), how can this work when the scene contains multiple objects? I.e. how do we prevent the baking of all object in the scene from writing to the same image file?

This depends on the 3d app.


Executing Baking



Limitations

The baking system currently doesn't work with the following rendering features:

  • Tessellation and displacement. If the baked geometry is tessellated or displaced, visual artifacts will appear on the baked image.
  • Point-based techniques such as point-based subsurface scattering, irradiance cache and the irradiance point cloud don't work in conjunction with baked renders. Photons (and, subsequently, caustics) do work.
  • Projection mapping is not currently supported.
  • high-res to low-res texture baking is not currently supported. 

Using Baking for Lightmapping

Here are a few quick steps to generate baked lightmaps similar to the one shown above:

  • Create a scene like the one shown above, with two objects
  • Create unwrapped UV channels for both objects. Ensure the UV channels are named consistently.
  • Select both objects and assign them a bake set on both objects. Ensure the bake set is using the correct UV channel
  • Add a "TotalDiffuseLightingRaw" AOV to your scene
  • Depending on your 3d app, perform the baking filename steps explained above
  • Execute the bake
  • Then edit the shader graph as follows:
    • Remove any diffuse lighting by making the diffuse color black or the diffuse weight zero
    • Connect the baked images to the incandescent (or emission) color ports of your shader and set incandescent (or emission) weight to the same value as your original diffuse weight
    • Ensure that, if the image was saved out as an EXR, the gamma in the texture node is set to linear
    • The above steps essentially replace the 'real' diffuse lighting with baked diffuse lighting
    • If the diffuse port was textured, use a multiplication shader node to multiply the texture with the lightmap before connecting it to the incandescent port (or emission).