Baking

Baking is the process used to pre-compute texture and lighting information. The result is often used for real-time applications (such as for games) or for exporting models into other software packages with complex shading intact, or simply as a way to eliminate rendering overhead in elaborate scenes. In this way, shaders and lighting are computed by the Modo rendering engine and baked directly into an image that maps perfectly to an existing UV texture.

Perspective Projection

Perspective Projection

Perspective Projection

Hi-res Geometry

Lo-res Geometry

Lo-res Baked Result

Depending on what your intended purpose is, there are a couple of methods for baking images. If your intent is to simply merge (flatten) multiple Shader Tree layers, then all that is needed is an image map added to the Shader Tree set to the appropriate Effect type before baking.

When baking maps such as Displacement and Normal maps, two layers of geometry are necessary, typically one is the high resolution model comprised of all the details of the final model, and a second low resolution model that approximates the shape of the high resolution model serving as the baking target. The low resolution geometry requires a proper UV map with a unique name (unique from any UV maps assigned to the high-res version). Additionally, you need to make sure the applicable layers are selected in the item list, and that the appropriate UV map is also selected. When Baking to Textures, suitable image maps must be placed and selected in the Shader Tree - don't worry, it only sounds complicated, each set-up is detailed below.

For information regarding adding layers and setting their Layer Effects, please see Shader Tree. Baking commands can be invoked from the menu bar within the Render menu and well as from the contextual menu in the Shader Tree layers.

Tip:  For more information, review our Making Games Assets with Modo video series.

Bake Items and Baking with the Game Tools

Modo has a range of features to simplify the baking process, notably:

Bake Item - Containers for all the various settings you may use. These enable quick re-triggering of the same bake.

Baking tools - A set of shortcuts for creating bake components, including a Baking Wizard, Baking tools in the Games Tools layout Toolbox, and baking options in the Mesh Operations list.

If you are unfamiliar with baking, we recommend you familiarize yourself with the different baking operations. Once this is understood, refer to Working with Bake Items and Baking Tools for detailed information about these baking tools and how to use them.

Note:  These tools offer an alternative workflow to the one described in this topic.

Tip:  To reduce baking time and memory required to bake shaders, use the Object Normal texture effect. For more information, see Effect - Shader Item

Cages and Ray Distance

When baking, rays are fired at the high-resolution model, and when the rays intersect the surface, the detail is saved to a texture. Consequently, baking requires an offset distance to determine the ray origin. This offset distance should be adjusted to include all necessary detail, without a loss of accuracy. In Modo, this distance can be defined in one of two ways:

Cage - A deformation of a mesh using a Morph Map. The rays are fired from the surface of the Cage.

Distance - A distance offset from the mesh surface.

These represent the maximum ray travel amount, both positive and negative, from the baking surface and should be set to encompass all surface deviations between the two surfaces.

The Cage is a specially created Morph Map on the baking geometry, where the morph surface is typically offset from the limit surface, and represents the ray distance using the difference between the morph position and the undeformed position of the surface.

Note:  When baking, if you specify a Cage, the Distance value should remain at 0 (zero).

The Distance value is a simple measurement from the mesh surface, and is used over the entire mesh.

Note:  Black regions in the bake result represent areas beyond the defined Distance. You can increase the Distance to eliminate them, but setting the value too high can reduce accuracy and may introduce errors, depending on the geometry.

Bake to Render Outputs

The command Bake to Render Outputs allows you to use a UV map from a surface to generate a rendered image that can be applied back to the surface as a texture map.

The command uses the functionality of the Shader Tree's Render Outputs, which allows the baking of:

Ambient Occlusion specific texture maps,

Diffuse Coefficient maps, or

baking a Final Color map that fully computes all surfacing and shading of the target item.

Once rendered, images can be saved to disk from the Render Display viewport, then imported and applied back to the geometry.

Before baking, it is important to follow these steps:

