Headless Rendering¶
In certain scenarios you might want to render with renderset from the console, without clicking on anything in the GUI. This is especially useful when rendering on a render farm.
Set up your render contexts
Make sure you set up your render context in the .blend
files and File → Save before running
these scripts. The scripts will start a fresh Blender and open the files. You will not be able
to change the number of samples, camera resolution, or any other render setting after running
these scripts!
We assume all data are in place
All the data necessary for the render have to be in place. Please check out the docs about render farms for more details on how to achieve this.
Windows¶
Other shells work too
You can use mingw bash
, powershell
or others but we will use cmd.exe
here.
Press Win+R and type cmd.exe
. You should see a black terminal box appear.
Use terminal commands to navigate to where your Blender is installed. In my case it is
C:/blender-3.0-windows64
:
If you typed blender.exe
here it would just start Blender with GUI. We have to use some special
command-line switches and arguments to make it run without GUI. You can see all the command-line
possibilities by typing blender.exe --help
and pressing Enter.
Render Single Context¶
Before we do that let us create a little script that will render via renderset when blender is
running headless. We recommend creating it in the same folder where your Blender
is installed.
It makes the command-line options easier. In my case it is going to be
C:/blender-3.0-windows64/renderset_render_current.py
. Create that file and copy the following into it:
Let us now start blender.exe
and tell it to run without GUI and execute the script we just created.
Blender should run for a bit and then output the following:
Oh no! We rendered the default cube because no .blend
file was opened. Let us fix that:
Order of arguments matters!
Make sure you input the command line arguments in the right order! Otherwise Blender
will
run the renderset code and then open the .blend
file.
Render All Checked Contexts¶
We were able to render the current active context in the previous section. How do we render all
contexts? We need a different script. Let us call this one renderset_render_all.py
. Create it
and put the following code there:
And run:
You should get this output:
Render All Checked Contexts in Multiple Files¶
We were able to render all contexts in a single file in the previous section. Now we will expand it
to rendering many files. Again, we need a slightly different script. Let us call this one
renderset_render_all_multiple_files.py
. Create it and put the following code there:
Before running the command make sure you change the filepath in the script. Find the line with TODO
.
And run:
Tip
Note that this time we are not telling blender.exe
to open any files, the script itself will
do that.
macOS 10¶
Sorry, work in progress. Instructions from the Windows section should work with minor path and syntax modifications.
Linux¶
Sorry, work in progress. Instructions from the Windows section should work with minor path and syntax modifications.