prerender vs preframe scripts

   2261   4   3
User Avatar
Member
44 posts
Joined: May 2017
Offline
hi,

we have a python script that calulates the datawindowNDC based on attributes on the geometry.
It works as a prerender script but does not as a preframe script. Was curious to why that is.

prim = stage.GetPrimAtPath("/Render/rendersettings")
attr = prim.GetAttribute("dataWindowNDC")
attr.Set((0.1,0.7,0.6,0.8))

Using this as a test script. Is there a limitation in accessing rendersettings in preframe or is there something i could change to make it work?

thanks.
User Avatar
Staff
4200 posts
Joined: Sept. 2007
Offline
Try passing hou.frame() to the Get() and Set() functions.
I'm o.d.d.
User Avatar
Member
44 posts
Joined: May 2017
Offline
hi, thanks.

tried:

frame = hou.frame()
prim = stage.GetPrimAtPath("/Render/rendersettings")
attr = prim.GetAttribute("dataWindowNDC")
attr.Set((0.1,0.7,0.6,0.8), frame)

but getting the same results, working with prerender and not with preframe argument
User Avatar
Staff
503 posts
Joined: June 2020
Offline
In husk, the prerender script is executed before the Hydra delegate is created and data from the rendersettings is extracted, so any (or at least most - there might be limits) manipulation at this point should work.

After that, there's a general assumption that the render settings won't change. We do assorted optimisations to group/partition the render products based on shared/differing characteristics (for example, if three products have the same resolution, they can be rendered together and then the AOVs split up appropriately). Allowing for the potential to change this from frame-to-frame would be detrimental to performance.

It's perhaps worth noting that in USD you can't author dataWindowNDC in a time-sampled way either. The schema enforces that this is a uniform value.

If you want this value to be animated, you'll need to render frame-by-frame and use a prerender script.
User Avatar
Member
44 posts
Joined: May 2017
Offline
yes thats exactly what we are doing. running them over the farm with the task size limit of 1.
just wanted to make sure theres nothing we can do to lift that limit if we wanted to. Thanks a lot for the explanation.
  • Quick Links