1.   Select the target item in the Items list or 3D viewport.
2.   Select the target UV map in the Vertex Maps Lists viewport.

By default, render baking ignores any setting that may be applied to the Render Item's Frame Width or Frame Height settings, and instead uses the value set in the Render Item's Bake Width and Bake Height settings. The resolution set when a render item is first created is 1024x1024, meaning any baked renders are in a 1024x1024 format unless this setting is changed.

Note:  If you're using Modo 12.2 or earlier, Baking Width and Height are accessed by clicking the More button at the bottom of the Frame tab in the Properties menu. If you're using Modo 13.0 or later, Baking Width and Height properties are accessed by clicking More at the bottom of the Frame tab in the Properties menu.

Additionally, an offset amount is applied to the final pixels to reduce, or eliminate, possible seams at UV borders edges.

Note:  The amount of the border offset is determined by the Bake UV Border Size setting in the Preferences. See Bake UV Border for details.

In a default scene, the Render Output is set to Final Color, and you can right-click on the effect type in the Effects column of the Shader Tree and define an alternate render output style. Once the target items are selected, invoking the command Render > Bake to Render Outputs renders all active Render Outputs simultaneously.

Tip:  The video below shows you how to bake to a Render Output using Modo 12.2 and earlier. For information on how to bake to a Render Output in Modo 13.0 and later, see the above note.

Open Progressive Baking

To quickly render progressive baking and set rendering options, on the application menu bar, click Render > Open Progressive Baking. The Preview Viewport displays.

You can preview your textures and lighting information in the render preview window and watch your changes as you refine their properties progressively. This results in faster iterations of your work, giving you a more interactive experience when baking diffuse and light maps, troubleshooting, and developing your art direction.

This video demonstrates the texture baking workflow to transfer lighting and shading details.

For more information about how to create and configure bake items, see Working with Bake Items and Baking Tools.

Tip:  Preview saves it's full progressive render state when Auto-Save completes a save. You can load the previous render state at a later time.

Bake from Object to Render Outputs

The Bake from Object to Render Outputs command is similar to the Bake to Render Outputs command above, however it allows the additional ability to generate its results using an alternate mesh layer. It is essentially transferring the surfacing from one object to another.

Typically, this setup consists of:

one layer with a detailed, high resolution mesh (the source mesh), and

the target baking mesh layer, which is a lower resolution mesh, approximating the overall shape of the high resolution layer.

This feature is often used in games, where the detailed surfacing from the high-res asset is applied to the low-res assets to give the overall visual impression of higher resolution in the final model. Once rendered, images can be saved out from the Render Display viewport, then imported and applied to the target geometry.

Baking from an object requires the following steps:

1.   Add a background mesh layer containing the high resolution model. This should visible in the Items list, but not selected.
2.   Add a foreground mesh layer containing the low resolution model, and a uniquely named UV map. The layer should be visible and selected.
3.   Select the foreground mesh UV map in the Lists viewport.
4.   Select the command Render > Bake from Object to Render Outputs.

This opens the bake options dialog.

5.   Enter an offset Distance that should encompass all surface differences between the two mesh layers.

Note:  You can also use a predefined Cage to determine the offset distance.

6.   Click OK. Modo extracts the geometrical, shading, and lighting information from the background layer, and bakes this detail to the foreground mesh's UV map.

Note:  Pressing OK renders all active Render Outputs simultaneously.

Bake to Selected Texture

The command Bake to Selected Texture can be found in the menu bar under Render > Bake to Selected Texture, but is more commonly used from the Shader Tree directly, using the right-click contextual menu (opened by clicking on the target layer) where it is called Bake to Texture.

This command generates a bitmap texture of one or more Shader Tree texture layers, when all layers share the same Effect type. The common uses for the function are:

to convert a procedural texture layers to a bitmap for displacement freezing, or

to combine complex, multiple Shader Tree layers into a single layer, or

