Use spreadsheet to generate batch render command

Blender 2.63a
Libre Office 3.4.4

Being able to render from command line is convenient, to queue up many files for rendering, you could create a batch file (like renderall.bat) contain these command.

blender -b scene1blah.blend -a
blender -b scene2blahblah.blend -a
blender -b scene3blah.blend -a

so on…

And run the renderall.bat from command line.

Problem is the amount of typing/copy&pasting those commands if you have like a few hundred shots to render could be overwhelming.

Spreadsheet like LibreOffice Calc is coming to rescue.

Assume you’re in Windows. In cmd, cd to the drive/folder where you keep those blend files. Then

dir /B /O N *.blend >allblend.txt

This will list every files ended with .blend and write into a new text file called allblend.txt, sorted by name.

Run Calc. Click menu Insert->Sheet from file

Browse to the allblend.txt, you just created. OK with default settings, you’ll end up with each blend file in its row in column A.

Click and drag to hilight every cells in A and move them to B

In an empty cell A1, type in ‘blender -b’. And duplicate this to every A row by dragging the lower right corner of the A1 cell down to the last row.

Also, in cell C1, type ‘-a’ and duplicate it down to every C row.

Your spreadsheet should look like this

You can remove rows that you don’t want to render.

Now save as … Text CVS (.cvs)

There would be a dialogue pop up to ask for ‘Field Delimiter‘, change this one to {space}

You’ll have a .cvs file, which is actually a normal text file that you can change the extention to .bat and execute it as a rendering queue.

Render from command line

Blender 2.63a

You can render a scene without opening the blender interface from command line

in windows – cmd
in linux or mac – terminal

Provided everything is set and ready to be rendered, to render animation type in command

blender -b filename.blend -a

For more advance options, you can use python script to change some settings in the blend file before render.

Create an empty text file with your favorite text editor (or in blender). Copy & paste these example settings.

import bpy

#change scene name to yours
Scenename = 'Scene'

# quality
bpy.data.scenes[Scenename].render.resolution_x = 2048
bpy.data.scenes[Scenename].render.resolution_y = 1080
bpy.data.scenes[Scenename].render.resolution_percentage = 50
bpy.data.scenes[Scenename].render.use_antialiasing = True
#bpy.data.scenes[Scenename].render.use_full_sample = True

# frame range
#bpy.data.scenes[Scenename].frame_start = 1
#bpy.data.scenes[Scenename].frame_end = 5

# image format
bpy.data.scenes[Scenename].render.image_settings.file_format = 'TIFF'
bpy.data.scenes[Scenename].render.image_settings.quality = 80
bpy.data.scenes[Scenename].render.image_settings.color_mode = 'RGBA'

# Cycles sampling
#bpy.data.scenes[Scenename].cycles.samples = 200

# stamp
bpy.data.scenes[Scenename].render.use_stamp = 1
bpy.data.scenes[Scenename].render.stamp_background = (0,0,0,1)

# output
#bpy.data.scenes[Scenename].render.filepath = '//render/test_'
bpy.data.scenes[Scenename].render.use_placeholder = True
bpy.data.scenes[Scenename].render.use_overwrite = False

# start render animation
bpy.ops.render.render(animation=True,scene=Scenename)

The important lines are the first and the last. Other lines can be changed to fit your need. The properties names are quite self-explained. The # sign is for comment line, will be ignored by the interpreter. You can hover the mouse over any boxes or buttons in Blender to see the script associated.

More details can be found at blender python api reference :

http://www.blender.org/documentation/blender_python_api_2_63_2/contents.html

 

Save the text as ‘setting.py’. You might put it in the same folder as the blend file for convenient.

To start render from command line, type

blender -b filename.blend -P setting.py