Looping Fractal Zooms

This concept came from seeing a perfectly looping animated GIF of a zoom into 2D fractal. While the animation really looped every few seconds, the self similarity of the fractal and the lack of an noticeable cuts produced the illusion that the zoom was going on forever.

This made me think about how I could use this technique with 3D ray marched fractals, and also the potential for generating other looping animations as well using ray marching (more to come!).


(GIF version: kifs_zoom.gif)

To achieve this effect I set up several different scaled copies of the same fractal positioned on top far corner of each other so that an animated camera zoom onto a particular spot of one would end with an identical image to the initial video frame. Then I just needed to make the animation loop for the infinite zoom effect.

What is kind of intriguing is that although the video is only 3 seconds long, if you follow a particular feature from when it appears it stays on screen about twice that long, since there’s really several copies of the same feature visible at once.

Here’s another variation of the same idea.


(GIF version: kifs_zoom2.gif)

You can view see the original two shaders in my Gallery on ShaderToy.

More Alien Vistas

Today I played around with a technique for combining different distance functions. It proved quite an effective way of producing interesting planet-like objects, among other things.

Here are a few variations I encountered through experimentation:

The middle panel looks like it would make a nice piece of album cover art.

Inventing On Principle Applied to Shader Editing

Recently I have been playing around with GLSL Sanbox (github), a what-you-see-is-what-you-get shader editor that runs in any WebGL capable browser (such as Firefox, Chrome and Safari). It gives you a transparent editor pane in the foreground and the resulting compiled fragment shader rendered behind it. Code is recompiled dynamically as the code changes. The latest version even has syntax and error highlighting, even bracket matching.

There have been a few other Webgl based shader editors like this in the past such as Shader Toy by Iñigo Quílez (aka IQ of Demo Scene group RGBA) and his more recent (though I believe unpublished) editor used in his fascinating live coding videos.

Finished compositions are published to a gallery with the source code attached, and can be ‘forked’ to create additional works. Generally the author will leave their twitter account name in the source code.

I have been trying to get to grips with some more advanced raycasting concepts, and being able to code something up in sandbox and see the effect of every change is immensely useful.

Below are a bunch of my GLSL sandbox creations (batman symbol added by @emackey):


    

    

GLSL Sandbox is just the latest example of the merit of software development tools that provide immediate feedback, and highlights the major advantages of scripting languages have over heavy compiled languages with long build and linking times that make experimentation costly and tedious. Inventing on Principle, a presentation by Bret Victor, is a great introduction to this topic.

I would really like a save draft button that saves shaders locally so I have some place to save things that are a work in progress, I might have to look at how I can add this.

Raycasting Planets

Some images of a planet render I made a while ago:


    

The scene is drawn inside a fragment shader. The clouds and nebulars are raycast spheres textured with an IFS fractal function, also used to generate the terrain.

Remixing Distance Fields

Last year I got fairly obsessed with distance field raycasting and fractals. Recently a few developments in that field have rekindled my interest in the whole phenomenon.

Most of the people playing around with the Mandelbulb and it’s variants back in early 2010 were either mathematicians or graphics programmers, and while there were some technically impressive images and movies, they mostly weren’t that well composed in an artistic sense.

More recently the tools for creating these fractals have become popular amongst artists in on-line communities and some really amazing work is being produced. MandelBulb 3D seems to have become the most popular piece of software used to compose fractal images and movies.

Perhaps the single best feature of this program is the ability to shares the settings of your images by copy pasting a twitter-eque short string of hieroglyphics to other people online. Often people attach these settings as a comment on their image, so other people can reproduce these works or ‘remix’ them for their own creations. I’m particularly found of pieces by Hal Tenny like this. His pictures are inspired by a earlier image named ‘Spudsville‘ created by lenord that included the parameters used in the image, allowing spin off works to happen.

I’ve been working away on a new fractal explorer application of my own. I’ve experimented with various optimizations to the conventional GPU ray casting techniques and I think I’m making some progress.

These images are of the fairly new Kaleidoscopic IFS fractal published by Knighty on Fractal Forums composed with the application I’m working on:


    

Show Your True Colours

This last week saw the release of fairly significant update to Gource – replacing the out dated, 3DFX-era rendering code, with something a bit more modern, utilizing more recent OpenGL features like GLSL pixel shaders and VBOs.

A lot of the improvements are under the hood, but the first thing you’ll probably notice is the elimination of banding artifacts in Bloom, the illuminated fog Gource places around directories. This effect is pretty tough on the ‘colour space’ of so called Truecolor, the maximum colour depth on consumer monitors and display devices, which provides 256 different shades of grey to play with.

When you render a gradient across the screen, there are 3 or 4 times more pixels than there are shades of each colour, producing visible ‘bands’ of the same shade. If multiple gradients like this get blended together, as happens with bloom, you simply run out of ‘in between’ colours and the issue becomes more exaggerated, as seen below (contrast adjusted for emphasis):

        

Those aren’t compression artifacts you’re seeing!

