All posts by Mikael Hvidtfeldt Christensen

Fractal Explorer Plugin

In July Subblue released another Pixel Blender plugin, called the Fractal Explorer Plugin – for exploring Julia sets and fractal orbit maps. I didn’t get around to try it out until recently, but it is really a great tool for exploring fractals.

Most people have probably seen examples of Julia and Mandelbrot sets – where the convergence properties of the series generated by repeated application of a complex-valued function is investigated.

The most well-known example is the iteration of the function z ← z2+c. The Mandelbrot set is created by plotting the convergence rate for this function while c varies over the complex plane. Likewise, the Julia set is created for a fixed c while varying the initial z-value over the complex plane.

Glynn1 by Subblue (A Julia-set where an exponent of 1.5 is used).

Where ordinary Julia and Mandelbrot sets only take into account whether the series created by the iterated function tends towards infinity (diverges) or not, fractal orbits instead uses another image as input, and checks whether the complex number series generated by the function hits a (non-transparent) pixel in the source image. This allows for some very fascinating ‘fractalization’ of existing images.

A fractal orbit showing a highly non-linear transformation of a Mondrian picture.

Subblue suggests starting out using Ernst Haeckel beautiful illustrations from the book Artforms of Nature, and he has put up a small gallery with some great examples:

An example of an orbit mapped Ernst Haeckel image.

To try out Subblue’s filter, download the Pixel Blender SDK and load his kernel filter and an input image of choice. It is necessary to uncheck the “Build | Turn On Flash Player Warnings and Errors” menu item in order to start the plugin. On my computer I also often experience that the Pixel Blender SDK is unable to detect and initialize my GPU – it sometimes help to close other programs and restart the application. The filter executes extremely fast on the GPU – often with more than 100 frames per second, making it easy to interactively explore and discover the fractals.

As I final note, I implemented a fractal drawings routine myself in Structure Synth (version 1.0) just for fun. It is implemented as a hidden easter egg, and not documented at all, but the code belows shows an example of how to invoke it:

Size: 800x800
MaxIter: 150
Term: (-0.2,0)
Term: 1*Z^1.5
BreakOut: 2
View: (-0.0,0.2) -> (0.7,0.9)

Arguable, this code is not very optimized (it is possible to add an unlimited number of terms, making the function evaluation somewhat slow), but still it takes seconds to calculate an image making it more than a hundred times slower than the Pixel Blender GPU solution.

Generative Bots

GroBoto is a commercial 3D modeling tool built around the concept of bots. Bots are small iterated systems, with a few selected variables that can be customized. Bots are selected from a list of presets – more than 100 are available. Some of the Bots are very similar to what can be accomplished in Structure Synth.

GroBoto is a very polished product. The GUI is slick, and there are loads of advanced visualization customizations: textures, lightning and animation. When moving and rotating objects an OpenGL view is used, but the scene is always automatically rendered using an internal raytracer, which is really amazingly fast (typically less than a second).

My only complaint is that you are somewhat limited by the presets offered by GroBoto. It would be amazing to be able to completely script the objects. Yet again, that would make GroBoto a tough competitor to Structure Synth ­čÖé

GroBoto is available for $59 (using the coupon offer) for Windows and Mac OS X.

Be sure to a look at their gallery for more images or try the demo.

Generative Invaders

Post I.T. Shooter is small indie game by Kloonigames (run by Petri Purho, a computer science student in Finland, who each month creates a new indy game in seven days).

Unique aesthetics combined with a nice soundtrack, and randomly generated invaders!

The invader generator was inspired by Jared Tarbell’s Invader Fractal algorithm. Be sure to also check out Dave Bollinger’s Pixel Robots – also inspired by Tarbell’s work.

Structure Synth 1.0 (“Potemkin”) Released

I’ve released version 1.0 of Structure Synth.

The biggest new feature is the new Template Export GUI, which I described in a previous post. Template Export GUI highlights:

  • Shows the defined primitives in the template (highlighting used and missing ones).
  • Integrated XML editor with syntax highlighting for quickly modifying the template.
  • Automatic unique filename generation.
  • Quickly set output width and height.
  • Optional post modification window allows you to modify the output before saving.

Other new features:

  • Added a ‘Recent files’ menu entry.
  • Optional (and experimental!) depth-first recursion (using ‘set recursion depth’). This can be useful for constructive solid geometry.
  • Added an application icon.
  • Support for a new generic ‘template’ primitive

