Programmers welcome! Stereo Imagination is a Python toolkit for generating and manipulating 3D geometry from code. This can be used to make visualizations, or as the basis for a graphics engine. There are other solutions out there, but Stereo Imagination also has the quality of being simple and transparent.
Source code and samples (40K)
Stereo Imagination is open source under the MIT License. Samples are CC0.
What you get
The toolkit is made of three major components:
- Py2STL, a library to generate and transform 3D geometry, then export it as STL files;
- Wire3D, a wireframe renderer coupled with loaders for 3D models in STL and OBJ formats;
- WireView 3D. a simple file viewer based on the above.
The latter can be used without any programming knowledge, but only from the command line as of 28 August 2018.
For programmers, there's a Cython build script and .pxd files as of 28 October 2021. Compiling Stereo Imagination doesn't help much, but it's now an option.
You need a Python runtime, either version 2.7 or 3.3+. It comes preinstalled on Linux and Mac; Windows users can get one from the official website.
To run WireView 3D and some of the demos, you also need the Pygame library, available from the official website or various software repositories.
(As of 23 April 2021, there's also native port of VireView 3D.)
How to use
See the read-me file for Py2STL in the samples directory. Wire3D isn't documented yet; you'll have to read the demo source code. To use WireView 3D, call it from the command line like this:
You can rotate the model with the arrow keys, and zoom with +/-. The R key resets the view. Stick to models well below 10K polygons if you have an older CPU, like an Atom. Anything this side of a Core 2 can easily handle dozens of times more.
Speaking of which: while the file loader can deal with arbitrary polygons, the renderer will only work correctly with triangles and quads. Other features of OBJ files such as materials or polylines will be ignored.
Known bug: resizing the viewer window works intermittently on some systems; just fiddle with the edges a little if you run into that.
Notes on the STL file format
Stereo Imagination only deals in the ASCII variant of STL. Binary files are not supported! If storage space is an issue, the format compresses very well.
STL files are only supposed to contain one solid each, but most modern applications seem to deal with multiple solids per file without a problem.
Conversely, STL files are supposed to have a free-form syntax, but most modern applications seem to treat it as line-oriented; this simplifies parsing.