TheGuidebook

How to Bake Procedural Materials (Blender to Unity)

How to Bake Procedural Materials into PBR Maps

Setup

  1. Apply your material to a square plane; adjust settings to your liking.
    Material Display
  2. UV Unwrap your plane. (Important!)
  3. Add an Image Texture to the Shading Node Workspace for each texture type you want to bake (diffuse, AO, normal, etc.)

Diffuse Map Example (Base Color)

  1. Use cycles (can only bake materials in cycles), set Bake Type to Diffuse
    Bake Type to Diffuse
  2. Disable Direct and Indirect contributions under Influence
    Disable Direct and Indirect Contributions
  3. Set Margin –> Size to zero pixels
    Margin Size
  4. While selecting your Diffuse Image Texture node, click the Bake button.
    Diffuse Image Texture Node
  5. Save your Diffuse Image Texture wherever you want.
    Diffuse Image Texture Display
  • Other textures can be baked in the same way by just changing the Bake Type.
    Bake Type Drop Down Normal Map Texture

Baking Metallic Maps

Metallic Maps are a bit harder to bake in Blender (3.3.0 as of writing this) because there is no Metallic option. You must bake it to a placeholder Bake Type and simply rename the file.

A good way to do this is to take advantage of the Node-Wrangler Addon’s Node Preview feature. With the addon enabled, you can CTRL + SHIFT + CLICK on any node to preview its data. Behind the scenes, it’s setting the value coming off the node as an emission value. Here’s how we can exploit this:

  1. Preview the final node in your tree of metallic value nodes.
    Final Node Preview
    Alternatively, if your material has a flat metallic value, you can preview a value node set to the metallic value.
    Flat Metallic Value
  2. Set the Bake Type to Emit.
    Emit Bake Type
  3. Bake as usual. (Remember to have your desired image texture node selected!)

Importing into Unity

Import to Unity

How to Set up Textures in Unity Materials

  1. Unity and Blender have slightly different names for each map.
BlenderUnityDefinition
DiffuseAlbedoRGB Base Color of Material
GlossyMetallic***BW/A How much Material looks like metal (kinda)
RoughnessSmoothness***BW/A How light scatters across a surface
NormalNormalRGB values that determine how light bounces per pixel
HeightHeightBW how much each pixel displaces the mesh
Ambient OcclusionOcclusionBW contains lighting data for soft/ambient shadows
2. You can simply import your baked textures and drag and drop them into the corresponding texture slots. Some texture maps, like Normal maps, require their type to be set to the correct value.
Normal Map in Task Bar
  • Important Note: Unity combines the Metallic and Roughness maps from Blender into one map. The alpha channel of the Metallic Map determines Smoothness. Generally, it is okay to use Blender’s Roughness for Unity’s Metallic Map but INVERT THE VALUES OF BLENDER’S BAKED ROUGHNESS MAP or the Metallic/Smoothness will be inverted.

Combined Roughness and Metallic

This compositing setup can be used to prepare a Roughness + Metallic Map for Unity:
Compositing Node Setup

After compositing, set your render size to the preferred texture size and complete your render.
Setting Texture Size