DJH Bake Batcher Documentation

v1.0.4 (Blender 3.6+)

Read the Docs...

Welcome! This page contains documentation for my Texture Baking Addon for blender.

Use the navigation panel on the left to quickly jump between sections.

About

Bake all maps in a single click

This addon makes texture baking feel more like pressing F12 to render a scene, than the long and frustrating process that it can be by default. It achieves that by requiring collections that organize your high and low-poly assets before baking, this gives the addon enough information to be able to automate the rest of the baking process, resulting in a fully textured low-poly asset.

The addon also has additional options for baking single maps, switching outputs, and auto saving the bake results to your hard drive.

To be completely clear, while my addon excels in automating common baking tasks, it may not be able to fully automate baking for complex setups. The addon prioritizes speed and efficiency over flexibility, so if you're looking for total customization, this is probably the wrong tool for you and I'd recommend taking a look at some of the other excellent baking addons that are available.

Download and Install

The addon can be purchased and downloaded from Blender Market.

In Blender, select Edit->Preferences, click on the Addons tab, click Install and open the file: djh_bake_batcher.zip.

image

The addon has a single preference, to select the file format of baked images.

The 'N' Panel

The best way to interact with the addon is via the 'N' panel of the 3D Viewport. The addon's UI is located under the 'DJH' tab.

image

At the top of the panel are some general settings. 'Path' sets the path to the directory where baked images will be saved. The path can be relative to the .blend file or an exact path can be copied in from your file browser.

Baking via emission is a good option for many kinds of maps. When baking single maps, you can adjust the name of the baked texture via the 'Emit Name' setting.

With 'Bake Resolution' you can select the resolution used when creating textures to bake to. For simplicity sake, the addon only creates square textures.

Margin is the pixel margin to render around uv islands, and Extrusion is the distance the base mesh will be expanded before baking.

Pack UVs toggles whether the uv maps of all objects in the low-poly collection will be packed into one UV space before each bake, or to skip that step if you've prepared your UVs ahead of time.

Baking a Collection

If you click 'Bake Collection' before assigning the active object to a hp or lp collection, you will get an error message.

image

To bake from HP to LP in 'One Click' you need two collections. The names of the collections should be identical except for the suffix, which should be '_hp' for high-poly and '_lp' for low-poly.

image

Clicking 'Bake Collection' again will tell you that the origins of the collections must be defined and that empties have been created.

image

In the 3D Viewport, place the empties in the same relative location for each collection. This will be the origin point of the created mesh, and allows the HP and LP collections to be side by side rather than overlapping. For example, both collections could contain objects arrayed along the X axis, but the HP collection could be offset a few units along the Y axis.

image

Now we are all set up and clicking 'Bake Collection' will finally bake something. It will merge the collections into temp meshes, pack their UVs, and create all the needed images. It will bake the baseColor, roughness, metallic, AO, and normal maps, name them and save the images to your hard drive. Finally, it will create a new material with the baked textures, assign it to the merged 'LP' result, and then clean up.

image

image

Clicking 'Bake Asset' again will replace the result of the previous bake with a new one.

Note that one limitation of this method is that, due to how the UVs are packed, the result of each bake may have a slightly different UV layout.

Also note that the 'shader' node must be identified in every material you are baking from. The addon attempts to do this automatically but may need help in some cases. See 'Preview' below.

Baking Individual Maps

If you need more control, and can't bake in 'One Click,' there are some other tools that can improve your baking workflow. To use them, a material on the selected object must contain an image node that is labeled 'bake.'

The 'Set Bake Image' button can set this up for you.

image

Once a 'bake' image has been set, additional options will appear in the Baker Panel.

image

Preview (Swap Bake Output) will edit the materials on the selected objects so that the map type you select is connected directly to the material output socket.

image

To correctly preview/bake the output you select from the menu, the operator must determine which node in your material is the shader. To do this, several rules are applied as follows:

  1. Select a node with the label 'shader'
  2. If that fails, select the node with the most connected input sockets (at least 3)
  3. If there isn't one, select a node whose name ends in 'BSDF'

The most reliable way to ensure that the correct node is selected as the shader is to tag it, there is an entry added to the Shader Editor->Node menu that does this.

image

Bake Texture will let you select a map type to bake... if only one object is selected, it will bake from that object directly. If two or more objects are selected, it will bake using the 'Selected to Active' option.

Operators

Bake Asset Collection

Context: Anywhere
ID: djh.bake_asset_collection

Bakes from an 'asset_hp' collection and an 'asset_lp' collection, into a merged single-material mesh. Any existing objects or images with identical names will be replaced by the results.

Same as clicking the 'Bake Collection' button.

Bake Texture

Context: Anywhere
ID: djh.baker
Param: Type [Enum]

(Don't call directly, use menu instead) Bakes a texture of the specified type. Bakes to the image tagged 'bake' in the material.

image

Swap Bake Output

Context: Anywhere
ID: djh.set_bake_output
Param: Type [Enum]

Changes which socket is connected to the shader output on the selected objects.

image

Pack Collection UVs

Context: 3D Viewport
ID: djh.pack_uv_collection

Packs the UVs of all objects in the collection into one UV space. Note: For this to work on curves, you must convert them to a mesh.

image

Create Bake Images

Context: Anywhere
ID: djh.create_bake_images

Adds a 'bake' image to all materials on the selected objects.

image

Auto-Name Images

Context: Anywhere
ID: djh.rename_images

Renames all images to match their filenames.

image

Create Bake IDs

Context: 3D Viewport
ID: djh.create_bake_ids

Create custom props for bake batcher output filenames, useful when baking object variations that share mesh data

image

Arrange Nodes

Context: Node Editors
ID: djh.arrange_nodes

Arranges all nodes in the current node tree

image

Tag Node

Context: Node Editors
ID: djh.tag_node
Param: Tag Name [String]

Sets the label of the active node

image

© 2024 Daniel Hickox