Scripting streamlines your 3d workflow

I think a lot of 3D artists overlook the power that scripting with their 3D application provides them.

“I’m an artist - so why do I care about scripting?” I hear you cry. Scripts are great for automating repetitive tasks, and you don’t need to be a superb programmer to take advantage of them. That being said, if you understand a few of the basic aspects of programming like loops and variables then scripting becomes even more powerful.

I predominantly use 3d Studio Max at work (along with Silo for modelling), and I’ve found that maxscript is relatively easy to learn. I’m not a Maya user, but I understand that it’s scripting language, Mel, is fantastic.

How about some examples of where scripting is useful?

I know that all the characters I build in my current project have the same bones, so rather than creating them from scratch each time, I have a script that loads them from an external file. After the bones are loaded, it creates 2 selection sets - 1 for all the bones (but no nubs), and another set with a drastically reduced bone list for the LOD model (no fingers, toes, helper bones or face bones for example). The script finds all the components that need a skin modifier applied, applies it and assigns the correct bone set (thats the benefit of a sensible naming convention for you).

I like all my renders to look the same, so I’ve written a render script - it loads a scene with my preferred lights, floor and camera, sets the background colour of the scene to be neutral and changes the lighting tint. It selects the camera, sets the output size, grabs the name of the model from the max filename so that it can name the image, then renders and saves the image to the same folder as the model. It also renders Front, Back and 3/4 views.

Sound useful? How about a batch script? It loads a list of models in turn and executes another script. So if I need to render out all my work, I just point my batch script at my models and tell it to execute my render script - then I can bugger off for a coffee, or leave it running overnight.

Setting up all your shaders? Press a button and maxscript converts all my max materials to shaders, with all the shader values set to our correct defaults.

So where do you start?
The best thing to do is to pick a simple task and try to script it. I learned to script not by doing abstract examples, but by just grabbing the bull by the horns and trying to write something useful. But where can I START? The first step?

3DSMax has a tool called the Maxscript Listener, which records almost everything you do in max. This is usually my first step - I open the listener, then I perform the entire task manually. The listener records all the steps (usually, sometimes the listener has selective hearing), and I can simply copy and paste them to a new script document where I can then edit until I’m content.

It’s worth mentioning that not just 3d applications that can have their workflow improved by scripts - Photoshop is a good example of a 2d package that allows you to create actions to automate repetitive actions - such as resizing and sharpening an entire folder of textures.

Resources:
These are a few things I could think of to help you along the way.

  • The Maxscript help files that come with max are very, very good. I’ve gotten most of my help from these.
  • Search Google for ‘Learn Maxscript
  • Scriptspot has got thousands of 3DS Max scripts online - there is a good chance that you get something to suit your needs, or tear them apart to learn how they work.

Thoughts on this?