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.
[processing width=”600″ height=”400″ file=”http://benvancitters.com/wp-content/uploads/2011/03/treez.jar” method=”onclick”][/processing]
This was originally a screensaver I wrote for my mother’s birthday in VB6. This version is written in Processing, but you don’t need to know that to enjoy it.
People always ask me if it’s random to which I never am completely sure how to answer. The answer is that all the apparent randomness is based on pseudo-random numbers generated by Java. But that isn’t the end of the story either. Some “trees” still seem to grow differently than others… The reason is that every time a new tree is started it gets a new, “random” set of parameters such as what color it is, how bendy it is, how fast it grows and how often it sprouts new branches. When the root of the tree branches these parameters are then passed to it’s ‘child’ but they aren’t copied exactly, only approximately so the tree “evolves” as is grows.
One of my favorite Processing apps I’ve written is this one I affectionately call ‘Grass’. I try not to explain these apps too much because I think it’s natural for the viewer to make sense of my programs in whatever way they like, but I’ll make an exception in this case. In one way or another this app is inspired by long summer evenings at Greenlake in Seattle where I lived for two years.
[processing width=”600″ height=”300″ file=”http://benvancitters.com/wp-content/uploads/2011/03/microGrass.jar” method=”onclick”][/processing]
Once the program is loaded you can move the mouse to control the ‘wind’ blowing over the scene.
In my opinion, there are some pretty interesting things going on under the hood of this app. For starters, the background gradient is procedurally generated by the technique used in my ‘Bezier Gradient’ app. The strands of grass are neat too. They are drawn as a series of triangles deformed along a ‘spine’. I coded up the physics of the spine myself as well and they’re pretty extensible; hopefully soon I’ll get around to doing my hairdryer program to show them off in more glory ;).
The fireflies (which I should mention don’t actually live anywhere near Seattle) are simulated with a very long parameterized sinusoidal series which I wrote myself that allows me to control how fast and far they can move each frame as well as how convoluted their path is.