# Scripting in Structure Synth

I’ve added a JavaScript interface to Structure Synth. This makes it possible to automate and script animations from within Structure Synth. Here is an example:

The JavaScript interface will be part of the next version of Structure Synth (which is almost complete), but it is possible to try out the new features right now, by checking out the sources from the Subversion repository.

The rest of this post shows how to use the JavaScript interface.

# Are Boxes too Square for Sunflow?

Structure Synth is now able to export boxes to Sunflow. That was actually a lot harder than spheres.

Boxicity (Sunflow render).

Sunflow has some amazing global illumination lightning, but why doesn’t it have a ‘box’ primitive in its scene graph language? I mean, it has Banchoff Surfaces, tori and teapots, but not a simple box?

By the way, for those who really dig boxes, check out the Flickr Boxclub (a few Structure Synth creations may also be spotted there).

# Structure Synth Rendering Templates

Creating a reasonable way of exporting Structure Synth objects to other renderers, like Sunflow and POV-Ray turned out to be more difficult than I expected. Not because they have complicated scene description languages – they don’t – but because there are a lot of settings and parameters, and I do not want to wrap and support every single one of them.

Example Sunflow rendering with Global Illuminated Ambient Occlusion.

The approach I came up with is quite simple – it is now possible to define a number of rendering templates which are XML-files containing a number of text fragments, one for each of the primitives (box, sphere, …) and a ‘start’ and ‘end’ fragment.

For instance, a fragment (for a Sunflow exporter) for the ‘sphere’ primitive could look like this:

object {