Skip to content

Fix decoder errors for Blender multilayer EXRs - #339

Open
throb wants to merge 1 commit into
AcademySoftwareFoundation:developfrom
throb:blender-exr-fix
Open

Fix decoder errors for Blender multilayer EXRs#339
throb wants to merge 1 commit into
AcademySoftwareFoundation:developfrom
throb:blender-exr-fix

Conversation

@throb

@throb throb commented Sep 7, 2026

Copy link
Copy Markdown

Linked issues

None.

Summarize your change.

Fix OpenEXR stream discovery and decoding for Blender single-part multilayer renders. A reduced real-world Blender EXR is included at test_resource/media/blender_multilayer.exr so maintainers can reproduce the original failure or evaluate another implementation.

Describe the reason for the change.

Blender writes nested channel names such as beauty.Combined.R, beauty.Depth.Z, and volume_high.Combined.R. xStudio split channel names at the first dot, collapsing every beauty.* pass into one oversized stream. That stream exceeded the reader's fixed four-channel image buffer and OpenEXR reported Decode pipeline has no read_fn declared followed by Unable to choose decoder routines.

Describe what you have tested and on which operating system.

Tested on Windows 11 with Visual Studio 2022 and the Release configuration.

  • Built the media_reader_openexr target successfully.
  • Passed OpenEXRMediaReaderTest.BlenderMultilayerSinglePart, including an RGBA pixel decode from the fixture.
  • Confirmed the pre-fix reader reproduces the decoder error with the committed fixture.
  • Confirmed the patched reader opens the same fixture without an OpenEXR decoder error.

The existing OpenEXRMediaReaderTest.Test still fails independently on this Windows setup because it constructs the reader without preferences; this change does not alter that test.

Add a list of changes, and note any that might need special attention during the review.

  • Split channel names at the final dot so nested Blender layer names remain intact.
  • Prefer Blender Combined layers when selecting the default image stream.
  • Bound decoded streams to the reader's four-channel buffer and initialize unused pixel-type entries.
  • Add a 256x196, single-part, 64-channel Blender EXR fixture with real pixel data and sanitized metadata.
  • Add a regression test covering all 17 discovered streams and decoding beauty.Combined as RGBA.

The fixture is a quarter-resolution derivative of a real failing Blender 5.2 render. It is 1.38 MB and intentionally preserves the original mixed half/float channel layout.

If possible, provide screenshots.

Not applicable; the regression is covered by the included fixture and decoder test.

Blender single-part multilayer EXRs use nested channel names such as beauty.Combined.R. Splitting channel names at the first dot collapsed every beauty pass into one oversized stream, which exceeded the reader's four-channel image buffer and caused OpenEXR decoder errors.

Preserve the complete layer prefix by splitting at the final dot, prefer Combined beauty layers as the default stream, limit selected decoder channels to four, and initialize unused pixel type entries.

Add a reduced, metadata-sanitized Blender EXR fixture containing the real 64-channel layout and pixel data from a failing render. The regression test verifies all discovered streams and decodes beauty.Combined as RGBA.

Signed-off-by: Robert Nederhorst <throb@throb.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant