Search - User list
Full Version: [SOLVED] Update issues with hscript/hbatch and python
Root » Technical Discussion » [SOLVED] Update issues with hscript/hbatch and python
nasaKel
I'm noticing some update/evaluation issues with Houdini objects that are driven by python nodes when I generate rib using hscript/hbatch .

We use code that sets user scene parameters (times/dates) that are then used to drive scene geometry and shaders.
For example, we use python code to build a tx_file string parameter on a null object, which is then referenced in the shader.
Or we will rotate a sphere (planet) based on a time parameter.
This setup works when I scrub in the scene and when I batch render locally from the Houdini GUI (Using Renderman).
However, using hscript/hbatch calls to generate rib results in rib that does not update properly.

I've created a simple test scene to show what's happening.
The scene includes a null object (DM), which contains a python node.
The python code sets a user parameter on DM (myVal).
myVal from the DM is then set as a channel reference for the rotation of the box.
ch("../DM/myVal")

If I scrub the scene, the box moves. If I render a frame range (in the GUI) to .exrs, the box moves. If I select 'write rib' and render a frame range from the GUI, the rib for each frame is updating as expected (box transform is changing).

If I use the following commands, the resulting rib does not change between frames. It seems the position is stuck at the frame the scene was saved at.
hscript -c "rman_start -n /out/ris1 -c /obj/cam1 -t 0.291666666667 -b -r; quit" /svs/projects/dust_reduction/houdini_kel/python_issue.hip
hscript -c "rman_start -n /out/ris1 -c /obj/cam1 -t 0.041666666667 -b -r; quit" /svs/projects/dust_reduction/houdini_kel/python_issue.hip

The two resulting rib files have matching transforms for the box object.

We see the same behavior when we use hbatch in place of hscript.
I've checked with the Pixar folks and they tell me that Mantra is behaving the same way.

If anything in the scene is keyframed, those particular parameters will update. The issue seems to be using a parameter that is calculated and set by python each frame.

Is there any way with hscript/hbatch to force the entire scene to update prior to rib generation?

Or is there any way to force Houdini to update a particular HDA that is used to calculate and set parameters every frame?
One suggestion I've seen is to add f= hou.frame() to any python nodes. Again, this works when scrubbing in the scene, but does not work when I load the scene using hscript and attempt to render a particular frame (Which is how we are trying to set up our render farm)

Thanks,
Kel
nasaKel
Adding our solution in case anyone else ends up on this thread:

The fix was to use render() instead of rman_start()
rman_start() skips the Houdini render() functionality, including the pre-render/pre-frame scripts on the ROP that we were using to force cook prior to render.

hbatch -c "render -f 10 10 -V /out/ris1;quit" "/svs/projects/dust_reduction/houdini_kel/python_issue.hip"

This works well, provided we include a force cook in the pre-render script on the ROP when rendering single frames (We break our rib gen jobs into single frames before distributing to our farm).
for node in (hou.node("/obj/").allSubChildren()): node.cook(force=True)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB