Skip to content

Bake Ambient Occlusion Map for Pyrogenesis (Blender 2.8+)

This tutorial shows how to bake ambient occlusion (AO) maps from a 3D model for use in the Pyrogenesis engine (0 A.D.). The process works with Blender 2.8 through 5.x.

Prerequisites

  • Blender 2.8 or newer (tested up to 4.x)
  • A COLLADA (.dae) mesh exported for Pyrogenesis
  • Basic knowledge of Blender's UV editing
  • Cycles render engine available

What is Ambient Occlusion?

Ambient occlusion simulates soft shadows in crevices and contact points where ambient light is blocked. Baking AO into a texture improves visual quality in real-time engines without expensive runtime calculations.

Workflow Overview

  1. Import the COLLADA mesh with proper unit scaling
  2. Create an emission material to bake AO as diffuse color
  3. Add a dedicated UV map for the AO texture (no overlapping islands)
  4. Optimize UV layout with seams and packing
  5. Configure bake settings based on target resolution
  6. Bake and export the AO texture

1) Import the Mesh

Open Blender and import your COLLADA file:

  • File → Import → Collada (.dae)
  • In the import options panel (right side), check "Import Units"
  • This ensures the mesh scale matches Pyrogenesis expectations
  • Select your .dae file and click Import

alt text


2) Create an Emission Material for AO Baking

To bake ambient occlusion as a visible texture, we need a special material setup.

Add a new material

  1. Select your imported mesh
  2. Go to the Shading workspace or open the Shader Editor
  3. Create a new material (or replace the existing one)

Set up the emission shader

  1. Delete the default Principled BSDF node
  2. Add a Shader → Emission node (Shift+A)
  3. Add an Input → Ambient Occlusion node
  4. Connect Ambient Occlusion Color outputEmission Strength input
  5. Connect Emission outputMaterial Output Surface input

This setup makes the AO values visible as emission, which we can bake.

alt text

Alternative (simpler method): - Just use Emission shader; Blender's Emit bake will capture AO when you set Bake Type to "Ambient Occlusion" (not "Emit") in the bake panel


3) Create a Dedicated UV Map for AO

The AO texture needs its own UV map with no overlapping islands to avoid baking artifacts.

Add a new UV map

  1. Select your mesh in Object Mode
  2. Go to Object Data Properties (green triangle icon)
  3. Under UV Maps, click the + button to add a new UV map
  4. Rename it to AO or AOMap (double-click the name)
  5. Make sure this new UV map is selected (highlighted)
  6. Keep the original UV map with the camera icon (render-active) if you have one

Unwrap with Smart UV Project

  1. Switch to Edit Mode (Tab)
  2. Select all faces (A)
  3. Press USmart UV Project
  4. In the Smart UV Project options:
  5. Island Margin: 0.02–0.05 (gives padding between islands)
  6. Leave other settings default
  7. Click OK

This creates non-overlapping UV islands automatically.

alt text


For better AO quality, you can manually refine the UV layout.

Mark seams to reduce distortion

  1. In Edit Mode, select edges where you want UV cuts
  2. Common seam locations:
  3. Hard edges and sharp corners
  4. Back/hidden faces
  5. Natural visual breaks (armor plates, clothing folds)
  6. Press Ctrl+E → Mark Seam
  7. Press U → Unwrap

alt text

Pack UV islands efficiently

  1. In the UV Editor, select all islands (A)
  2. Press Ctrl+P or go to UV → Pack Islands
  3. Pack Islands settings:
  4. Margin: Match your bake margin (see next section)
  5. Rotate: Enabled (allows better packing)
  6. Click OK

This maximizes texture space usage and ensures consistent pixel density.


5) Configure Bake Settings

Choose bake margin based on texture resolution

The bake margin prevents seams and artifacts at UV island borders. Use these recommended values:

Texture Resolution Bake Margin
256×256 2 px
512×512 4 px
1024×1024 8 px
2048×2048 16 px

Add a bake target texture

  1. In the Shader Editor, add a new Image Texture node (Shift+A → Texture → Image Texture)
  2. Click + New in the Image Texture node
  3. Create a new image:
  4. Name: AO_Bake (or your model name + _AO)
  5. Width/Height: Choose resolution (512×512 or 1024×1024 is common for game assets)
  6. Color: Set to Black (RGB: 0,0,0, Alpha: 1.0)
  7. Uncheck Alpha (not needed for AO)
  8. Do not connect this node to anything — just leave it selected (white outline)

alt text

