Maxscript deadline submit script tutorial

Submitting jobs to deadline is not very difficult, but it can be automated with maxscript. It’s always a good thing to automate when you can. And it’s a good thing to submit stuff to a render-queue to free your own computer from the workload. So why not submit automated maxscript-jobs to deadline instead of renderjobs? Well, you can do that relatively easily with deadline. Consider this if you need to process a large amount of meshes with maxscript, or do some kind of image-manipulation with maxscript. Or do this when you have some kind of scripted renderpipeline. Whenever you’re not just rendering frames, the maxscript deadline job may come in handy.

Overview

Bobo has explained the bulk of this procedure on the site of thinkbox software. His example needs a few adjustments to make it work for scripted jobs. His example submits the current scene to deadline. There it will render the specified frames. We need to send a job to deadline where it will execute a script. This can be done on a specific scene (the submitted scene) or totally independent from a scene. In my experience you always need to send some kind of a scene to deadline, so I’ve been using an empty dummy scene to serve as the messenger for my scripted jobs.

There’s a so-called script template that ships with deadline. This template contains all code needed to create a functioning job in deadline. All you need to do is insert your own code and send it off to deadline. We’ll use this template in two ways: first we manually insert our script in the template. Secondly we’ll automate that and create a script to create the template for us and send it to deadline by maxscript. Bear with me here…

The example I’m using to demonstrate this is a simple scene: a teapot. We’ll render it ten times by script with random colors. So we’ll render the first frame of the demo-scene ten times, each time giving the teapot a different material.

Normal deadline-job submission

Usually you submit a job from 3dsMax through the deadline-submitter. In such a job some frames are rendered as specified in the render-menu

Automated deadline-job submission

In his article Bobo describes how to create your own submitter-script. This is good practice in projects where you have to repeatedly submit large amounts of files. Creating your own submitter will help bring down mistakes. It can help you set up a pipeline to render out dailies for instance without all the hassle of having to submit your projects manually.

Bobo explains this workflow on the thinkbox blog

 

Manual maxscript deadline job submission

You’re not restricted to just rendering frames. You can also send a maxscript file to the deadline repository and have it perform whichever actions you need. In my example I render out a single frame ten times where I change the geometry and materials every iteration. But you can also send scripts which convert geometry, composite images or calculate simulations.

Send a maxscript to deadline to perform actions beyond rendering.

Deadline includes a template you can use to quickly set up such a script. It contains a bit of code which communicates to the deadline repository. Within that script, you insert the code you want to execute on the render-slave.

  1. Get the template from deadline or download it with the rest of the files in this tutorial. Store the script somewhere on your disk.
  2. Insert the demo script (or your own maxscript) into the designated area and store it on disk
  3. Open the scene which needs to be rendered (or a dummy scene) and open the deadline menu
  4. Set deadline up to use your newly edited template script and create a script-job
  5. Submit the job

1: get the template script

4: setup the job to use your newly created script. If you don’t want to render frames specified in the render-menu, check the “Single task” checkbox.

Automated maxscript deadline job submission

Combining all the scripted goodness results in an automated submission of maxscript deadline render-jobs. So let’s say you have an asset library with hundreds of objects and you have a maxscript which writes out a report on a single asset. Stuff like: amount of vertices, pivot-point location, volume, etcetera. You can perform these reports on all files in your library by using deadline. But you don’t want to manually submit these files to deadline. Enter the automated maxscript deadline job submission.

Use automated mascript job submission to avoid having to submit many files manually

Each time you submit a job to deadline, you can make a unique script which will be submitted together with the file. It depends on your needs, but it might happen your scripts are built or generated for a specific scene. You can do that by using fileStream methods on the template-script to automatically insert your own code. this requires setting up the template with some delimiter strings to mark the location where you can insert your own code.

  • Edit the template with delimiter strings. Use a tilde (~) in this case. This is done to chop up the template.
  • Use a script to insert your script in the template. You can take a look at the example in the files-pack supplied with this tutorial.
  • Save the newly compiled script to disk
  • Edit Bobo’s deadline submit-script slightly to enable automated script-jobs.
  • Submit the script job by maxscript

 

Included in the file-pack with this tutorial:

  1. a 3dsMax file ready to be rendered with scanline: DemoScene.max
  2. a maxscript which renders ten frames from the demo-file: RenderCycleColor.ms
  3. the deadline-template in original form: Deadline_mascriptJob_template.ms
  4. the deadline-template edited with delimiter strings: Deadline_mascriptJob_delimitedTemplate.ms
  5. a script to combine the script you want to submit with the delimited template and to submit it to deadline: submitDeadlineJob.ms

The scripts are heavily commented, so you can find more specific info in the scriptfiles themselves.

4 Comments

Join the discussion and tell us your opinion.

Boboreply
2011-11-14 at 20:52

Nice tutorial!

Just wanted to mention that the MAXScript functionality is somewhat limited when the network machine is in “network render mode” (a.k.a. Slave mode). Specifically, any operations requiring the 3ds Max UI to be present, as well as .MAX file I/O operations will be unavailable. On the positive side, no license will be required.

If you have floating 3ds Max licenses, you can check the “Workstation Mode” option in the Scripts rollout. This will cause 3ds Max to launch in full workstation mode with UI and everything (but it will require a license to run). In this mode, you can perform ANYTHING that MAXScript can do on your local workstation, including UI-related operations and scene I/O operations. You can even submit other jobs to Deadline in that mode!

Klaas Nienhuisreply
2011-11-15 at 20:13

Hey Bobo, thanks. Most of it is based on your tutorial anyway, so thank you too.
I’ve noticed the different modes you can use. The project I’m working on now requires me to render images and to post-process these images. The slave mode is enough for that.
The idea to create a job that submits jobs is nice. Sometimes submitting large files can take up quite some time, even when using a script to do that. So why not move that burden to a slave in the renderfarm!

Carlreply
2018-04-16 at 03:52

Thank you so much! You are really awesome!

Kamyar Karimireply
2020-02-11 at 16:02

Thank you very much. Super useful.

Leave a reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.