Solaris - EXR Matrix Metadata

   1933   4   2
User Avatar
Member
7 posts
Joined: 2月 2017
Offline
Could i get an example of how to write a camera transform into a rendered exr metadata?

I managed to get Float and String data working but not Matrix4 or List of floats. I dont get an error but the exr does not contain the metadata even if the prim attribute exists.

As a side question, how can i use namespaces in the metadata. For example how can i get this as a metadata key?
exr/rs/camera/transform
Colons are working but are not backwards compatible with non Solaris renders. Forward slash would be preferable.

Working:
metadata_attribute = renderproduct.GetPrim().CreateAttribute("driver:parameters:OpenEXR:aperture", Sdf.ValueTypeNames.Float)
metadata_attribute.Set(GFCamera.horizontalAperture)

Not working:
metadata_attribute = renderproduct.GetPrim().CreateAttribute("driver:parameters:OpenEXR:transform", Sdf.ValueTypeNames.Matrix4d)
metadata_attribute.Set(GFCamera.transform)

metadata_attribute = renderproduct.GetPrim().CreateAttribute("driver:parameters:OpenEXR:transform", Sdf.ValueTypeNames.FloatArray)
mat = GFCamera.transform
flatten_mat = list([element for tupl in mat for element in tupl])
metadata_attribute.Set(flatten_mat)
User Avatar
スタッフ
2592 posts
Joined: 7月 2005
Offline
This seems to work for me. With the attached .usd scene, I see the following when running iinfo -v output.exr
        ...
info:totalUTime (type double):= 7.324608
m4d (type m44d):= [
1, 0, 0, 0,
0, 2, 0, 0,
0, 0, 1, 0,
0.5, 0.2, -0.3, 1
]
pi (type float):= 3.1415
renderMemory (type double):= 1.3605591e+08
renderMemory_s (type string):= "129.75 MB"

Please submit a bug with a reproducible test case if need be.

P.S. Adding slashes to metadata keys doesn't create valid USD (unless I'm mistaken):
custom matrix4d driver:parameters:OpenEXR:exr/rs/camera/transform = (...
Edited by mark - 2022年3月16日 15:37:51

Attachments:
meta.usda (2.8 KB)

User Avatar
Member
7 posts
Joined: 2月 2017
Offline
Thank you for your help and attached scene.
I wasn't aware iinfo existed and it pretty neat. Turns out my m44d metadata worked.

I still have the issue where i need to read that metadata in nuke and unless the matrix is saved as a m44f, nuke does not seem to recognize it.
I see that you tried that in your usd scene and even gave an explanation and documentation. Sadly it does not export to either iinfo or nuke.

Conversely, karma was able to export matrices in m44f that is recognized by both iinfo and nuke.
Should i keep hope in a possible driver:parameters:OpenEXR export that works with nuke in the future?
I might have to make a feature request to either Redshift, nuke or USD?

Thank you!
User Avatar
Member
122 posts
Joined: 9月 2018
Offline
You can take a look at this HDA that I made [noahhaehnel.com]

It should be able to add all data to the exrs files. I also struggled with getting readable camera matrixes so I ended up converting them to P, R, S vectors which is easily usable in other applications.
The vex code isn’t pretty but it works.
User Avatar
Member
7 posts
Joined: 2月 2017
Offline
Thank you No_ah!

In Redshift's latest release they added their own exr output. Same as the OBJ level exr output which includes camera metadata.
While not render agnostic, it would meet my current needs.
Once i can get my hands on the new release i will test this new feature.

Another option would be to stringify the matrix. While not clean it would work.
My ideal solution would be for USD to add a m44f type. A man can dream.

Have a nice day.
  • Quick Links