Lessons in programming, learning, and life

I spent some time playing with fractals after hearing Keith Peters lecture on chaos theory and reading through his Chaos-101 site. It’s amazing how some ostensibly arbitrary math can spit out psychedelic pictures. Tweak a few values, and you’ll get a whole new landscape.

Here’s a little Julia set renderer written with Pixel Bender. You can zoom, pan around, and tweak the values of the Julia set. It features a simple colorization scheme.

Unfortunately, it’s difficult to get this kernel to run in the Flash Player—the Pixel Bender implementation in the Flash Player is crippled, and doesn’t support for loops! That’s a shame, because most of the cool things that you’d want to do with Pixel Bender would require a for loop. The only hope would be to unroll the loop.

Here’s a small raytracer created with Adobe’s Pixel Bender. It supports ambient, diffuse, and specular lighting; shadows; and reflections. It’s even possible to do texturing by supplying another input to the shader.

Raytracers are easily parallelizable, so they are well-suited to shader languages like Pixel Bender. Unfortunately, the lack of indirection in these languages makes it difficult to render a variety of different shapes, so here I’m only rendering the cliche checkered plane with a set of spheres.

I think any hacker who reads Stephen Wolfram’s A New Kind of Science is immediately compelled to code some cellular automata—grids of cells which update based on a simple set of rules. Here’s my attempt at creating a cyclic cellular automaton in ActionScript 3. You can click the display to restart the pattern with a random color scheme and neighborhood function.