Adding Custom Metadata to Rendered EXR
11511 16 2- Tim Crowson
- Member
- 249 posts
- Joined: Oct. 2014
- Offline
- mark
- Staff
- 2638 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
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).
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
As a note, this should work with any render delegate (not just Karma).
- Tim Crowson
- Member
- 249 posts
- Joined: Oct. 2014
- Offline
- No_ha
- Member
- 123 posts
- Joined: Sept. 2018
- Offline
- Tim Crowson
- Member
- 249 posts
- Joined: Oct. 2014
- Offline
- No_ha
- Member
- 123 posts
- Joined: Sept. 2018
- Offline
- No_ha
- Member
- 123 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
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
- Tim Crowson
- Member
- 249 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")
- Tim Crowson
Technical/CG Supervisor
Technical/CG Supervisor
- No_ha
- Member
- 123 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
- jsmack
- Member
- 8041 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.
- No_ha
- Member
- 123 posts
- Joined: Sept. 2018
- Offline
- mark
- Staff
- 2638 posts
- Joined: July 2005
- Offline
No_haFor the camera & world transforms, EXR expects them as single precision matrices. Maybe Fusion is having problems with double precision 4x4 transforms?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?)
- No_ha
- Member
- 123 posts
- Joined: Sept. 2018
- Offline
markYeah, 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.
For the camera & world transforms, EXR expects them as single precision matrices. Maybe Fusion is having problems with double precision 4x4 transforms?
- jparker
- Member
- 314 posts
- Joined:
- Offline
- mark
- Staff
- 2638 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.
- No_ha
- Member
- 123 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…
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
- jparker
- Member
- 314 posts
- Joined:
- Offline
To honor the title of this thread, I return to the general question:
Is there any way to add EXR metadata using Husk that doesn't involve editing the render product? For example I'd like to set an attribute that holds the unique ID of the farm job that executed the render, but that isn't something that gets baked into a USD normally.
Pre-frame script is probably the way to go?
Is there any way to add EXR metadata using Husk that doesn't involve editing the render product? For example I'd like to set an attribute that holds the unique ID of the farm job that executed the render, but that isn't something that gets baked into a USD normally.
Pre-frame script is probably the way to go?
Edited by jparker - Sept. 27, 2024 00:56:07
-
- Quick Links