[processing width=”500″ height=”500″ file=”http://benvancitters.com/wp-content/uploads/2011/05/hairdryer.jar” method=”onclick”][/processing]
I’ve been pretty busy lately working a new job with Amazon.com and doing some audio-visual stuff for a concert tour with Christian Peterson from the design studio Dumb Eyes and I haven’t had much time to update my site. Today, however, I finally got around to making my hairdryer sim. It’s an idea that I had when I first got started working on my “Grass” program last year.
Both programs make use of a lot of the same code. The grass blades are just slightly altered versions of the hairs in this program.
I have a new program to illustrate a concept I have been using to make periodic, highly variable and continuous variations in programming entities called classes.
[processing width=”600″ height=”200″ file=”http://benvancitters.com/wp-content/uploads/2011/03/waves.jar” method=”onclick”][/processing]
This program takes input from the mouse, the farther to the right the cursor is, the more waves are added together in each band of color and the farther towards the bottom the mouse is the more line segments are used to draw the wave.
The waves across the screen are a compilation of sine and cosine waves with varying amplitudes, offsets, and frequencies. I’m working on building a class that allows simple control of the result of such a complicated series and composition of functions to be used in further programs.
This project started as attempt to make a random looking surface normal generator, but that will have to wait for another day. What you see here are sine waves applied to the colors red green and blue animating against one another. If you move the mouse up and down on the image the width of the bands of color will change and if you move the mouse right and left the speed they move changes.
[processing width=”600″ height=”400″ file=”http://benvancitters.com/wp-content/uploads/2011/03/ripps.jar” method=”onclick”][/processing]
Processing, the programming language I wrote this in, has a special way you can get at the individual pixels in an image which in a case like mine is pretty ideal. The only problem that I have with that is the access to each pixel is sequential. So, I decided to ‘thread’ this to make it faster, approximately 2x faster on my machine. Since each pixel is independent of all the other pixels on the screen ideally we could find all of the numbers at once instead of one after another. Inside the computer each processor can only perform one operation at a time however, so in reality you will only see a noticeable framerate increase if your computer has more than one processor.