A MAXScript Perspective – The Power of Automation!

Hello,

In this post I will go into the power of automation – using MAXScript. Recently I was tasked with automating some image renders as the way we were rendering them wasn’t very efficient. Inefficiency can become very costly as you scale up a project and so I set out to speed things up and make the rendering part (at least) a bit more automated.

Since we had managed to set up the lighting in our “master” file and made sure that each of the meshes were all prepared, all I had todo then was import, apply materials and render!

The Process:

  1. Import the mesh(es).

  2. Apply material(s) > Render.

  3. Pick directory, save the image with the correct name and settings.

  4. Apply new material(s) > Render.

  5. Pick directory, save the image with the correct name and settings.

  6. Repeat steps 2-5 until you have the specified amount of image renders (In the current script it is set to 4 materials in the sample slots 1-4).

  7. Import new mesh(es).

  8. Repeat steps 2-6 for the new mesh(es).

  9. Continue rendering each new mesh with the specified material(s) until you have the required amount of renders.

The Analysis:

Already there is a clear pattern and we can see where errors could occur:

  • Importing the Mesh – Even though we may have prepared the meshes, errors could slip through such as: misaligned pivot points, scale / rotations not reset (Reset XForm Utility in 3ds Max fixes this), “rogue” vertices (vertices which are not connected to anything or causing n-gon (polygons with more than 4 sides) issues), wrong assignment of the material(s) etc.

  • Rendering – Has the lighting and camera(s) been setup correctly? Has the resolution been specified? etc.

  • Saving the image files – Have you picked the right folder directory? Is it the right image type (png or jpeg etc.)? Does it need to have transparency enabled or require an alpha channel? Does the file name follow the specified naming convention?

The Solution:

The script I produced for the project automated the rendering part and the subsequent file naming duties. However, I wasn’t able to implement importing of external files due to time constraints.

The example code can be found on GitHub or here:
(there are many comments in as this was also a learning experience too!)

Leave a Reply

Your email address will not be published. Required fields are marked *