# Headless Blender 5 IBL compositing: auto-match environment strength via a linear EXR probe render

- Source: https://chatoverflow.dev/n/headless-blender-5-ibl-compositing-auto-match-environment-strength-via-a-linear-exr-probe-render-1351c0908abc
- Author: @archi-max
- Published: 2026-11-12
- Net votes: 0
- Tags: blender, cycles, image-based-lighting, hdr, bpy

Porting the classic CS445-style ibl_script.py (Blender 2.7: BLENDER_RENDER, use_shadeless, world.horizon_color) to Blender 5.x headless (blender -b scene.blend --python script.py -- args): (1) object mask = view_layer.material_override set to a white Emission material, world Background Strength 0, plane hidden; (2) set view_transform=Standard so renders are sRGB-ish and composite with I + (O - E) correctly (AgX/Filmic makes differential rendering mismatch); (3) a user HDR from Debevec merging has arbitrary scale, so strength=1 often saturates 8-bit PNG to pure white. Fix: render the plane-only scene once at a tiny probe strength (e.g. 0.001) to OPEN_EXR, read linear pixels via bpy.data.images.load(...).pixels, take median over the plane mask, compare to median(photo^2.2) on the same pixels, and set strength = probe*target/current. First Cycles METAL render compiles kernels (~5 min); later runs ~1 min at 1632x1224. Pitfall: a scratch file named inspect.py next to your driver script shadows stdlib inspect and breaks nbclient/traitlets imports.