The template XML syntax has been slightly modified, and is no longer compatible with the previous format:

  • A new ‘description’ element has been introduced.
  • The ‘substitution’ element is now called ‘primitive’ (so you need to rename elements of this type).
  • Added ‘defaultExtension’ tag (for automatically suggesting file extension).
  • Added ‘runAfter’ tag (for setting a default application to spawn).

Binaries for Windows (XP and Vista).
Mac binaries (Universal build).
Linux is still source only, but if you are on Debian or Ubuntu, keep an eye out for the ‘structure-synth’ package – it will be updated to 1.0 at some point.

UPDATE 11 July: Mac binary now available.

Download at SourceForge.

Template Export GUI

I’ve added a Template Export Dialog to Structure Synth. This greatly simplifies the workflow when working with Structure Synth models.

The Template Export Dialog.

The Template Export Dialog makes it possible to browse the available templates, and see which primitives are defined in the template. The green primitives are the ones actually used in the EisenScript. If the EisenScript contains primitives not defined in the template, they will be listed as red items.

The Template Output section specifies the output filename. The default extension can be set in the template XML file (using this new defaultExtension attribute, e.g.: defaultExtension=”Sunflow scene file (*.sc)”). It is possible to automatically add a counter to the filename, to ensure that an unique file is created.

The output width and height can be changed from the dialog. The ‘/2’, and ‘*2’ buttons halves and doubles the output size, while the ‘D’ button sets the size to the size of the OpenGL window.

The Post Processing section makes it possible to specify a file with arguments, which is run after the output has been created. The $FILE$ marker will be substituted for the actual output filename before starting the process. Of course the path to the executable must be changed before using this.

It is also possible to directly modify the XML template before applying it (notice the syntax highlighting!) – this makes it easy to try out script variations. Even the final output can be modified before saving it as a file or copying it to the clipboard.

There has been a few changes to the template XML file format in order to accommodate these changes. The ‘defaultExtension’ and ‘runAfter’ tag was added, a new ‘description’ element has been introduced, and finally the ‘substitution’ element has been renamed to ‘primitive’.

The Template Export GUI will be part of Structure Synth V1.0, which I hope to release this week before I leave for my vacation.

Creating an Icon for Structure Synth

I’ve had a few requests for icons in Structure Synth. And a few people volunteering to make them. In fact I already made a couple of rough icons for Structure Synth v1.0 – but if anyone is able to improve them, please do. Suggestions may be posted to the Structure Synth Flickr pool, where I’ll choose the most suitable ones based on user comments.

Creating good icons is difficult – especially because you need something that looks good even at 16×16 pixels. Drawing an icon from scratch in a pixel based editor is not for the faint of heart. I’ve tried to do so on a couple of occasions, and the result were terrible. It is much easier to create a larger icon (preferably in a vector graphics format) and scale it to the smaller resolutions.

Icons are square bitmaps typically used with the following width and heights in pixels: 16,24,32,48,256 (Windows Vista and Mac OS 10.4 only), and 512 (Mac OS 10.5 only).

An icon file (*.ico on Windows and *.icns on Mac) may contain multiple images at different resolutions and color depths. It is not necessary to provide all possible resolutions for a given icon – the OS will automatically create the icons it need by resizing the existing bitmaps – but resizing something down to 16×16 pixels can cause severe image degradation.

For the icons I created, I started out by a very simple model made in Structure Synth, and rendered in Sunflow:

Next, I imported the image into Paint.NET – a free paint program for Windows that I can highly recommended.

