Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Renderer for 3D model (points/lines) in Python

Tags:

python

3d

I have a 3d model that consists of points, lines and balls in space. For debugging, it would be nice to render these objects in real time and rotateable.

What are my easiest options to achieve this in python? Since I know nothing about graphical programming, I'd like to write as litte boilerplate code as possible.

like image 387
dassmann Avatar asked May 05 '11 18:05

dassmann


2 Answers

The easiest way to get 3d graphics on screen in python is VPython, though if your model is stored in a CAD file format, you'll need some other library to load the data. With just VPython, you will either need to hard-code the model or implement your own loader.

like image 161
user57368 Avatar answered Sep 19 '22 23:09

user57368


Two options I'd consider myself (depends what you're trying to do in the end):

  • Blender has fairly amazing Python integration. Simple example here. As I understand it, Blender's own file save format is executable python which prods the Blender Python API to reconstruct the scene. There's also a mechanism for introducing gamey logic into the Blender world but I know even little about it. Blender does have a crazy steep learning curve though.

  • Get into OpenGL using the Python OpenGL bindings. "Simple" example.

If you're more interested in creating the models, go with the former; if you're more interested in the rendering of them, go with the latter.

like image 35
timday Avatar answered Sep 17 '22 23:09

timday