Friday 30 March 2012

3-channel Game of Life shader

Following on from yesterday's post I decided to act on my own suggestion and make a 3-channel version of the Game of Life shader. The result is here on Wonderfl and embedded below, with the full shader code as a comment at the end of the source on Wonderfl.

Thursday 29 March 2012

Game of Life shader

This is another simple and quick shader, this time done to see how easy it would be to implement Conway's Game of Life after seeing the same logic implemented using filters. It's an ideal fit for shaders not only as the code that runs on each pixel is identical but also as the 'game' is essentially a graphics algorithm. Turned out to be every straightforward, taking only an hour to write, test and deploy here at Wonderfl.

Wednesday 28 March 2012

Practical optimisation

While browsing on Wonderfl to see how my cross product shader was doing I came across someone else's code, the evocatively named "forked from: flash on 2012-3-23". Running it I noticed it was slow: it was not doing much but got slower and used more CPU as it ran. So I decided to look into it.

Tuesday 27 March 2012

Cross product shader

This is something I did to try out the mathematical functions in Pixel Bender's shader language. I also wanted to work out how to upload an image to Wonderfl, and upload another more interesting shader example to there. Seeing how its turned out I can't imagine using in game though with a bit of work it could produce some interesting effects which might be useful.

Monday 26 March 2012

Radial gradient fill

I first tried using gradient fills (via the beginGradientFill method of the Graphics class) in Bug Tunnel Defense. I wanted to use them for shading along the tunnels but could never get them to work, and eventually did it the long way by drawing a series of differently coloured rectangles. The problem was the createGradientBox Matrix function, which no matter what I passed to it would never return the right matrix for a linear fill.