Ginger Binger

Lessons in programming, learning, and life

Julia Set Fractal With Pixel Bender

| Comments

This project was originally posted on my Newgrounds.com blog on October 1, 2008.

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 the source (requires the Pixel Bender Toolkit):

Pixel Bender Raytracer

| Comments

This project was originally posted on my Newgrounds.com blog on July 22, 2008.

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.

Here’s the source (requires the Pixel Bender Toolkit):

ActionScript 3 Cyclic Cellular Automata

| Comments

This project was originally posted on my Newgrounds.com blog on February 26, 2008.

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.

Click here to download the source.

Reminds me of those early 90s screensavers. :)

This was programmed for Flash Player 9. The release of Flash Player 10 introduced Pixel Bender, which could be used for a parallel implementation of cellular automata. Take a look at Daniel Rinehart’s version of Conway’s Game of Life using Pixel Bender. Also, check out this cool implementation using simple BitmapData functions by Alistair Macdonald.