Thread: Batch render in Nuke?

Reply to Thread
Results 1 to 14 of 14
  1. #1 Batch render in Nuke? 
    Join Date
    Jan 2004
    Location
    Los Angeles, CA.
    Posts
    148
    Hello All,

    I am curious as to someone's experience batch rendering a series of comps. I will need to render 62 versions of my comp and wanted to get a little advice as to what the best way of accomplishing this. should I group the comp and only leave my inputs for the footage being swapped, and do this for all 62 versions? I'm sure there is an easier way, I'm still fairly new to Nuke so forgive me if its staring me in the face.

    ~A
    Reply With Quote  

  2. #2  
    Join Date
    Sep 2004
    Posts
    221
    Let me see if I've got this straight:

    You have 1 comp you need to render 62 different times, with a different Read and a different Write for each comp? All the steps between the Read and the Write are the exact same?

    This sounds like something most quickly accomplished via a python script, there's no specific batch render capability in Nuke for this sort of situation.
    Reply With Quote  

  3. #3  
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    155
    in windows i use a batch file for this. edit your batch file like this and run it:

    D:\usr\local\Nuke5.0v2\nuke5.0.exe -x SCRIPT_A.NK

    D:\usr\local\Nuke5.0v2\nuke5.0.exe -x SCRIPT_B.NK

    D:\usr\local\Nuke5.0v2\nuke5.0.exe -x SCRIPT_C.NK

    pause

    it works nice for me if i have a bunch of scripts i want to render over night on my machine.


    you can also edit it like this:

    D:\usr\local\Nuke5.0v2\nuke5.0.exe -x %1
    pause


    and drag and drop your nuke scripts into the batch file and it will start rendering.


    greets
    Last edited by Andy; August 13th, 2008 at 11:41 AM.
    Reply With Quote  

  4. #4  
    Join Date
    Sep 2004
    Posts
    221
    Which works great if you've got x number of different scripts to run, but if he's looking to do 62 variations then he might want a python script that basically loops through by getting read 1, rendering write 1, then getting read 2, rendering write 2, and so on, just changing the read and write internals between passes.
    Reply With Quote  

  5. #5  
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    155
    Quote Originally Posted by michaelmovies View Post
    Which works great if you've got x number of different scripts to run, but if he's looking to do 62 variations then he might want a python script that basically loops through by getting read 1, rendering write 1, then getting read 2, rendering write 2, and so on, just changing the read and write internals between passes.

    oh sorry, i read 'series of comps' so i was assuming he meant various *.nk files.
    Reply With Quote  

  6. #6  
    Join Date
    Jan 2004
    Location
    Los Angeles, CA.
    Posts
    148
    Hey Gents,

    yes basically I will just swapping 2 inputs (A) & (B) elements in one comp which I need to do this 62 times. My trees are slightly complex so I wanted to only see the inputs that need to be swapped. Thats why I was suggesting grouping the comp leaving only inputs for files to be replaced then adding a write node at the end of the group with the proper version etc. The issue is and forgive me michael as I don't know ( but am learning based on your recommendation ) python. I guess this technique would allow me to just batch render the entire comp. Hope that all makes sense.

    ~A

    Thank you for that info as well Andy, thats a great method for a series of comps. I'm trying to stick to one comp with 62 versions however.
    Last edited by Ajax; August 13th, 2008 at 01:28 PM.
    Reply With Quote  

  7. #7  
    Join Date
    Sep 2004
    Posts
    221
    Yeah, there's a lot of ways to make this faster for yourself, although you've complicated it a bit by using two different inputs. Do all your A and B input files have consistently similar names? Or are all the A side in one directory, the B in another?

    Normally what I'd do is set it up so your Write node builds its name via an expression reference to your sources, or what have you, then all you really need to change in python is the input files.

    The easiest way to do that is if you've done some organizational work ahead of time and your input files all look something like A_side_##.%04d.tiff and B_side_##.%04d.tiff ... where ## equals which version you're doing (ie 01, 02, .. 62) ... that way it's pretty easy to write a script that will either a) iterate through your versions and render via the gui, or b) create 62 comps for you you can add to a batch file and render that way.
    Reply With Quote  

  8. #8  
    Join Date
    Jan 2004
    Location
    Los Angeles, CA.
    Posts
    148
    Quote Originally Posted by michaelmovies View Post
    Yeah, there's a lot of ways to make this faster for yourself, although you've complicated it a bit by using two different inputs. Do all your A and B input files have consistently similar names? Or are all the A side in one directory, the B in another?

    Normally what I'd do is set it up so your Write node builds its name via an expression reference to your sources, or what have you, then all you really need to change in python is the input files.

    The easiest way to do that is if you've done some organizational work ahead of time and your input files all look something like A_side_##.%04d.tiff and B_side_##.%04d.tiff ... where ## equals which version you're doing (ie 01, 02, .. 62) ... that way it's pretty easy to write a script that will either a) iterate through your versions and render via the gui, or b) create 62 comps for you you can add to a batch file and render that way.


    yes the naming conventions are similar shot_#_name_a.0000.exr, shot_#_name_b.0000.exr, and A is in one directory and B in the other.
    Reply With Quote  

  9. #9  
    Join Date
    Sep 2004
    Posts
    221
    Ok, try something like this:

    First, copy and paste the following to see what it is I'm doing:

    Code:
    set cut_paste_input [stack 0]
    version 5.0200
    push $cut_paste_input
    NoOp {
     name Controller
     selected true
     xpos -247
     ypos -89
     addUserKnob {20 User}
     addUserKnob {1 control}
     control 03
    }
    Read {
     inputs 0
     file "/Volumes/BIGFISH/WORK/DEMO/a_side_dir/shot_\[value Controller.control]_a_%04d.tga"
     format "1920 1080 0 0 1920 1080 1 HD_1920"
     first 0
     version 1
     name Read1
     label "\[value file]"
     note_font "Helvetica Bold"
     note_font_size {{curve x1 18}}
     selected true
     xpos -80
     ypos -215
    }
    NoOp {
     name ArbitraryNodes1
     selected true
     xpos -80
     ypos -49
    }
    Read {
     inputs 0
     file "/Volumes/BIGFISH/WORK/DEMO/b_side_dir/shot_\[value Controller.control]_b_%04d.tga"
     format "1920 1080 0 0 1920 1080 1 HD_1920"
     first 0
     name Read2
     label "\[value file]"
     note_font "Helvetica Bold"
     note_font_size 18
     selected true
     xpos 200
     ypos -124
    }
    NoOp {
     name ArbitraryNodes2
     selected true
     xpos 40
     ypos -9
    }
    Merge2 {
     inputs 2
     operation minus
     name Merge1
     selected true
     xpos -80
     ypos -9
    }
    NoOp {
     name ArbitraryNodes3
     selected true
     xpos -80
     ypos 31
    }
    Write {
     file "/Volumes/BIGFISH/WORK/DEMO/write_dir/shot_\[value Controller.control]_a_%04d.tga"
     views {main}
     file_type targa
     name Write1
     label "\[value file]"
     note_font "Helvetica Bold"
     note_font_size 18
     selected true
     xpos -80
     ypos 111
    }
    Notice that I'm using a NoOp with a user knob created (Controller.control) to act as the part of the name of each Read and Write that references the shot number. By using this Controller method I make the python coding much simpler.

    Now, replace the Read1 and Read2 files with your own A and B sides, making sure to change the shot number in each to [value Controller.control] ... change the directory and name for the write as well, again changing the shot number reference.

    Now run the following code via the Script Editor, with the appropriate first and last shot (in your case 1 and 62) in the obvious places:

    Code:
    first_shot = 1
    last_shot = 62
    for i in range(first_shot,last_shot+1):
        nuke.toNode('Controller').knob('control').setValue('%02d' % i)
        nuke.render('Write1')
    What this does is changes Controller.control to the first shot number (01), then renders that from start to finish (as already set in the root .nk settings), then moves on to the next one ... the expressions force your A and B inputs and your Write to reference the Controller.control, and everything works hunky dory and as fast as your machine can traverse each render.

    It's not exactly ideal, cause command line rendering would be quicker, but that's a bit more complicated, so you might want to just run the code and sit back and watch.

    Oh, btw, this assumes that all of your shots have exactly the right number of frames and exist in sequential order ... not going to work if you have shot 2, shot 3, then shot 5, or if shot 16 has only 23 frames while the others all have 230 ... in any of those cases it will fail on that error happening. Could write around that as well, but that's code for another day.
    Reply With Quote  

  10. #10  
    Join Date
    Jan 2004
    Location
    Los Angeles, CA.
    Posts
    148
    wow! Thank you for this. Once the renders are completed, I will give this method a go. Im wondering if this could be created as a gizmo allowing the Reads to be replaced as scripts instead of a shot? Then depending on how many scripts you have you can execute your last method with first_script =, last_script =. Thank you again for this really helpful information.

    Ah...I just noticed you stated that all sequences have to have similar start and end frame counts, so I guess it wouldn't work.
    Last edited by Ajax; August 13th, 2008 at 03:12 PM.
    Reply With Quote  

  11. #11  
    Join Date
    Sep 2004
    Posts
    221
    It can probably be done ... this method is very 'dumb' ... there's a lot of ways of making it more intelligent, but you'd want to very carefully define exactly what you were after before going to far down that path.
    Reply With Quote  

  12. #12  
    Join Date
    Jan 2004
    Location
    Los Angeles, CA.
    Posts
    148
    Hey Michael or Andy,

    If I did want to take the multiple script route, how would one accomplish this using a Mac? Since bat is obviously a windows exe.

    ~A
    Reply With Quote  

  13. #13  
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    155
    this thread should help you:

    http://www.vfxtalk.com/forum/automat...nuke+shell+mac

    greetings!

    andy
    Reply With Quote  

  14. #14  
    Join Date
    Jan 2004
    Location
    Los Angeles, CA.
    Posts
    148
    Perfect! Thank you.
    Reply With Quote  

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Sphere VFX New Nuke Training
    By Kyo in forum Your News
    Replies: 7
    Last Post: February 21st, 2009, 05:39 PM
  2. Nuke In-Depth 3D
    By Kyo in forum NUKE from The Foundry
    Replies: 25
    Last Post: August 6th, 2008, 04:28 PM
  3. Nuke 5.0v2 released
    By shot_grable in forum NUKE from The Foundry
    Replies: 1
    Last Post: May 31st, 2008, 06:03 AM
Bookmarks
Bookmarks
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts