parse-exr-header icon indicating copy to clipboard operation
parse-exr-header copied to clipboard

Added support for v3d and m44d

Open Ambrosiussen opened this issue 3 years ago • 4 comments

Ambrosiussen avatar Dec 01 '21 12:12 Ambrosiussen

I just tried this patch and I got an error for m44d:

attribute_values = struct.unpack('d' * 32, exr_file.read(4 * 32))
                                       ^ this should still be 16 for a 4x4 matrix

Moreover, an EXR created by the latest Karma renderer (Houdini) failed due to an attribute of type "v2d" which I guess is just like v2i and v2f but twice the size?

tiltX avatar Dec 18 '21 15:12 tiltX

hi @Ambrosiussen ! sorry for the delay and thanks for the MR - I missed the notification for this one but lgtm! Do you mind linking the information that you used to write the implementation for the m44d ? @tiltX: I haven't checked the white paper, but I suppose that v2d is a vector of doubles ?

Thanks all!

vvzen avatar Dec 26 '21 18:12 vvzen

@tiltX: I haven't checked the white paper, but I suppose that v2d is a vector of doubles ?

Yes, it works if I add a case for v2d by duplicating the code for v2f with this adjustment for struct.unpack()

            elif attribute_type == b'v2d':
                vector_2d_value = struct.unpack('dd', exr_file.read(8 * 2))

Unfortunately I don't know what the proper workflow would be to add to @Ambrosiussen 's pull request. I haven't tried reading any of the test cases in the openexrs-images repository to see if they have such a v2d attribute. But both this addition and the fix for m44d above allowed me to parse EXR files written by the latest production build of Houdini's Karma renderer.

tiltX avatar Dec 27 '21 09:12 tiltX

Hey @tiltX ! the cleanest workflow would be to have @Ambrosiussen update his PR so that I can merge all changes in one place. However - if you'd like to contribute, I'd really appreciate if you could make a PR that adds a few of these EXRs generated from Houdini that have these metadata (or you could just send them via email if that's easier for you). I could add them to the test image suite that is used when running the tests. Thanks and happy holidays!

vvzen avatar Dec 27 '21 11:12 vvzen