Running a python script blender outside the blender

I want to visualize some scientific data, which at the moment is only an animation of some areas with different colors and sizes.

I have already created a script in Mathematica that creates an input for POV-Ray.

My problem is that I am not satisfied with the quality of the POV-Ray results and wanted to write a Python script that could customize the appropriate blender scenes and render them. An important limitation is what I want to do on a headless machine, so I cannot use the internal Blender console.

My question is: can I use Blender api from an external console to get POV-Ray behavior?


After reading George Profenz’s answer, I continued to research and found Dont Use Blender! in the Blender documentation.

Unlike my thoughts, you need to create a python script that is executed by the blender in the background.

./blender --background --python myscript.py 
+6
source share
2 answers

As far as I remember, you can start Blender from the command line without opening the interface / window system, which, I hope, works for your installation. Not only can you tell Blender to render the document, but you can also run a script that generates this document / fills the scene with geometry, highlighting, etc.

Alternatively, you can create content directly for the renderer (and skip the 3D editor / Blender completely). There are many free renderings, such as:

Yafaray

Yafaray

sunflow

SUNFLOW

Luxender Lux

pixies

Pixie

+4
source

There are two options:

  • The first thing you come across is running Blender in the background,
  • The second one, which is very experimental, uses Blender as a python module - BlenderAsPyModule

In both cases, it should be a simple operation to import a Mathematica scene - bpy.ops.import_scene. * Then select the scene bpy.ops.render.render

+5
source

All Articles