Programmers welcome! Stereo Imagination is a Python toolkit for generating and manipulating 3D geometry from code. This can be used for quick visualizations, as the basis for a graphics engine, or more likely for fun and learning: the code is very simple and transparent. For serious use you probably want OpenSCAD.
Stereo Imagination was an experiment that didn't go very far, but still generates interest as of 2024, so it's worth the occasional update.
Download
Source code and samples (41K)
Stereo Imagination is free and open source under the Artistic License 2.0; samples are CC0.
News: version 2024.1 comes with a new license, updated documentation and additional features. The entire project was given a thorough clean-up.
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.
System requirements
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. Last but not least, Zenity is required for certain features of the WireView GUI.
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:
./wireview.py <filename>
You can rotate the model with the arrow keys, and zoom with +/-. The R key resets the view. Use O to open another model (you'll need to have Zenity installed). Q or Escape closes WireView.
Known bug: resizing the viewer window works intermittently on some systems; just fiddle with the edges a little if you run into that.
Performance
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.
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.