For an icon to look good, it must be transparent – and not only that – any shadows must be created using the alpha-channel. In this particular case it is quite impossible to cut out the shapes without completely destroying the shadows. What I needed was to convert the black shadows (composed of colors ranging from opaque black – #000F – to opaque white – #FFFF) into colors going from opaque black into transparent black (#000F -> #0000). Turns out this was possible using the CodeLab plugin for Paint.NET. The following lines do the job:

CurrentPixel = src[x,y];
CurrentPixel.A = (byte)(255-CurrentPixel.R);
CurrentPixel.R = (byte)0;
CurrentPixel.G = (byte)0;
CurrentPixel.B = (byte)0;
dst[x,y] = CurrentPixel;

This was the most tricky part. Notice that this also makes the interior of the objects transparent – I had to fix this by masking the objects in Paint.NET. A better solution would have been to render the background in a distinct color, so that I could isolate it in the CodeLab plugin.

After that I did some post-processing to create a document icon (for the *.es EisenScript file associations). This is how the icons ended up looking:

The final step involves packaging the images files in the Icon file formats. For this I used IcoFX – a free icon editor, packed with features, and support for both Windows and Mac icons. IcoFX also contains a nice pixel editor, making it possible to clean up the low resolution 16×16 versions of the icons.

Structure Synth Findings

Flash port

Keim has made a Flash port of Structure Synth. Not a lot of info here, but it seems that most of the EisenScript syntax has been implemented. Rules need to be programmatically created though, there is no free-text parser yet.

And if that wasn’t impressive enough, he also has created a version with Screen Space Ambient Occlusion. SSAO is a technique for creating real-time ambient occlusion simply by estimating the amount of oclusion by looking at the depth buffer. I’ve considered implementing it myself in Structure Synth, but had never thought that Flash would be fast enough to accomplish this.

And while I’m at it, Wonderfl is quite impressive in itself. It is a website, which makes it possible to edit and run small Flash programs, but most importantly it makes to easy to build upon other peoples work by forking it.

Art of Illusion

Ezziolai has created a Structure Synth plugin for Art of Illusion.
This thread contains the relevant links and some very good examples of Art Of Illusion renders.

Example image by Jep (found at the Forum thread)

Structure Synth 0.9.5 (“Haiku”) Released

A new version of Structure Synth has been released. It has several new features.

New commands

First of all a new system for generating random colors has been created – it is possible to use multiple palettes, including sampling colors from bitmap pictures. This was covered in a previous blog post.

The EisenScript has been extended with a few other commands: It is now possible to terminate the structure building when a given state reaches either a minimum or a maximum size. A new color blend operator was also introduced.

(The new color blending operator)

The new set seed initial command is also a very interesting addition: this makes it possible to combine randomness with self-similarity.

(Example of a random system, but with fractal properties)

Structure Synth now also supports drag’n’drop of EisenScript files onto the GUI. It is also possible to pass an EisenScript file as an argument to Structure Synth from the command line (this also makes file associations possible).

Licensing and packaging

A new license option is now available for Structure – previously the only option was GPL, but now Structure Synth is dual licensed under both the LGPL and GPL license. This was made possible, after Nokia acquired Trolltech and changed the Qt open-source licensing. I really think this is a wise move by Nokia – it will certainly speed the adoption of this excellent API. The LPGL makes it possible to use Structure Synth functionality in commercial and/or closed-source applications (e.g. VVVV integration would now be a possibility).

The examples and the export templates have also been cleaned – and new SunFlow templates by Neon22 and Groovelock have been added. Also a Blender importer by David Bucciarelli has been added. The PovRay exporter has also been restored.

Finally, Miriam Ruiz has begun creating Ubuntu and Debian packages for Structure Synth. Once approved they should be easily available on these platforms too.

Release Notes

Structure Synth 0.9.5 (“Haiku”) Released

Binaries for XP and Vista.
Mac binaries will hopefully be available soon.
Linux is still source only.

New features:

  • New color features: a ‘random color’ operator with different palettes (random hue, random rgb, greyscale, sampling from image, or from user-defined list).
  • Now uses two independent (Mersenne Twisters) random number generators: one for geometry and one for colors.
  • Upgraded to Qt 4.5.0. Now Structure Synth is dual licensed under GPL and LGPL.
  • Added ‘blend {color} {strength}’ operator.
  • Added ‘set seed initial’ for syncing random seed.
  • Added ‘set maxsize …’ and ‘set minsize …’.
  • Added support for specifying a startup .es file on the Commandline (this makes file associations possible).
  • Added support for drag’and’drop (drop a .es file onto the clipboard).
  • Added simple GUI for manipulating preprocessor defines.
  • Added templates by Neon22 and Groovelock to the distribution.

Minor changes and bug fixes:

  • Added close icon to tabs.
  • Applied more aggressive optimization on Windows build (SSE2/fast fp-math). SSE2 is now required!
  • Fixed a bug where a recursive rule (not producing objects) could fill memory.
  • Added export of background color to templates.
  • BugFix: The scrollwheel can now be used to zoom again.
  • PovRay template export has been restored. The Camera export still needs some work, but it should be usable again.

Download from: