Skip to content

Hybrid Lighting Pass (Direct / Indirect Light Baking)

Sanctus Bake can optionally bake real scene illumination directly into your Base Color texture map. This allows your baked textures to inherit direct shadows, indirect light bounces, and light hues — all in 32-bit float HDR precision.

Enabling Light Baking

In the SBake panel, under the Lighting section, you'll find two checkboxes:

  • Bake Direct Light: Captures direct illumination from sun, lamps, area lights, and point lights.
  • Bake Indirect Light: Captures indirect light bounces and global illumination.

You can enable one or both depending on your needs.

How It Works

The lighting bake is a non-destructive process that happens right before the final image is saved:

Step 1: Isolate the Light Mask

The engine temporarily overrides the target object's material slots with a 100% Flat Matte White Material (R:1.0, G:1.0, B:1.0).

Step 2: Execute a Cycles DIFFUSE Bake

A native Cycles bake pass is executed with the following configuration:

  • Type: DIFFUSE
  • Color influence: Disabled (unchecked)
  • Direct: Enabled if "Bake Direct Light" is checked
  • Indirect: Enabled if "Bake Indirect Light" is checked

Step 3: Read 32-bit Float HDR Data

The raw pixel buffer is read directly from Blender's internal image memory (bpy.data.images[...]). Because Cycles operates internally in 32-bit float HDR:

  • Highlights naturally exceed 1.0
  • Shadows drop toward 0.0
  • A Lambertian scattering correction (1/π) is applied for absolute lighting accuracy

Step 4: Mathematical Merge

A pixel-by-pixel multiplication pass is performed over the raw internal array data:

$$\text{Final Albedo Pixel} = \text{Raw Socket Albedo} \times \text{White Light Mask Value}$$

Step 5: Cleanup

The temporary white material is removed, and the original material slots are restored exactly as they were. The final combined result is saved to the user's target output format (PNG, TIFF, etc.).

When to Use Light Baking

Scenario Recommendation
Architectural visualization Enable both Direct and Indirect for realistic baked lighting
Game assets with static lighting Enable both — replaces runtime lightmaps
Product renders Enable Direct only for controlled studio lighting
Textures for dynamic lighting Disable both — keep albedo neutral for runtime lighting

Performance Note

Light baking adds one additional Cycles bake pass per material slot. For complex scenes with many materials, consider baking lighting only on the final combined texture set.

Technical Details

  • The light mask is never saved to disk — it exists only in memory during the bake process.
  • The multiplication is performed in linear color space for accurate results.
  • The original scene is completely restored after the bake — no temporary materials or nodes remain.