fix(exr): handle multi-level hierarchical EXR channel names#232
Open
throb wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
Open
fix(exr): handle multi-level hierarchical EXR channel names#232throb wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
throb wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
Conversation
EXR files with hierarchical dot-separated channel names (e.g. bg_wall.Combined.R, fg_rocks.Diffuse Direct.B) caused "Unable to choose decoder routines" errors from OpenEXR. Root cause: get_channel_names_by_layer() split channel names on the first dot, grouping all sub-layers under a single parent layer. For render outputs with many AOVs this created layers with 30+ channels, but the reader's pix_type array and FrameBuffer setup only support 4 channels (RGBA). Reading past the array produced undefined pixel types that OpenEXR's decoder rejected. Fix: - Split on the last dot (rfind) so "bg_wall.Combined.R" produces layer "bg_wall.Combined" with channel "R" instead of lumping all channels under "bg_wall" - Add defensive bounds check in FrameBuffer setup loop (cap at 4) - Cap exr_channels_to_load to 4 entries after assignment Tested with 56-channel Blender/Cycles render EXRs containing hierarchical AOV names across multiple render layers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_channel_names_by_layer()now splits on the last dot (rfind) instead of the first, sobg_wall.Combined.Rproduces layerbg_wall.Combinedwith channelRProblem
EXR files with hierarchical channel names like
bg_wall.Combined.R,bg_wall.CryptoObject00.r,fg_rocks.Diffuse Direct.Bcaused the OpenEXR library to throw "Unable to choose decoder routines".The root cause was that
get_channel_names_by_layer()split on the first dot, creating layers with 30+ channels (e.g. allbg_wall.*channels grouped underbg_wall). The reader'spix_typearray is fixed at 4 elements, so the FrameBuffer setup loop read past the array bounds, producing undefined pixel types that OpenEXR'sexr_decoding_choose_default_routines()rejected.Fix
rfind(".")instead offind(".")to split on the last dot. This produces proper sub-layers with 3-4 channels each (e.g.bg_wall.Combined→ R,G,B,A)if (ii >= 4) return;guard in the FrameBuffer setup lambdaexr_channels_to_loadto max 4 after assignment from the layer mapTest plan
🤖 Generated with Claude Code