to pre-compute render intensive effects, such as occlusion, saving render time and eliminating any frame to frame variance that may occur.

To use this feature:

1.   First define a new Image Map layer in the Shader Tree.The file save location is defined, as well as the Resolution and Bit Depth. For information on creating Image Maps, please see Add Images.

Note:  The Texture Locator settings are used to determined the appropriate UV map for baking, so make sure the image is applied appropriately.

Note:  The position of the layer within the Shader Tree is important, because only layers below the target are evaluated for baking.

2.   Define the Effect for the layer, this must match the source layers.
3.   Disable the layers visibility (by toggling the eye column) to ensure the target baking layer itself isn't evaluated as part of the bake.
4.   Right-click on the layer, and select Bake to Texture.

This opens the Render Display window.

5.   Save the image using Save Image button.

Bake to UDIM Tiles

If your UV map uses UDIMs for texture placement, you can bake the UV regions to a set of UV tiles using the Use Clip UDIM option in the Texture Locator tab of the Shader Tree properties. You can add a UDIM layer to the Shader Tree using (new udims), to create UDIMs from scratch, or (load udims), to use existing UDIMs.

To Bake To UDIMs

Note:  The following steps create a UDIM folder from scratch using (new udims). You can also add an existing folder using (load udims). Any images in the folder can be overwritten with the baked images.

1.   In the Shader Tree, add a UDIM layer using Add Layer > Image Map > (new udims).

This opens the folder browser.

2.   Choose a folder and click Select Folder.

The UDIM Wizard opens.

3.   Edit the fields as required. See Creating UDIMs Using the UDIM Wizard for full details. It is important to generate the correct number of UDIMs so that they match the UDIM range in your UV map. The amount generated is determined by the UDIM Range Start and UDIM Range End fields. For example, if you set the range as 1001 to 1003, Modo will generate three UDIM tiles, placed at U=0, U=1, and U=2.

Check Overwrite Existing Images so that the new UDIMs replace any existing UDIMs of the same name in the destination folder.

4.   Click OK to generate the UDIMs.

This will add a UDIM layer to the Shader Tree.

5.   Depending on the position of the new layer in the Shader Tree, the new UDIMs may overlay existing layers and appear on the mesh. This isn't a problem as we don't need to see the new layer in order to bake to it. Hide the layer by clicking on the visibility icon in the left column of the Shader Tree.
6.   Right-click on the new UDIM layer and select Bake to Texture.

The baking window will open and each tile will be baked automatically.

7.   The UDIMs need to be saved. Open the Images/Clips List and expand the folder containing your new UDIMs.

The images have an asterisk by their names to indicate that they haven't been saved.

8.   Select all the UDIM images, right-click and select Save.

The asterisks disappear and the images are saved to the destination folder.

Bake from Object to Selected Texture

The command Bake from Object to Selected Texture can be used to generate two specific types of texture maps using the foreground and background mesh layer functionality described in Baking. Specifically, the function is used to generate Displacement Maps and Normal Maps.

A Displacement Map is a grayscale image that represents the difference in position between a low-resolution foreground mesh and a high-resolution background mesh. A Normal Map uses color to represent the difference in the surfaces normal facing direction. Both maps, once generated, can be applied back to the lower resolution geometry to give the impression of much greater resolution.

Note:  With baking Normal Maps, you can either use a Cage or a Distance value. For Displacement Maps, use only a Distance value.

To use Bake from Object to Selected Texture:

1.   Add a background mesh layer containing the high resolution model. This should be visible in the Items list, but not selected.
2.   Add a foreground mesh layer containing the low resolution model, and a uniquely named UV map. The layer should be visible and selected.
3.   Select the foreground mesh UV map in the Lists viewport.
4.   Optionally, to use a Cage, add a Morph Map, which is offset from the surface.
5.   Add an appropriate target bitmap texture layer to the Shader Tree with the required Effect type (such as Normal).

Note:  The associated Texture Locator settings are used to determined the appropriate UV map for baking, so make sure the image is applied correctly.

6.   Disable the texture layer's visibility (by toggling the eye column) to ensure the target baking layer isn't evaluated as part of the bake.
7.   Right-click on the texture layer and select Bake from Object to Selected Texture.

This opens the bake dialog.

Bake 2 Popup

8.   If you're using a Cage to generate a Normal Map, select the Cage and leave the Distance at 0 m. Alternatively, for Normal Maps or Displacement Maps, specify the Distance value.
9.   Click OK.

This opens the Render Display and Modo bakes the detail to the texture layer.

10.   Save the image using Save Image button.

Note:  Make sure that the Normal Map layer in the Shader Tree is not in the same mask as the item you are trying to bake from.

Bake UV Border

Depending on the type of geometry, and the resolution of the baked image, UV border seams may be visible. These can be eliminated using the Bake UV Border Size option in System > Preferences, listed under Rendering > Final Rendering. This expands the UV border by the specified number of pixels to avoid distinct seams.

Note:  The Bake UV Border Size must be greater than 0 to enable border expansion.

The Bake UV Border functionality requires an active Alpha Render Output with the same antialiasing settings as the render output. If no Alpha Render Output is found that fulfills this condition, Modo will automatically add one to the render window. This is added because Modo needs an alpha channel to compute the border offset.

Let's say you have an Alpha Render Output and a Shading Normal Render Output with Antialasing set as follows:

Antialiasing is enabled on both - Modo does not add a new Alpha Render Output to the render window.

Antialiasing is disabled on either one of them (but not both) - Modo generates an Alpha Render Output in the render window with Antialiasing set to match the Shading Normal Render Output.

Antialiasing is disabled on both - no Alpha Render Output needs to be added to the render window.

Note:  If an Alpha Render Output is added automatically, it is only visible in the render window, and does not appear in your scene.

Bake Geometry Cache

Modo has multiple features that work by way of virtual geometry. Virtual geometry describes geometry in the scene that you interact with, but is only a representation of the actual geometry used to render. Good examples of virtual geometry are Subdivision Surface models, Displacement, Render Curves, and Fur.

Selecting RenderRender, or pressing F9, causes Modo to take the instructions for each feature and convert them to real geometry for the final rendering. This procedurally generated geometry for rendering can be baked into real Mesh items in a scene, making it possible to apply complex procedural displacements or generate fur and bring it back to the scene as real geometry that can be directly edited or exported to other packages. Selecting Render > Bake Geometry Cache displays the following dialog.

Bake Geo Cache

Option

Description

Surfaces

When enabled, the Surface settings of the original object are cloned and added into new Material Groups assigned to the baked geometry.

Shaders

When enabled, the Shader settings per item of the original object are cloned and added to a Material Group assigned to the baked geometry.

Fur

When enabled, convert any Fur in the scene to geometry. If the Fur is set to Strips, it is converted to polygons. If the fur is set to Tubes it is converted to individual Curves, representing each individual fiber.

Note:  The Curves for Fur can be further converted to polygons using the 'Render Curves' command and invoking a second pass of the Bake command.)

Running the command converts all Mesh Item layers in the scene, as well as Instances and the procedural effects Fur, Render Curves, and Replicators. Mesh Density is based on the settings for each individual item (exactly as it would tessellate for rendering). The resulting meshes are a separate mesh layer for each surface or effect in the scene.

Note:  Special procedural effects, such as Volumes, Blobs, Render Booleans, or Sprites cannot be converted to meshes.

Tip:  Depending on the complexity of the scene, it is possible to create scenes of immense size using the Bake Geometry Cache command. The render statistics panel gives a readout of the total scene geometry during each render as a useful guideline.
If you only want to modify a single element, you can do so by saving individual mesh layers out by right-clicking on the layer in the Items list and selecting Save Selected, and then opening the resulting file and applying the Bake Geometry Cache command.