BabylonJS/Babylon.js · error · Error
Wrong PIZ_COMPRESSION BITMAP_SIZE
Error message
Wrong PIZ_COMPRESSION BITMAP_SIZE
What it means
UncompressPIZ reads a bitmap used to reconstruct the 65536-entry luminance LUT of PIZ data. maxNonZero must be smaller than BITMAP_SIZE; a value >= BITMAP_SIZE means the bitmap section of the block is corrupt or misaligned, so the loader throws before overrunning the bitmap array.
Source
Thrown at packages/dev/core/src/Materials/Textures/Loaders/EXR/exrLoader.compression.ts:218
let outBufferEnd = 0;
const pizChannelData = new Array(decoder.channels);
for (let i = 0; i < decoder.channels; i++) {
pizChannelData[i] = {};
pizChannelData[i]["start"] = outBufferEnd;
pizChannelData[i]["end"] = pizChannelData[i]["start"];
pizChannelData[i]["nx"] = decoder.width;
pizChannelData[i]["ny"] = decoder.lines;
pizChannelData[i]["size"] = decoder.type;
outBufferEnd += pizChannelData[i].nx * pizChannelData[i].ny * pizChannelData[i].size;
}
// Read range compression data
const minNonZero = ParseUint16(inDataView, inOffset);
const maxNonZero = ParseUint16(inDataView, inOffset);
if (maxNonZero >= BITMAP_SIZE) {
throw new Error("Wrong PIZ_COMPRESSION BITMAP_SIZE");
}
if (minNonZero <= maxNonZero) {
for (let i = 0; i < maxNonZero - minNonZero + 1; i++) {
bitmap[i + minNonZero] = ParseUint8(inDataView, inOffset);
}
}
// Reverse LUT
const lut = new Uint16Array(USHORT_RANGE);
const maxValue = ReverseLutFromBitmap(bitmap, lut);
const length = ParseUint32(inDataView, inOffset);
// Huffman decoding
HufUncompress(decoder.array, inDataView, inOffset, length, outBuffer, outBufferEnd);
// Wavelet decoding
View on GitHub (pinned to 0592b347b8)
Solutions
- Re-download/re-export the .exr and verify integrity
- Open the file in a reference EXR utility to confirm the PIZ block structure is valid
- Check the header/offset parsing upstream for drift that would misalign this read
- Re-export with ZIP compression instead of PIZ
Defensive patterns
Strategy: try-catch
Try / catch
try {
await loader.loadAsync(file);
} catch (e) {
if (/Wrong PIZ_COMPRESSION BITMAP_SIZE/.test(String(e))) {
console.warn("PIZ bitmap corrupt; falling back to PNG");
return loadPngFallback();
}
throw e;
} Prevention
- Validate EXRs with exrheader/oiiotool at import time
- Avoid writers/tools known to emit broken PIZ data
- Re-encode problem assets with ZIP compression
- Keep checksums of shipped texture assets
When it happens
Trigger: Raised in UncompressPIZ while reading the compressed-block preamble when ParseUint16 for maxNonZero returns a value >= BITMAP_SIZE — caused by wrong block offsets or corrupted compressed data.
Common situations: Malformed EXR files produced by broken writers, wrong chunk boundaries due to earlier parse drift, or corrupted downloads.
Related errors
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/97bd866889b1257e.
Report an issue: GitHub.