Switch to Cycles and configure bake

  1. Go to Render Properties (camera icon)
  2. Set Render EngineCycles
  3. Set DeviceGPU Compute (if available, for faster baking)
  4. Scroll down to the Bake section
  5. Configure bake settings:
  6. Bake Type: Ambient Occlusion
  7. Margin: Use the recommended value for your resolution (e.g., 8 px for 1024×1024)
  8. Margin Type: Extend (fills margin by extending edge colors)
  9. Clear Image: Check this to clear any previous bake
  10. Selected to Active: Leave unchecked (we're baking the object to itself)

6) Bake the Ambient Occlusion

  1. Make sure you're in Object Mode
  2. Select your mesh
  3. Ensure the AO_Bake Image Texture node is selected in the Shader Editor (white outline)
  4. In the Bake panel, click Bake
  5. Wait for the bake to complete (progress shows in the status bar)

alt text

Verify the bake

  1. In the Shader Editor, the Image Texture node should now show the baked AO
  2. Check the UV Editor — you should see the AO painted onto the UV layout
  3. Look for any artifacts, black spots, or seams

alt text

7) Export the Texture

  1. In the Image Editor or UV Editor, make sure your baked AO image is selected
  2. Go to Image → Save As…
  3. Choose export settings:
  4. Format: PNG (lossless, good for AO)
  5. Color Space: sRGB (for visual textures)
  6. Compression: 15% (good balance of size/quality for PNG)
  7. Save with a clear name: modelname_ao.png

alt text


8) Using the AO Map in Pyrogenesis

Once exported:

  1. Place the AO texture in your mod's textures/ folder
  2. Reference it in the model's material definition (usually in an XML actor file)
  3. The AO map typically goes in the aoMap or ambient occlusion slot depending on the shader
  4. Pyrogenesis will multiply the AO map with the base texture to add depth

Consult the Pyrogenesis/0 A.D. modding documentation for specific material setup.


Tips & Best Practices

UV Layout

  • Avoid overlapping islands: Overlaps cause incorrect AO in the overlapped areas
  • Consistent texel density: Try to keep similar-sized faces using similar UV space (use the Checker texture to visualize)
  • Seam placement: Hide seams on less visible areas (underside, back faces)

Bake Quality

  • Higher resolution for hero assets: Use 2048×2048 for close-up models
  • Lower resolution for background props: 256×256 or 512×512 saves memory
  • Samples: In Cycles Render settings, increase Samples (128–256) for cleaner AO (reduces noise)
  • AO Distance: In the Ambient Occlusion shader node (if you use one), adjust Distance to control how far AO rays travel (smaller = tighter contact shadows)

Performance

  • GPU rendering: Enable GPU Compute in Cycles for much faster bakes
  • Simplify complex meshes: High poly counts slow down AO calculation; consider decimation or retopology

Troubleshooting

Bake is completely black

  • Check render engine: Must be Cycles (not Eevee)
  • Check bake type: Should be "Ambient Occlusion" not "Emit"
  • Check AO node: If using AO shader node, ensure it's connected properly
  • Lighting: AO doesn't need lights, but make sure your scene isn't broken

Seams visible in the baked texture

  • Increase bake margin: Use 8 px or 16 px
  • Check UV island spacing: Run Pack Islands with matching margin
  • Use "Extend" margin type: Fills seams better than "Adjacent Faces"

Texture looks noisy/grainy

  • Increase Cycles samples: Render Properties → Sampling → Render samples (try 256+)
  • Increase AO samples: Shader node → Samples property (if using the AO shader node)

UV islands have wrong AO

  • Overlapping UVs: Make sure the AO UV map has no overlaps (use Smart UV Project or mark seams properly)
  • Wrong UV map active: Ensure the AO UV map is selected (highlighted) before baking

Wrong scale after import

  • Enable "Import Units": Re-import the .dae with this option checked
  • Manual scale: In Object Mode, press S and scale to correct size, then apply scale (Ctrl+A → Scale)

Version Compatibility Notes

This tutorial is tested and compatible with:

  • Blender 2.8x – 2.93 (LTS)
  • Blender 3.x series
  • Blender 4.x series
  • Blender 5.x (as of Dec 2025)

Minor UI changes between versions: - Blender 4.1+ has updated Pack Islands algorithm (better quality) - Blender 3.0+ moved some bake options (same functionality, slightly different panel layout)


Summary

  1. Import .dae with "Import Units" checked
  2. Set up Emission material (or configure for AO bake)
  3. Create a new non-overlapping UV map (AO)
  4. Unwrap with Smart UV Project; optionally mark seams and pack islands
  5. Add a blank Image Texture node (unconnected, selected)
  6. Set Cycles bake type to "Ambient Occlusion" with appropriate margin
  7. Bake and save as PNG

Your AO map is now ready for Pyrogenesis!