comment 0

Render multiple OpenGL ROPs simultaneously

I use OpenGL ROP a lot, and I usually have more of them in the scene. They can often render simultaneously without significant decrease of the speed. So I did a script, which creates .py file (with a simple render script) for each selected ROP and also creates Windows .bat file, which launches hython for each created .py to run them simultaneously.


I will investigate the possibility to assign different GPUs to each hython (HOUDINI_OCL_DEVICENUMBER variable is not taken into account here).


# create .py script for each selected ROP, to render it
# create .bat file, which launches hython for each created .py to run them simultaneously
def batch_script_rop () :

    import os

    path_hip     = hou.expandString('$HIP')
    path_hipfile = hou.expandString('$HIPFILE')
    path_hython  = hou.expandString('$HB') + '/hython.exe'
    path_scripts = path_hip + '/scripts/'

    if not os.path.exists(path_scripts):

    script_bat = 'REM This batch file runs multiple .py scripts at once \n'

    for rop in hou.selectedNodes() :
        # .py script
        script_rop  = '# This .py script opens a file and renders single rop\n'
        script_rop += 'hou.hipFile.load("' + path_hipfile + '")\n'
        script_rop += 'node = hou.node("' + rop.path() + '")\n'
        script_rop += 'node.render(verbose=True,output_progress=True)'
        # write .py to disk
        path_py = path_scripts + + '.py'
        file_py = open( path_py, "w")

        # .bat script
        script_bat += 'start "Render: ' + + '" "'
        script_bat += path_hython + '" "'
        script_bat += path_py + '"\n'

    # write .bat to disk
    path_bat = path_hip + '/_render.bat'
    file_rop = open( path_bat, "w")

Leave a Reply