Rush Logo Rush 3rd Party Render Scripts
V 103.07b 05/11/16
(C) Copyright 2008, 2016 Seriss Corporation. All rights reserved.
(C) Copyright 1995,2000 Greg Ercolano. All rights reserved.

Strikeout text indicates features not yet implemented





   Houdini Submit/Render Script  

   BMRT Submit/Render Script  
    These are simple examples of combination submit/render scripts; there's a Perl version, and a DOS batch version. Use either one; the perl version is more portable.

    To keep the examples simple, there's no frame batching or any fancy stuff.

    Be sure to change the red text to names relevant on your system.

      PERL: BMRT Submit / Render
      #!/usr/bin/perl
      
      # SIMPLE BMRT PERL SUBMIT EXAMPLE
      #     Shows the easiest way to make a self contained
      #     submit/render script. This script should work on Windows or Unix.
      #
      
      $|=1;
      umask(0);
      
      # NEED ABSOULUTE PATH TO SELF
      my $self = $0;
      if ( $self !~ m%^[/\\]% && $self !~ m%^[a-zA-Z]:% )
          { my $pwd=`pwd`; chomp($pwd); $self = "$pwd/$0"; }
      
      # ENVIRONMENT SETTINGS
      $G::iswindows  = ( defined($ENV{OS}) && $ENV{OS} eq "Windows_NT" ) ? 1 : 0;
      if ( $G::iswindows )
      {
          # WINDOWS ENVIRONMENT SETTINGS -- CHANGE AS NEEDED
          $ENV{BMRTTREE} = "c:/BMRT";
          $ENV{PATH}     = "$ENV{PATH};$ENV{BMRTTREE}/bin"
      }
      else
      {
          # UNIX ENVIRONMENT SETTINGS -- CHANGE AS NEEDED
          $ENV{BMRTTREE} = "/usr/local/BMRT";
          $ENV{PATH}     = "$ENV{PATH}:$ENV{BMRTTREE}/bin"
      }
      
      # MAIN
      {
          if ( $#ARGV < 1 )
          {
      	print STDERR "USAGE\n".
      		     "    $0 ribpath framerange\n\n".
      		     "EXAMPLE\n".
      		     "    $self //tahoe/net/tmp/ribs/foo.%04d.rib 1-50\n\n";
      	exit(1);
          }
      
          # INVOKED AS A RENDER SCRIPT?
          #    Then rush is calling us to render a frame.
          #    Create BMRT command line and run it, checking for errors.
          #
          if ( $ARGV[0] eq "-render" )
          {
      	shift(@ARGV);
      	my ($ribpath) = @ARGV;
      	my $ribfilename = sprintf($ribpath, $ENV{RUSH_FRAME});
      
      	my $cmd = "rendrib $ribfilename";
      
      	print "RIBFILE=$ribfilename\n".
                    "  FRAME=$ENV{RUSH_PADFRAME}\n".
      	      "\n".
                    "Executing: $cmd\n";
      
      	my $exitcode = system($cmd) >> 8;
      
      	if ( $exitcode ) 
      	{
      	    print STDERR "BMRT FAILED: EXITCODE=$exitcode\n";
      	    exit(1);	# "Fail"
      	}
      
      	print STDERR "BMRT SUCCEEDED: EXITCODE=$exitcode\n"; 
      	exit(0);	# "Done"
          }
          else
          {
      	# INVOKED AS A SUBMIT SCRIPT?
      	#     Get args from command line, and submit to rush
      	#
      	my ($ribpath, $frames) = @ARGV;
      	my $ribdir = $ribpath; $ribdir =~ s%[/\\][^\\/]*$%%;	# "/foo/bar.%04d.rib" -> "/foo"
      
      	unless ( open(SUBMIT, "|rush -submit") )
      	    { print STDERR "$0: 'rush -submit': $!\n"; exit(1); }
      	print SUBMIT <<"EOF";
      	    title      BMRT
      	    ram        10
      	    frames     $frames
      	    logdir     $ribdir/%s
      	    command    perl $self -render $ribpath
      	    cpus       +any=10\@100
      EOF
      	close(SUBMIT);
      	if ( $? >> 8 ) 
      	    { print STDERR "-- submit failed --\n"; exit(1); }
      	exit(0);
          }
          #NOTREACHED
      }
              

    Here's a similar script written as a DOS batch script. Because DOS is very limited in its string manipulation ability (it practically has none), this script is not as featured as the Perl version.

    Be sure to change the red text to names relevant on your system.

      DOS: BMRT Submit / Render
      @echo off
      
      REM ###
      REM ### DOS BATCH -- BMRT SUBMIT/RENDER SCRIPT
      REM ###              Works on Windows *only*
      REM ###
      
      REM ### USER SHOULD CHANGE THESE!!
      REM ###    Use UNC style absolute pathnames with front "/" slashes.
      REM ###
      set BMRTTREE=c:/bmrt
      set   RIBDIR=//tahoe/net/tmp/ribs
      set   LOGDIR=//tahoe/net/tmp/ribs/logs
      set     CPUS=+any=10@100
      
      if "%1"=="-render" goto RENDER
      
      REM ######################
      REM ### SUBMIT SECTION ###
      REM ######################
      :SUBMIT
      set TMPDIR=c:\temp
      set SUBMIT=c:\temp\$$$.bat
      set SELF=%0
      set SELF=%SELF:\=/%
      (
      echo    title      TEST
      echo    ram        1
      echo    frames     1-20
      echo    logdir     %LOGDIR%
      echo    command    cmd /c %SELF% -render
      echo    cpus       %CPUS%
      ) | rush -submit > %SUBMIT%
      if %ERRORLEVEL% GEQ 1 goto DONE
      call %SUBMIT%
      del %SUBMIT%
      echo RUSH_JOBID is %RUSH_JOBID%
      start /b irush %RUSH_JOBID% -button Frames
      goto DONE
      
      
      REM ######################
      REM ### RENDER SECTION ###
      REM ######################
      :RENDER
      echo RIBDIR=%RIBDIR%
      @echo on
      rendrib %RIBDIR%/foo.%RUSH_PADFRAME%.rib
      @set ERR=%ERRORLEVEL%
      @echo off
      if %ERR% GTR 0   goto FAIL
      echo --- BMRT SUCCEEDS: EXITCODE=%ERR%
      exit 0
      
      :FAIL
      echo --- BMRT FAILED: EXITCODE=%ERR%
      exit 1
      
      :DONE
              

   Maya Submit / Render Script  
    These are simple examples of combination submit/render scripts; there's a Perl version, and a DOS batch version. Use either one; the perl version is more portable.

    To keep the examples simple, there's no frame batching or any fancy stuff.

    Be sure to change the red text to names relevant on your system.

      PERL: Maya Submit / Render
      #!/usr/bin/perl
      
      # SIMPLE MAYA PERL SUBMIT EXAMPLE
      #     Shows the easiest way to make a self contained
      #     submit/render script. This script should work on Windows or Unix.
      #
      
      $|=1;
      umask(0);
      
      # NEED ABSOULUTE PATH TO SELF
      my $self = $0;
      if ( $self !~ m%^[/\\]% && $self !~ m%^[a-zA-Z]:% )
          { my $pwd=`pwd`; chomp($pwd); $self = "$pwd/$0"; }
      
      # MAIN
      {
          if ( $#ARGV < 1 )
          {
      	print STDERR "USAGE\n".
      		     "    $0 scenefile framerange [imagedir]\n\n".
      		     "EXAMPLE\n".
      		     "    $self //tahoe/net/tmp/scenes/foo.ma 1-20,2\n\n";
      	exit(1);
          }
      
          # INVOKED AS A RENDER SCRIPT?
          #    Then rush is calling us to render a frame.
          #    Create maya command line and run it, checking for errors.
          #
          if ( $ARGV[0] eq "-render" )
          {
      	shift(@ARGV);
      	my ($scenefile,$imagedir) = @ARGV;
      	$imagedir = ( $imagedir eq "-" ) ? "" : "-rd $imagedir";
      
      	my $cmd = "render -s $ENV{RUSH_FRAME} -e $ENV{RUSH_FRAME} $imagedir $scenefile";
      
      	print "   SCENE=$scenefile\n".
                    "IMAGEDIR=$scenefile\n".
                    "   FRAME=$ENV{RUSH_PADFRAME}\n".
      	      "\n".
                    "Executing: $cmd\n";
      
      	my $exitcode = system($cmd) >> 8;
      
      	if ( $exitcode ) 
      	{
      	    print STDERR "MAYA FAILED: EXITCODE=$exitcode\n";
      	    exit(1);	# "Fail"
      	}
      
      	print STDERR "MAYA SUCCEEDED: EXITCODE=$exitcode\n"; 
      	exit(0);	# "Done"
          }
          else
          {
      	# INVOKED AS A SUBMIT SCRIPT?
      	#     Get args from command line, and submit to rush
      	#
      	my ($scenefile,$frames,$imagedir) = @ARGV;
      	if ( $imagedir eq "" ) 
      	    { $imagedir = "-"; }
      
      	# MAKE SURE SCENEFILE AND LOGDIR EXISTS
              if ( ! -e "$scenefile" )
                  { print "$scenefile: does not exist\n"; exit(1); }
              if ( ! -d "$scenefile.log" )
              {
                  unless ( mkdir("$scenefile.log", 0777) )
                      { print STDERR "mkdir '$scenefile.log': $!\n"; exit(1); }
              }
      
      	# SUBMIT THE JOB
      	#    Pipe the submit commands into 'rush -submit'.
      	#
      	unless ( open(SUBMIT, "|rush -submit") )
      	    { print STDERR "$0: 'rush -submit': $!\n"; exit(1); }
      	print SUBMIT <<"EOF";
      	    title      MAYA
      	    ram        10
      	    frames     $frames
      	    logdir     $scenefile.log/%s
      	    command    perl $self -render $scenefile $imagedir
      	    cpus       +any=10\@100
      EOF
      	# CHECK IF SUBMIT SUCCEEDED
      	#    If failed, exit non-zero, error message on stderr.
      	#
      	close(SUBMIT);
      	if ( $? >> 8 ) 
      	    { print STDERR "-- submit failed --\n"; exit(1); }
      	exit(0);
          }
          #NOTREACHED
      }
              

    Here's a similar script written as a DOS batch script. Because DOS is very limited in its string manipulation ability (it practically has none), this script is not as featured as the Perl version.

    Be sure to change the red text to names relevant on your system.

      DOS: Maya Submit / Render
      @echo off
      
      REM ###
      REM ### DOS BATCH -- MAYA SUBMIT/RENDER SCRIPT
      REM ###              Works on Windows *only*
      REM ###
      
      REM ### USER SHOULD CHANGE THESE!!
      REM ###    Use UNC style absolute pathnames with front "/" slashes.
      REM ###
      set   MAYASCENE=//tahoe/net/tmp/scenes/foo.mb
      set MAYAPROJECT=//tahoe/net/tmp
      set  MAYALOGDIR=//tahoe/net/tmp/scenes/foo.mb.log
      set    MAYACPUS=+any=10@100
      
      
      if "%1"=="-render" goto RENDER
      
      REM ######################
      REM ### SUBMIT SECTION ###
      REM ######################
      :SUBMIT
      set TMPDIR=c:\temp
      set SUBMIT=c:\temp\$$$.bat
      set SELF=%0
      set SELF=%SELF:\=/%
      (
      echo    title      TEST
      echo    ram        1
      echo    frames     1-20
      echo    logdir     %MAYALOGDIR%
      echo    command    cmd /c %SELF% -render
      echo    cpus       %MAYACPUS%
      ) | rush -submit > %SUBMIT%
      if %ERRORLEVEL% GEQ 1 goto DONE
      call %SUBMIT%
      del %SUBMIT%
      echo RUSH_JOBID is %RUSH_JOBID%
      start /b irush
      goto DONE
      
      
      REM ######################
      REM ### RENDER SECTION ###
      REM ######################
      :RENDER
      echo MAYA SCENE=%MAYASCENE%
      echo MAYA PROJECT=%MAYAPROJECT%
      @echo on
      @echo EXECUTING MAYA:
      render -verbose 1 -proj %MAYAPROJECT% -s %RUSH_FRAME% -e %RUSH_FRAME% -b 1 %MAYASCENE%
      @set ERR=%ERRORLEVEL%
      @echo off
      if %ERR% EQU 128 goto REQUEUE128
      if %ERR% GTR 0   goto FAIL
      echo --- MAYA SUCCEEDS: EXITCODE=%ERR%
      exit 0
      
      :FAIL
      echo --- MAYA FAILED: EXITCODE=%ERR%
      exit 1
      
      
      :REQUEUE128
      echo --- MAYA INDICATES LICENSE ERROR (EXIT 128)
      echo --- ADDING THIS MACHINE AS NEVERHOST AND REQUEING
      rush -fu an %RUSH_HOSTNAME%
      exit 2
      
      :DONE
              

   Renderman Submit/Render Script  
    These are simple examples of combination submit/render scripts; there's a Perl version, and a DOS batch version. Use either one; the perl version is more portable.

    To keep the examples simple, there's no frame batching or any fancy stuff.

    Change the red text to names relevant on your system.

      PERL: Renderman Submit / Render
      #!/usr/bin/perl
      
      # SIMPLE RENDERMAN PERL SUBMIT EXAMPLE
      #     Shows the easiest way to make a self contained
      #     submit/render script. This script should work on Windows or Unix.
      #
      
      $|=1;
      umask(0);
      
      # NEED ABSOULUTE PATH TO SELF
      my $self = $0;
      if ( $self !~ m%^[/\\]% && $self !~ m%^[a-zA-Z]:% )
          { my $pwd=`pwd`; chomp($pwd); $self = "$pwd/$0"; }
      
      # ENVIRONMENT SETTINGS
      $G::iswindows  = ( defined($ENV{OS}) && $ENV{OS} eq "Windows_NT" ) ? 1 : 0;
      if ( $G::iswindows )
      {
          # WINDOWS ENVIRONMENT SETTINGS -- CHANGE AS NEEDED
          $ENV{RMANTREE} = "c:/prman";
          $ENV{PATH}     = "$ENV{PATH};$ENV{RMANTREE}/bin"
      }
      else
      {
          # UNIX ENVIRONMENT SETTINGS -- CHANGE AS NEEDED
          $ENV{RMANTREE} = "/usr/local/prman";
          $ENV{PATH}     = "$ENV{PATH}:$ENV{RMANTREE}/bin"
      }
      
      # MAIN
      {
          if ( $#ARGV < 1 )
          {
      	print STDERR "USAGE\n".
      		     "    $0 ribpath framerange\n\n".
      		     "EXAMPLE\n".
      		     "    $self //tahoe/net/tmp/ribs/foo.%04d.rib 1-50\n\n";
      	exit(1);
          }
      
          # INVOKED AS A RENDER SCRIPT?
          #    Then rush is calling us to render a frame.
          #    Create Renderman command line and run it, checking for errors.
          #
          if ( $ARGV[0] eq "-render" )
          {
      	shift(@ARGV);
      	my ($ribpath) = @ARGV;
      	my $ribfilename = sprintf($ribpath, $ENV{RUSH_FRAME});
      
      	my $cmd = "rendrib $ribfilename";
      
      	print "RIBFILE=$ribfilename\n".
                    "  FRAME=$ENV{RUSH_PADFRAME}\n".
      	      "\n".
                    "Executing: $cmd\n";
      
      	my $exitcode = system($cmd) >> 8;
      
      	if ( $exitcode ) 
      	{
      	    print STDERR "RENDERMAN FAILED: EXITCODE=$exitcode\n";
      	    exit(1);	# "Fail"
      	}
      
      	print STDERR "RENDERMAN SUCCEEDED: EXITCODE=$exitcode\n"; 
      	exit(0);	# "Done"
          }
          else
          {
      	# INVOKED AS A SUBMIT SCRIPT?
      	#     Get args from command line, and submit to rush
      	#
      	my ($ribpath, $frames) = @ARGV;
      	my $ribdir = $ribpath; $ribdir =~ s%[/\\][^\\/]*$%%;	# "/foo/bar.%04d.rib" -> "/foo"
      
      	unless ( open(SUBMIT, "|rush -submit") )
      	    { print STDERR "$0: 'rush -submit': $!\n"; exit(1); }
      	print SUBMIT <<"EOF";
      	    title      RENDERMAN
      	    ram        10
      	    frames     $frames
      	    logdir     $ribdir/%s
      	    command    perl $self -render $ribpath
      	    cpus       +any=10\@100
      EOF
      	close(SUBMIT);
      	if ( $? >> 8 ) 
      	    { print STDERR "-- submit failed --\n"; exit(1); }
      	exit(0);
          }
          #NOTREACHED
      }
              

    Here's a similar script written as a DOS batch script. Because DOS is very limited in its string manipulation ability (it practically has none), this script is not as featured as the Perl version.

    Change the red text to names relevant on your system.

      DOS: Renderman Submit / Render
      @echo off
      
      REM ###
      REM ### DOS BATCH -- RENDERMAN SUBMIT/RENDER SCRIPT
      REM ###              Works on Windows *only*
      REM ###
      
      REM ### USER SHOULD CHANGE THESE!!
      REM ###    Use UNC style absolute pathnames with front "/" slashes.
      REM ###
      set RMANTREE=c:/bmrt
      set   RIBDIR=//tahoe/net/tmp/ribs
      set   LOGDIR=//tahoe/net/tmp/ribs/logs
      set     CPUS=+any=10@100
      
      if "%1"=="-render" goto RENDER
      
      REM ######################
      REM ### SUBMIT SECTION ###
      REM ######################
      :SUBMIT
      set TMPDIR=c:\temp
      set SUBMIT=c:\temp\$$$.bat
      set SELF=%0
      set SELF=%SELF:\=/%
      (
      echo    title      TEST
      echo    ram        1
      echo    frames     1-20
      echo    logdir     %LOGDIR%
      echo    command    cmd /c %SELF% -render
      echo    cpus       %CPUS%
      ) | rush -submit > %SUBMIT%
      if %ERRORLEVEL% GEQ 1 goto DONE
      call %SUBMIT%
      del %SUBMIT%
      echo RUSH_JOBID is %RUSH_JOBID%
      start /b irush %RUSH_JOBID% -button Frames
      goto DONE
      
      
      REM ######################
      REM ### RENDER SECTION ###
      REM ######################
      :RENDER
      echo RIBDIR=%RIBDIR%
      @echo on
      prman %RIBDIR%/foo.%RUSH_PADFRAME%.rib
      @set ERR=%ERRORLEVEL%
      @echo off
      if %ERR% GTR 0   goto FAIL
      echo --- RENDERMAN SUCCEEDS: EXITCODE=%ERR%
      exit 0
      
      :FAIL
      echo --- RENDERMAN FAILED: EXITCODE=%ERR%
      exit 1
      
      :DONE
              

   Softimage Submit/Render Script