Blender
These are some notes about Blender, the 3D modelling and rendering software.
General usage
Scripting
Resources
- Blender Python API reference
- wiki:Python Scripting
- Intro to Scripting (BSoD:Stephen Swaney)
- Python&Plugins (Blender Artists)
- Some nice scripts on blender.org
Non-interactive scripting
The aim here is to script blender to create and render a scene for you, so that it can be done non-interactively; eg. the creation of spinning text given the string to render.
Issue: Commandline arguments
I'd like to be able to pass arguments to a script, such as the String to render, animation speed etc. However, this does not seem to be reliable. A script such as the following:
import sys import Blender as B print sys.argv B.Quit()
Produces the following output:
conrad@chichai:~/src/blender-scripts$ blender -P args-test.py pants Using Python version 2.4 ['blender-bin', '-P', 'args-test.py', 'pants'] Blender quit
So, the arguments are visible, but mixed in with blender arguments. Perhaps this is ok after -P ?
Issue: Background modelling
Blender provides a background rendering mode, which works by feeding it a constructed .blend file:
blender -b scene.blend
This allows an animator to create a scene description file, and then pass the resulting .blend file on to a renderfarm to actually render.
However, there is no way to programatically construct a scene in the background. Hence, a non-interactive modelling script will bring up an X window, and cannot be run in -b mode.
Issue: Running as an executable script (with #!blender)
Blender doesn't let you feed it python code on stdin, ie:
cat script.py | blender -P -
If it did, then you could use it in executable #! scripts as:
#!/usr/bin/env blender -P - import Blender ...
