简体   繁体   English

使用Blender和Python进行3D渲染

[英]3D Rendering with Blender and Python

I have a project in which I would like to create a 3d animation based on some data. 我有一个项目,我想根据一些数据创建3D动画。 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. 我当时以为我会从命令行使用Python和Blender来执行此操作,但似乎Python充当Blender的扩展而不是独立的场景创建者和渲染器。 I found this useful resource: 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? 我找到了这个有用的资源: http ://wiki.blender.org/index.php/Doc:Manual/Render/Command_Line_Options,但是它似乎需要由用户在Blender GUI中生成的“ file.blend”吗? Is this possible, or is there another language/3d renderer which would better suit my needs? 这是否可能,或者是否有其他语言/ 3d渲染器更适合我的需求? 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. 是的, Blender可能会对此有所帮助。 The new (at the time of writing) versions are Blender 2.5x. 新版本(在撰写本文时)为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 . 可以在这里找到Blender 2.5x Python API文档Blender 2.5x Python API docs They also have some mailing lists, and an IRC channel, which are good places to ask questions etc. 他们也有一些邮件列表和IRC频道,是问问题的好地方等。

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. 既然您问了这个问题,blender 2.6已经发布并且稳定,是的,您可以这样做,不,您不需要在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. 甚至还有一个可从文本编辑器访问的名为“ Background Job”的模板,该模板用一个文本创建一个场景并通过python渲染它,该场景全部从命令行运行,它还接受命令行参数,因此您可以将变量传递给python脚本非常方便。

Much of the functionality of Blender is accessible via Python. Blender的许多功能都可以通过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. .blend文件是Blender文档,其中包含您正在处理的3D场景/模型的所有数据,还可以包含Python脚本。 It is also possible to invoke Blender from the command line, and tell it to run a separate Python script. 也可以从命令行调用Blender,并告诉它运行单独的Python脚本。 So there is a lot of power and flexibility for doing what you want. 因此,您可以按照自己的意愿进行操作,具有强大的功能和灵活性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM