Skip to content

Commit

Permalink
EXR: more standard RGBA channel name detection
Browse files Browse the repository at this point in the history
Various EXR images especially from movie assets do not simply have "R"
etc as channel names; the convention seems to be to have "layer name",
".", "color channel name". For example, channels in EXR might be
"rgb.R", "rgb.G", "rgb.B", which RenderDoc was not detecting previously
and displaying an all-black image.
  • Loading branch information
aras-p committed Oct 30, 2024
1 parent 70ef88c commit 80e2fc5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion renderdoc/core/image_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,10 +758,14 @@ void ImageViewer::RefreshFile()
return;
}

// Expect R/G/B/A channel names as first char of the string, or
// after the last '.' char.
int channels[4] = {-1, -1, -1, -1};
for(int i = 0; i < exrImage.num_channels; i++)
{
switch(exrHeader.channels[i].name[0])
const char* dotPos = strrchr(exrHeader.channels[i].name, '.');
const char *name = dotPos ? dotPos + 1 : exrHeader.channels[i].name;
switch(name[0])
{
case 'R': channels[0] = i; break;
case 'G': channels[1] = i; break;
Expand Down

0 comments on commit 80e2fc5

Please sign in to comment.