Jump to content

PDG write json metadata


filipw

Recommended Posts

Hi, truing to render meta data when rendering my images. Something like bounds, colors, etc etc: Similar to:

{
    "bounds_max": [
        0.9976696968078613, 
        0.5660994648933411, 
        1.2734324932098389
    ], 
    "bounds_min": [
        -1.0025358200073242, 
        -1.335376501083374, 
        -0.9231263995170593
    ]
}

Currently I write meta data to a json-file using a python script inside my "obj/the_thing_to_render" network. It works fine but now want the same data to be output when driven from a PDG network. All in all, trying to find an easy way to write out some data for each variation I render. (i.e. renderer_image_wedge_045.exr should have file meta_data_wedge_045.json). Anyone have experience with this or have some nice pointers to have to do this in a clean way?

Link to comment
Share on other sites

Sadly I have not solved this yet, so any pointer would be very welcome. To make everything more clear:

In short, I render many variations of a scene using PDG and want to write a meta data file for each rendered version with some calculated data like bounding boxes for some objects etc. Basically things like

 
{
    "bounds_max": [
        0.9976696968078613, 
        0.5660994648933411, 
        1.2734324932098389
    ], 
    "bounds_min": [
        -1.0025358200073242, 
        -1.335376501083374, 
        -0.9231263995170593
    ],
	"cryptomatteName":"someNameFromAnPrimAttribString",
	"value_driven_by_pdg_wedge", : "1234"
}
This is dependent on wedges but the actual values are known first when items have been transformed etc so it is not possible to just write out the pdg level wedge values.
 
I have tried to write python script in PDG like so: (just printing here as a first step, json output is not the issue)

import hou
node = hou.node("/obj/box/OUT")
geo = node.geometry()
prims = geo.prims()

for p in prims:
	print p.attribValue("cryptomatteName")
	print p.attribValue("value_driven_by_pdg_wedge")
(Box is packed prim)
 
When I run the PDG network, I only get a single value for value_driven_by_pdg_wedge even when it actually varies and is used for the rendering.
That is, if I  translate the box using a @pdg_box_tx inside the box translate field ti renders as expected and if I also  write this to f@value_driven_by_pdg_wedge in a vex prim wrangle it look fine when inspecting and testing inside the obj context but once used through PDG, I only get a single value.
 
I guess I misunderstand something basic here but have not been able to solve it yet so any pointers are highly appreciated!
/F
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...