Structure Synth: Turn Your Linux Box Into an Abstract Art Machine with a Powerful Tool
I must admit that I’m not an artist, at least not in the classical sense. My background, professional life and hobby projects are all related to programming, and even though I sometimes need to get my hands dirty with some designs handed to me, I prefer to leave the arena of original and uniquely beautiful creations to the people whom I admire and call ‘artists’ or ‘graphic designers.’ But sometimes it is too difficult to resist the urge to tinker, especially when your computer seems more helpful than ever.
Flashback: I remember the excitement I felt when I first saw the striking graphics produced by the venerable POV-Ray. That was back in the middle of 1990s and I even managed to hack a 5 minute animation with my friends at the math department which featured abstract shapes and transformations. It wasn’t nominated for Oscar, alas, but we had the fun of our lives and received some enthusiastic applause at the end of a public show, too. The core concept was simple for me: A high-level programming language specifically streamlined to describe graphics was far more approachable for a geek like me compared to trying to create some sketches freely or using a tool directly designed for artists.
Fast forward to 2011: I was exploring the Ubuntu Software Center a few months ago when I met a software package with an eye-catching name. According to its short description, Structure Synth was an “application for creating 3D structures.” I must admit that my initial reaction was “a little bit too abstract for my taste!” but not much time passed when I met the same software again, but this time it was used to design some very interesting and beautiful cover graphics for the Communications of ACM magazine. Remembering the good old days, I gained my courage to explore this software and unleash the hidden computational artist inside me, which started with the usual preamble:
$ sudo aptitude install structure-synth $ structure-synth
Frankly, I did not expect such a simple and intuitive interface, a kind of graphical IDE with a simple example script file already ready to be rendered:
/* A simple demonstration of Structure Synth. */ set maxdepth 400 R1 R2 rule R1 { { x 1 rz 6 ry 6 s 0.99 } R1 { s 2 } sphere } rule R2 { { x -1 rz 6 ry 6 s 0.99 } R2 { s 2 } sphere }
Pressing the ‘Play’ button on the interface (or hitting the F5 key) quickly produced an image which I found quite nice for a start (abstract, beautiful and reminding me of the infinity symbol, which led to bonus geek points from me to the developer of Structure Synth).
After an exciting start, I decided to learn more about this little gem of free software. According to its official web site, “Structure Synth is a cross-platform application for generating 3D structures by specifying a design grammar. Even simple systems may generate surprising and complex structures.” The system is programmed in C++ using OpenGL and Qt 4. It can be compiled and run on any decent GNU/Linux distribution, and if you are an Ubuntu or a Debian user then it is just one apt-get away from you.
In order to create some amazing graphics, Structure Synth expects an input file from you with an .es extension which includes an Eisenstein script, the native programming language of the application. If you programmed in any modern programming language such as Python, Perl, C, Java, C++, JavaScript, Lua or Lisp and the term ‘recursion’ does not sound like the name of a creature from outer-space to you, then learning the basics of Eisenstein scripting language won’t take more than a few hours. The integrated development environment of Structure Synth will help you with a syntax-coloring code editor, very clear explanatory messages at the bottom pane (both reporting normal progress and providing clear error messages when something goes wrong). As soon as you press the ‘Play’ button on the interface (or go to Main Menu -> Render), the pane on the right side will show the graphical result of running your Eisenstein script through the Eisenstein engine. You will be able to rotate the resulting image using your mouse as well as zoom into and out of it. If you are satisfied with the result you can right click on the image (or visit Main Menu -> Render) to ‘Save as Bitmap...’ The only annoyance I encountered at this step was that the system did not provide me with the image formats I could use and only after the error message I was able to learn that I had the options of bmp, ico, jpeg, jpg, png, ppm, tif, tiff, xbm and xpm.
Another strong point of the system is that it allows you to export the model you created with Eisenscript into a powerful photo-realistic ray tracing system such as POV-Ray or SunFlow. That is very important because even though the ray tracing engine that comes with Structure Synth is good and fast enough for drafting your models and interactively tweaking them, when it comes to rendering the code into a highly realistic image you’ll definitely need a much more sophisticated and powerful ray tracer.
One thing that I was curious about Structure Synth is whether it had some capabilities to create animations and once again I saw that it did not let me down. Not only does it let me create animations, but it also gives me the ability to use my favorite programming language, JavaScript, to control the animations (see http://blog.hvidtfeldts.net/index.php/2010/11/scripting-in-structure- synth/ for more details and code examples).
Except for a few glitches in the interface, which annoyed me by not letting me edit the example .es files sometimes (after I rendered them), and the somehow-not-very-intuitive part of the ‘Save as Bitmap...’ feature I mentioned above, I found Structure Synth to be the perfect tool to explore marvelous graphical ideas using simple programming concepts such as recursion and random numbers. At the hands of a creative programmer, this unique tool can become a very powerful digital canvas. And as is the case for all free software, you are also free to tinker with the internals of the system and enhance the Eisenstein scripting engine. Or what about creating a system in Python which converts your Python code into Eisenstein code which can be input to Structure Synth and then exported to POV-Ray? Creativity is the name of the game. Happy abstract graphics hacking!