Console yourself with this…

by David BurnettTuesday August 4th, 2009
Posted in Developer's Corner, Lua Scripts, Oxidizer Blog

It’s Oxidizer 0.5.9.4….

Now the timeline for Oxidizer I posted for Oxidzer 0.6 is well and truly wrong, its time for a new sneak preview.

Changes for 0.5.9.4 are…

  • Brand new interactive Lua Console.
  • Update flam3.
  • Up and Down buttons for xforms.
  • XForms should now consistently order from 1.
  • Xform order should start from one when deleting / adding new xforms.
  • Fix for tree selection when driven from xform table, wasn’t setting current xform.
  • Fix preview quality when not limiting the quality.

I’ll try an knock up a sensible begginers guide to the Interactive console but its Lua witha couple of specific Oxidzer function calls.

So, open the console and in the bottom window type…

print “hello world”

and the console should print

> hello world

The Oxidizer specific function calls are..

To pass genomes from oxidizer into Lua

genomes = oxidizer_api:passGenomesToLua()

To append / replace the genome created / modified in  lua

oxidizer_api:appendGenomesFromLua(“genomes“)
oxidizer_api:replaceWithGenomesFromLua(“genomes“)

Notice that you pass the name of the Lua table holding the genome back to oxidizer, not the genome table itself.

So for a small example, starting with one genome in oxidizer…

g = oxidizer_api:passGenomesToLua()
g[1].time = 10
oxidizer_api:appendGenomesFromLua(“g”)

Will load the genome, set its time to 10 and then add the genome to the end of the existing genomes in oxidizer. Since there was only one genome in Oxidizer in the first place we’ve effectively copied it and set the copy to have a time of 10.

Okay, while I’ve been typing that up, the new version has finished uploading so have at it. It’s in the usual place.

Dave

Scripting Fractals for Oxidizer

by ralfSunday November 16th, 2008
Posted in Lua Scripts, Oxidizer Blog

This tutorial introduces Lua scripting for Oxidizer (>0.5.5), along with some hopefully useful (but not strictly required) peripherals. This text is intended for absolute beginners with no prior experience with Lua scripting, Xcode or the Terminal command line, although a modicum of familiarity with Oxidizer is assumed.

Oxidizer is a Mac OS X (10.4-10.5) software for generating fractal images and animations. From version 0.4, Lua scripting was added to Oxidizer. Two principal benefits of scripting are:

  1. Efficiency. Scripting can immensely simplify mechanical and repetitive tasks, like e.g. changing a genome parameter value sinusoidally over 200 frames for an animation. Or if you have a standard image/rendering setting that you often use, you can program it into a script instead of changing many parameters every time you want that setting.
  2. Capability. Did you know that Oxidizer has a color map rotator? A similarity-transform genome randomizer? Or a beat-syncing sequencer? Well with scripting it does.

Scripting is, in my opinion, one of the most powerful new meta-features of Oxidizer, because it is an enabling technology. It opens up possibilities for the user to be creative and invent tricks and methods the developer might not have thought of, or which would be too much work to program into Oxidizer as standard features.

Download tutorial. Includes PDF document, example scripts, genomes, and animations.

Lua Script » Randomizer

by ralfSunday February 3rd, 2008
Posted in Lua Scripts, Oxidizer Blog

It’s always a pleasure to learn something new; to be exposed to unexplored workflows and ideas — this is where the true beauty of any virtual community shines. Having had the past few days to toy around with this script I’ve gained insights into Oxidizer that may have gone otherwise untapped, I’m hoping that the same will be true for others. A big shout of thanks to ralf for generously sharing this one!

~Scott

The basic idea for this script is to batch create a large group flames directly in Oxidizer’s main window. By limiting certain parameters the script is able to generate flames much quicker than is typically achieved when using the ‘Gene Pool’.

Randomizer Images

A few notes about the script: it is very simple, although admittedly quite ugly (I had never programmed in Lua before Dave put this into Oxidizer). I basically just took Dave’s “create_genome_from_scratch.lua” script and wrapped a FOR-loop around it, so that it creates 100 genomes from scratch with randomized coefficients. You can change the number of genomes you want to have per batch (line 35, “nbat=100”).

Incidentally, that is roughly the frequency you can expect; out of 100 random draws, one or two might have some interesting aspects, and the rest are pure junk; of course this also depends on the settings. Some combinations of transforms are more likely to produce interesting results than others — this is what we’re exploring here.

In Lua, comments are started by a double hyphen (“–“), and you’ll see a lot of commented lines in the script that you don’t have to worry about. Currently the script only uses two Xforms and two variations per Xform, but you can easily expand that to use more of each. You can see parts of the commented code where I did exactly that, you can just uncomment or copy those parts.

The affine coefficients are randomized for each Xform, where I (somewhat arbitrarily) set the ranges to [-1.1,+1.1] for the first two pairs and [-0.5,+0.5] for the final coefficient pair. You can modify this of course to some setting that you might discover works better.

I also switched off the global symmetry (sym=”No Symmetry”), but you can include a random symmetry as well (uncomment line 61 and comment out line 62). The Xform weight and symmetry is randomized between [0,1], and you can modify this. For the variations, one has to pre-select which variations are to be included, then the script randomizes their weights to whatever range you like.

The current setting uses a cylinder-based combination (weights = +1 or -1), with some random spherical and sinusoidal thrown in. This is a bit like cooking. Try changing the variations and you get all kinds of funny creatures.

Finally, I don’t invoke any randomization on the post coefficients, since this more often than not has a tendency to destroy otherwise nice looking flames. Typically, I instead explore the effect of post-coefficient transforms *after* the script has produced a nice candidate that is ready to be tweaked. But it is simple enough to also randomize the post coefficients in the script if you want to.

I think that about covers it, let me know if you have questions. Happy randomizing!

Download Randomizer Lua Script.