PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.18k stars 1.23k forks source link

Regression with 24.08 : Hio module does not support Monochrome EXR images #3289

Open seando-adsk opened 2 months ago

seando-adsk commented 2 months ago

Description of Issue

We have a unit test in MayaUSD that reads OpenEXR images with 1, 2, and 4 channels in both half and float format to make sure every image type loads correctly.

Initially logged as issue #2800 which was fixed in 24.03/24.05. However the issue is back again in 24.08.

Looking at recent changes, replacing strIsRed() with a combined strIsComponent() suddenly lost the capability to decode a Y channel as being a potential red channel. Don't know if this is sufficient to cause the error we see though. Change is here.

The following patch gets us to:

diff --git a/pxr/imaging/hio/OpenEXR/openexr-c.c b/pxr/imaging/hio/OpenEXR/openexr-c.c
index 5c39b5adb..11464923d 100644
--- a/pxr/imaging/hio/OpenEXR/openexr-c.c
+++ b/pxr/imaging/hio/OpenEXR/openexr-c.c
@@ -657,7 +657,8 @@ static exr_result_t _nanoexr_rgba_decoding_initialize(
     for (int c = 0; c < decoder->channel_count; ++c) {
         int channelIndex = -1;
         decoder->channels[c].decode_to_ptr = NULL;
-        if (strIsComponent(layerName, decoder->channels[c].channel_name, "red")) {
+        if (strIsComponent(layerName, decoder->channels[c].channel_name, "red")
+            || strIsComponent(layerName, decoder->channels[c].channel_name, "y")) {
             rgba[0] = c;
             channelIndex = 0;
         }

image

So the only thing now missing is the expansion from "YA" to "YYYA" for the RG16F and RG32F images.

@meshula Would you be able to help with this?

Steps to Reproduce

  1. See #2800 for steps and files to use.

System Information (OS, Hardware)

Windows: heap corruption crash before the scene shows Linux: Corrupted images

Package Versions

USD v24.08 with MaterialX v1.38.10

Build Flags

jesschimein commented 2 months ago

Filed as internal issue #USD-10112

meshula commented 2 months ago

Do you have a usd file and images corresponding to your test that you could attach? Perhaps whatever is driving your screenshot?

seando-adsk commented 2 months ago

Yes sure. In MayaUsd we have a unit test for this. It is part of our testVP2RenderDelegateMaterialX test, specifically the DemoQuads test which is failing. The reference image is DemoQuads_render.png. The usd file it loads is DemoQuads.usda

Sean