Adding Custom Metadata to Rendered EXR

   607   15   2
User Avatar
Member
34 posts
Joined: Oct. 2014
Offline
How would I go about adding custom metadata to the EXRs I am rendering? I tried adding extra metadata parms patterned after the ones on the Render Product LOP but that didn't seem to have any effect.
User Avatar
Staff
2288 posts
Joined: July 2005
Offline
Not sure exactly what version of Houdini this is supported in, but I don't think this fix was backported to H18.0.

From the upcoming documentation…

When saving an image, husk will process all the attributes on the render product. It looks for settings that begin with driver:parameters: and will pass that data down to the image as a piece of metadata. For example
    custom string driver:parameters:OpenEXR:test_string = "Hello world"          
custom float driver:parameters:OpenEXR:pi = 3.1415
will add metadata to OpenEXR files named “test_string” and “pi” with the types and values you might expect. Note that OpenEXR doesn't necessarily support all the types of data allowed in USD.

As a note, this should work with any render delegate (not just Karma).
User Avatar
Member
34 posts
Joined: Oct. 2014
Offline
I was missing the “OpenEXR” bit. That was it. Thanks, Mark.
User Avatar
Member
27 posts
Joined: Sept. 2018
Offline
Sorry to revive this thread, but Tim did you get it to work in Houdini 18.0?
I've been trying the same but can't even see Metadata added in the “Metadata”-Tab of the Karma LOP (for example Artist name).
User Avatar
Member
34 posts
Joined: Oct. 2014
Offline
No, this doesn't seem to be supported in H18, sorry.
User Avatar
Member
27 posts
Joined: Sept. 2018
Offline
Thanks for confirming and saving me from spending more time trying to get it working!
Edited by No_ha - Oct. 10, 2020 12:07:15
User Avatar
Member
27 posts
Joined: Sept. 2018
Offline
Just to confirm. This does work in H18.5.

In case somebody is unfamiliar with how it works, this is how you add the metadata:
https://noahhaehnel.com/blog/custom-metadata-in-solaris/ [noahhaehnel.com]

I know I struggled back when I started with Houdini and wanted to do the same for Mantra
User Avatar
Member
34 posts
Joined: Oct. 2014
Offline
You can also do this with a Python LOP.

from pxr import Sdf
stage = hou.pwd().editableStage()

#get your render product primitive
renderproduct = stage.GetPrimAtPath("<path to your render product>")

# create the attribute
metadata_attribute = renderproduct.CreateAttribute("driver:parameters:OpenEXR:myData", Sdf.ValueTypeNames.String)

# set a value on this attribute
metadata_attribute.Set("Anything you like")
User Avatar
Member
27 posts
Joined: Sept. 2018
Offline
mark
Note that OpenEXR doesn't necessarily support all the types of data allowed in USD.

Hey Mark, in case you're still reading this, do you know how husk can save the worldToCamera matrix to EXR as a table? I have been building a tool/HDA that makes it easy to add USD Attributes to EXR Metadata. I am able to write all attributes to it, but I need to convert matrix and array data somehow because some software won't recognize it. Converting it to a string beforehand will make it readable but not individually accessible. The worldToCamera metadata on the other hand works like a normal table with every value being accessible on its own and it's readable in other software (writing a matrix4 straight into the EXR works for DJV player for example, but Fusion says “unsupported datatype”). Basically, I would need to mimic the worldToCamera metadata.
Currently, I made the tool in an Attribute Wrangle LOP, let me know if I should send you the file. (Or maybe it isn't possible at all in a Wrangle or Python LOP?)

In DJV (cam is the custom matrix):


In Fusion (cam):



In Fusion (cameraToWorld):


Edit: Now with working images
Edited by No_ha - Nov. 9, 2020 10:49:01

Attachments:
2020-11-09 16_42_34-djv.jpg (47.2 KB)
image2.jpg (3.9 KB)
image3.jpg (12.1 KB)

User Avatar
Member
3955 posts
Joined: Sept. 2011
Offline
No_ha
Hey Mark, in case you're still reading this, do you know how husk can save the worldToCamera matrix to EXR as a table? I have been building a tool/HDA that makes it easy to add USD Attributes to EXR Metadata.

Is it working differently than mantra? I thought it saved the camera matrix in exr metadata too.
User Avatar
Member
27 posts
Joined: Sept. 2018
Offline
I couldn't say I never tried it with Mantra. I'm just confused because cameraToWorld works fine but my custom matrix can't be read for some reason…
User Avatar
Staff
2288 posts
Joined: July 2005
Offline
No_ha
mark
Note that OpenEXR doesn't necessarily support all the types of data allowed in USD.

Hey Mark, in case you're still reading this, do you know how husk can save the worldToCamera matrix to EXR as a table? I have been building a tool/HDA that makes it easy to add USD Attributes to EXR Metadata. I am able to write all attributes to it, but I need to convert matrix and array data somehow because some software won't recognize it. Converting it to a string beforehand will make it readable but not individually accessible. The worldToCamera metadata on the other hand works like a normal table with every value being accessible on its own and it's readable in other software (writing a matrix4 straight into the EXR works for DJV player for example, but Fusion says “unsupported datatype”). Basically, I would need to mimic the worldToCamera metadata.
Currently, I made the tool in an Attribute Wrangle LOP, let me know if I should send you the file. (Or maybe it isn't possible at all in a Wrangle or Python LOP?)
For the camera & world transforms, EXR expects them as single precision matrices. Maybe Fusion is having problems with double precision 4x4 transforms?
User Avatar
Member
27 posts
Joined: Sept. 2018
Offline
mark
For the camera & world transforms, EXR expects them as single precision matrices. Maybe Fusion is having problems with double precision 4x4 transforms?
Yeah, that seems to be the issue, thank you! I haven't been able to force a matrix3f type yet but this explains why most other attributes work without issues.
User Avatar
Member
105 posts
Joined:
Offline

mark
For the camera & world transforms, EXR expects them as single precision matrices. Maybe Fusion is having problems with double precision 4x4 transforms?

I never knew that… is that part of the official EXR spec?

Cheers,
Jon
User Avatar
Staff
2288 posts
Joined: July 2005
Offline
jparker
I never knew that… is that part of the official EXR spec?

Cheers,
Jon

I'm not sure it's part of the standard. I think you can store any metadata you want in an EXR. However, it's quite possible some software may not look for double precision versions. For example, I think OpenImageIO might only accept a single precision matrix in its list of well known metadata. So, it was a bit of a shot in the dark about Fusion.
User Avatar
Member
27 posts
Joined: Sept. 2018
Offline
Thank you Mark for still being in this thread even when we ask about third party software issues.
Do you by any chance know how to get it into to single precision matrix? I thought VEX would automatically convert to single precision if you do any kind of operation on double precision values, right?
Whatever I'm doing so far, I can't get it to write a matrix4f…
Edited by No_ha - Nov. 11, 2020 01:58:44
  • Quick Links