3 unstable releases
| 0.2.1 | Apr 10, 2026 |
|---|---|
| 0.2.0 | Apr 10, 2026 |
| 0.1.0 | Apr 8, 2026 |
#154 in Images
175KB
4.5K
SLoC
ibl-baker CLI
ibl-baker is the command-line tool for baking HDR environments into IBL texture assets.
It supports two output formats:
.ibla— a portable, renderer-agnostic archive with PNG-encoded payloads. Format specification:docs/format-spec.md.ktx2— a GPU-ready cubemap with BC6H compression and zstd supercompression. See KTX2 Output below.
BRDF LUT always outputs as standalone .png regardless of format choice.
Installation
Install the crate from crates.io:
cargo install ibl_cli
ibl-baker --help
The crate name is ibl_cli, and the installed executable name is ibl-baker.
This installation path requires a Rust toolchain.
Prebuilt binaries for Windows x64, macOS arm64, and Linux x64 are also attached to GitHub Releases. That path does not require installing Rust.
Quick Start
# .ibla output (default)
ibl-baker bake ./environment.hdr --out-dir ./out
# KTX2 output (BC6H + zstd)
ibl-baker bake ./environment.hdr --out-dir ./out --output-format ktx2
# Both formats in one run
ibl-baker bake ./environment.hdr --out-dir ./out --output-format both
# Validate an .ibla asset
ibl-baker validate ./out/specular.ibla
Commands
ibl-baker bake input-path --out-dir ./out
ibl-baker bake input-path --out-dir ./out --target specular
ibl-baker bake ./fixtures/inputs/pisa.hdr --out-dir ./out --target irradiance
ibl-baker bake ./fixtures/inputs/Bridge2 --out-dir ./out --faces posx.jpg,negx.jpg,posy.jpg,negy.jpg,posz.jpg,negz.jpg
ibl-baker validate ./out/specular.ibla
bake
Options
| Option | Values | Default | Description |
|---|---|---|---|
--out-dir |
path | (required) | Output directory |
--target |
specular, irradiance, lut |
all | Repeatable; filters output set |
--output-format |
ibla, ktx2, both |
ibla |
Output container format |
--size |
auto or integer |
auto |
Specular cubemap face size; also the source cubemap size for irradiance filtering |
--irradiance-size |
integer | 32 |
Final irradiance cubemap face size |
--encoding |
auto, rgbd-srgb, srgb, linear |
auto |
.ibla payload encoding (ignored for KTX2) |
--faces |
comma-separated filenames | (auto-detect) | Face order for directory inputs |
--rotation |
float | 0 |
Y-axis rotation in radians |
--samples |
integer | 1024 |
Requested sample count for convolution |
--quality |
low, medium, high |
medium |
Bake quality preset |
Output Files
--output-format |
specular | irradiance | lut |
|---|---|---|---|
ibla (default) |
specular.ibla |
irradiance.ibla |
brdf-lut.png |
ktx2 |
specular.ktx2 |
irradiance.ktx2 |
brdf-lut.png |
both |
both .ibla + .ktx2 |
both .ibla + .ktx2 |
brdf-lut.png |
BRDF LUT always outputs as .png regardless of --output-format.
Input
input-pathaccepts a single latlong image file (.hdr,.exr,.png,.jpg) or a directory containing 6 cubemap faces.--facesis only valid for directory inputs and uses the fixed face orderpx, nx, py, ny, pz, nz.- Directory inputs auto-detect face files matching
px/nx/...orposx/negx/...naming. If ambiguous, pass--facesexplicitly. - All 6 faces must share the same format family and identical square dimensions.
Defaults
--size autoselects from128 | 256 | 512 | 1024 | 2048 | 4096- file inputs: estimates face size as
min(width / 4, height / 2) - directory inputs: uses detected face size directly
- selects the largest bucket not exceeding the estimated size; minimum
128, fallback512
- file inputs: estimates face size as
--encoding autoresolves torgbd-srgbfor.hdr/.exrandsrgbfor.png/.jpg/.jpeglinearis only selected via explicit--encoding linear- BRDF LUT output is always
256×256 --irradiance-sizecontrols only the final irradiance cubemap face size;--sizecontrols the internal source cubemap resolution used by irradiance filtering- Irradiance sampling is capped by quality:
low= 256,medium= 1024,high= 2048; explicit lower--samplesvalues are preserved
.ibla Output
.ibla is a portable, renderer-agnostic archive format with PNG-encoded payloads.
The --encoding option controls how pixel data is stored:
rgbd-srgb— HDR values packed into sRGB-transferred RGBA PNG; the default for HDR/EXR inputssrgb— standard sRGB color PNG; the default for LDR inputslinear— linear-valued PNG for data payloads
The full binary format specification is defined in docs/format-spec.md.
KTX2 Output
KTX2 outputs are GPU-ready cubemaps using BC6H block compression with zstd supercompression.
- Vulkan format:
VK_FORMAT_BC6H_UFLOAT_BLOCK(format 131) - Compression: BC6H unsigned half-float, 4×4 blocks
- Supercompression: zstd per-level (scheme 2)
- Input: linear f32 pixels converted to f16 → BC6H (the
--encodingoption has no effect) - BC6H
[0, 65504]range cleanly represents both HDR and LDR sources - Face order: +X, −X, +Y, −Y, +Z, −Z
- KV metadata:
KTXorientation=rd,KTXwriter=ibl-baker v{version}
validate
validate reads and inspects .ibla assets. It prints:
- format version, face count, chunk count
- width, height, mip count, encoding
- validation status (with issues listed if invalid)
Validation checks: header magic/version, manifest topology integrity, canonical face ordering, deterministic chunk slot reconstruction, payload byte ranges and overlap.
Dependencies
~59MB
~565K SLoC