Gource now uses colour diffusion to combat this problem. Instead of sampling the exact gradient of bloom for the distance of a pixel from the centre of a directory, we take a fuzzy sample in that vicinity instead. When zoomed in, you can see the picture is now slightly noisy, but the banding is completely eliminated. Viewed at the intended resolution, you can’t really see the trickery going on – in fact the effect even seems somewhat more natural, a bit closer to how light bouncing off particles of mist would actually behave.

        

The other improvement is speed – everything is now drawn with VBOs, large batches of objects geometry passed to the GPU in as few shipments as possible, eliminating CPU and IO bottle necks. Shadows cast by files and users are now done in a second pass on GPU using the same geometry as used for the lit pass – making them really cheap compared to before when we effectively wore the cost of having to draw the whole scene twice.

Text is now drawn in single pass, including shadows, using some fragment shader magic (take two samples of the font texture, offset by 1-by-1 pixels, blend appropriately). Given the ridiculous amount of file, user and directory names Gource draws at once with some projects (Linux Kernel Git import commit, I’m looking at you), doing half as much work there makes a big difference.

New Zealand Open Source Awards

I discovered today that Gource is a finalist in the Contributor category for the NZOSA awards. Exciting stuff! A full list of nominations is here.

I’m currently taking a working holiday to make some progress on a short film presentation of Gource for the Onward!.

Update: here’s the video presented at Onward!:

Craig Anslow presented the video on my behalf (thanks again Craig!), and we did a short Q/A over Skype afterwards. The music in the video is Aksjomat przemijania (Axiom of going by) by Dieter Werner. I suggest checking out his other work!

Life is Strange

Here is my tribute to a fascinating new fractal I talked about in an earlier post, the Mandelbulb.

(Youtube: http://www.youtube.com/watch?v=W3x4uJJqs_w)

The music in the video is ‘Life is strange (trance remix)’ by darkangell.

I recorded the scenes using my work in progress Mandelbulb Viewer/Fly through builder application (which is on my github, if you’re curious). While working on this video, I added a few new effects like glow and fog, and also a periodic ‘beat’ to synchronize some effects to music.

As I mentioned before, the viewer is based on a fragment shader implementation of the Mandelbulb fractal by Tom Beddard. His blog has a lot of nice renderings also.

Ray-tracing is a tedious process, who knew? Normally capturing video in real or close to real time is something that I just take for granted. For this video, capturing a 20 second fly over (about enough for one shot in the final video) took around 30 minutes to render.

The rendering lag became slightly more manageable after implemented recording/config file support in the viewer, so I could go back and tweak the settings of a previous recordings that didn’t quite make the cut, and try again. I also got into the habit of testing the recording at low quality at 640×360 (1/4 720p, same aspect ratio), to get a feel for how it would look in motion at the right frame rate.

Vimeo: http://vimeo.com/10740680

Update: I wasn’t very happy with the contrast levels of the original video, so I decided to re-upload it and ended up re-editing it. Feels a lot more coherent now.

Update II: ‘Life is Strange’ received second place is the Fractalforums.com Spring 2010 Competition. You can see the full set of video entries here.

New Logstalgia Released

I’ve just released a new version of Logstalgia, my website access log visualization that looks a bit like Pong if only it had been created by Jeff Minter. Logstalgia is also referred to as ApachePong (referring to both the Apache Web Server and Pong) which is a much better name, but also covered by multiple trademarks.

Here’s a new video to go with it.

The song is ‘Depart’ by Tekno Eddy, which I found on ccmixter.org, which is a good place to find Creative Commons music that people actually want you to use (with attribution) in your Youtube videos.

The new version of Logstalgia adds a bunch of features back-ported from Gource, like being able to seek to a point in the log file, and the much needed PPM output support for making videos that was probably the biggest feature missing originally.

Go get it!

Linux.Conf.Au 2010

Last week I attended Linux Conf Australia, the annual conference for all things Open Source down under, this year held in Wellington, New Zealand, the city where I live.

I was very lucky to get the opportunity to organize some of the displays at the conference. An application developed for the conference displayed information such as timetables for talks, social events and photos taken by the attendees. It also showed off my latest visualization, Gource, displaying bits of random development from projects like the Linux Kernel.

Here’s a video of the displays I made for the conference.

The Life Flight Trust, the emergency helicopter rescue service for the Wellington area, was the featured charity of the conference. Attendees were encouraged to make donations, with the reward that the largest donor would be able to participate in a helicopter winching exercise. I was asked if I could come up with a way to display the donations, and ended up adapting a live graph prototype we’d developed at work (inspired by ‘Stack’ from Digg Labs).

We displayed the live donation feed during the Pengion Dinner, a dinner for professional delegates on the last day of the conference. By the end of the evening, LCA delegates had raised more than $30,000 for the Life Flight Trust!

Helping out with the conference was a really cool experience and totally worth all the time I invested. Be sure to check videos of the talks from LCA which should start appearing on their website tentatively.