#=========================================================== # Script: multipassSetup.cmd # Author: Gavin Harrison # Abstract: This script wires multiple shader operators into # a file SOP for multipass rendering #=========================================================== # Change directory into the required geo operator # 'geo1' should be replaced with the relevant name opcf /obj/geo1/ # Set counter set i = 1 # Add a merge SOP opadd -n merge output # Get the contents of the geo operator foreach name(`execute("opls")`) # Get the type set type = `execute("optype -t $name")` # Add shaders if the type is a file SOP if ($type == file) # Add a reverse SOP and wire it to the file SOP opadd -n reverse reverse$i opwire $name -0 reverse$i # Add a texture shader and wire it to the reverse SOP opadd -n shop texture$i opwire reverse$i -0 texture$i # Add a diffuse shader, set its surface parameter and wire it to the reverse SOP opadd -n shop diffuse$i opparm diffuse$i quicksurface ( /shop/diffuse ) opwire reverse$i -0 diffuse$i # Add a specular shader, set its surface parameter and wire it to the reverse SOP opadd -n shop specular$i opparm specular$i quicksurface ( /shop/specular ) opwire reverse$i -0 specular$i # Add a shadow shader, set its surface parameter and wire it to the reverse SOP opadd -n shop shadow$i opparm shadow$i quicksurface ( /shop/shadow ) opwire reverse$i -0 shadow$i # Wire all the shaders into a switch opadd -n switch switch$i opwire texture$i -0 switch$i opwire diffuse$i -1 switch$i opwire specular$i -2 switch$i opwire shadow$i -3 switch$i # Set counter set j = `$i - 1` # Wire the switches into the merge SOP opwire switch$i -$j output # Set counter set i = `$i + 1` endif end # Set the display and render flag for the merge SOP opset -d on -r on output