3D Rendering with Blender and Python
I have a project in which I would like to create a 3d animation based on some data. Given specific points, I'd like to create an animation including spheres, lines, some shading, and a moving camera. I was thinking I would use Python and Blender from the command line to do this, but it seems as if Python acts more as an extension to Blender than an independent scene creator and renderer. I found this useful re开发者_JAVA百科source: http://wiki.blender.org/index.php/Doc:Manual/Render/Command_Line_Options but it seems to need a "file.blend" which was generated by a user in the Blender GUI? Is this possible, or is there another language/3d renderer which would better suit my needs? I'm very flexible, and very willing to deal with a steep learning curve.
Thanks in advance!
Yes, Blender probably would be good for that. The new (at the time of writing) versions are Blender 2.5x. Although they are currently in beta, they are quite stable. The Blender 2.5x Python API documentation can be found here: Blender 2.5x Python API docs. They also have some mailing lists, and an IRC channel, which are good places to ask questions etc.
Much of the functionality of Blender is accessible via Python. A .blend file is a Blender document, which includes all the data for the 3D scene/model you’re working on, and can also include Python scripts. It is also possible to invoke Blender from the command line, and tell it to run a separate Python script. So there is a lot of power and flexibility for doing what you want.
Since you asked this question, blender 2.6 is out now and stable, Yes you can do this and no, you don't need a file created in a GUI.
You might want a blank file that the script can fill up with assets but this isn't essential.
There is even a template accessible from the text editor called "Background Job", which makes a scene with some text and renders it from python, all running from the command line, it also accepts command line arguments so you can pass variables to the python script which is quite handy.
精彩评论