usakhelo / batchcam

Batch rendering tool for 3ds max
http://usakhelo.github.io/batchcam
GNU General Public License v2.0
29 stars 4 forks source link

BatchCameraRender

The Idea

Very first idea to write such script came to me when I started to learn Houdini. Houdini has node architecture, and for the rendering it uses output nodes. These nodes have properties to specify included/excluded lights and objects, so you can create several output nodes and specify camera/lighting/objects relationship for each node. It's a great feature and you can implement same relationship in 3dsmax using batch render command with "scene states" where you can specify lighting options and "render preset" where you can specify rendering properties.

So what the problem with batch render? It lacks two features - you can not specify nonsequential frames and you can not specify new output file location for several cameras at once. So I've started to write this tool to replace standard batch render.

How it works

When you start this script it collects all cameras in scene and list them in the dialog box. To each of these cameras you can assign frame resolution, number of frames to render including nonsequential frames, output file location and many other options. This infomation is saved with the AppData method to each camera object. Assigned properties can be changed for one or several selected cameras.

Main Features

Here is the list of options that can be assigned to each camera.

All sections contain Clear button to delete section properties and use default ones.

Some Other Features and Usabitility

Keyword syntax is one of the strongest part of the script. Special keywords can be used in all file and folder paths to include camera name, scene state name, date, resolution, scene file name and project folder name in that paths.

Here is the list of currently supported keywords (most have self-explained name):

Example usage:

path like this: D:\Work\%projectname%\%date%\%cameraname%.jpg

produces D:\Work\SomeProject\2010-03-10\interior.jpg

Also script provides a way to specify custom keywords - User Key/Value fields located in the Options rollout. These fields allow user to define custom template keywords. User Key contains the keyword and User Value contains computable expression - e.g. you can enter any maxscript expression into field and it will be computed for every camera before the rendering. For example, if you want to use username in the file or folder name you just enter word "username" to the User Key and sysInfo.username expression to the User Value field. After that %username% keyword will be replaced with actual username of the user who sends the job to the rendering. If the expression could not be computed it is replaced by "ErrUserVal" string. Make sure your expression works in maxscript listener before you use it in the User Value field.

Default values for all the properties.

Values of all properties in script can be set as default. These values will be assigned to all newly created cameras in scene and will override undefined values in all cameras. There are two kind of default values in the script - Global and Local. Local values, if they exist, override the global values. Global values are stored in the INI file BatchCameraRender.ini and located in the %LOCALAPPDATA%/3dsmax/.../plugcfg/BatchCameraRender folder. Local default values are stored in the INI files that can be located in scene folder and/or in any folder up to root level. You can have one ini file in root folder of all projects and another ini file in each project. In this case settings from root ini file will be overridden by project ini file. This allows you to have project wide settings and default settings specific for each project.

To set the global defaul values, click Save All Settings as Global Defaults button in Options rollout. To set the local defaul values, click To Local Defaults located in each section ( you have to enter local INI path before that ). Alternatively you can edit INI files in text editor, use Open Global/Local INI File button in Options rollout.

All specified paths that don't exist at moment the rendering starts will be created automatically. The "Create new paths silently" checkbox could be used to turn this feature on or off.

Network rendering is also automated - several netrender jobs can be sent with one click, bypassing Submit Network Job Assignement window.

Several buttons below the main camera list are given to make the work with large list more comfortable.

Macroscript is designed as standard dialog window - toolbar button works as a switch, first click runs the script, the second closes the script.

Rollout state and window size and position is saving during the session. Upon the render starts checking is performed if render type is set to view - if render type set to region, blowup or something except view mode warning dialog box appears.

Limitations and Warning

Some of the properties (if not all) doesn't pass very strict checking. For example if the Vray GI is turned off and in the script Irradiance Map map save file name is specified then the file wouldn't be saved.

I was using this script every day and I'm trying to make it stable but it still may contain some bugs. Use this script at your own risk.

Thanks

I would like to thank everyone who uses this script and helps me with suggestions and bugreports.