Message In A Bottle

My first modern computer was an overpriced Compaq Presario I bought from Best Buy in 1999. Armed with AOL dial-up and Windows 98 I waded onto the internet and was amazed at what I found. So much stuff to explore! Eventually I stumbled on Linux and the rest is history, but before then I got hooked on Povray, a freely available ray-tracing program originally released in 1992. Povray can render a 2-D image by calculating the interaction of light and objects in a 3-D space. You control the lights and objects by using a scene language, then it interprets the results and generates an image file.

Povray is good old-school geeky fun. The scene language is unique but pretty easy to get the hang of. You can build entire scenes with nothing more than declarative statements, though execution flow control is supported by a pre-processor like syntax. Each scene needs at minimum a camera , a light source, and one or more things for light to bounce off of. Povray supports an incredible array of geometric primitives along with powerful textures. I have never created anything close to what the real experts can do, but I did have some fun recently putting together the WordPress themed “Message in a bottle” header image above.

Everything in this image except the bottle cork and the island/iceberg thing in the background are made using one of the geometric objects available in the scene language. For example the sky and water are actually endless planes placed above and below the camera set parallel to the horizon. The reason they look like sky and water is because of the texture properties applied to each. The bottle is a composite, built from a lathe object and several cylinders. The cork and iceberg are height field objects that use an image as input and scale the Y-Axis (height) to the lightness value of each pixel of input.


Exploded view of the bottle components


Just the sky and water planes

Scene without the bottles or clouds or water texture.

Just the sky, water, and land


Everything but the bottles and the clouds

png file used as input for the iceberg height field

png file used as input for the iceberg height field

Height field object rendered in Povray using the png input file

Height field object rendered in Povray using the png

png file used as input for the cork height field object

png file used as input for the cork height field object


Rendering of the cork height field object

Incidentally the first program I ever wrote was a Perl/TK monstrosity that wrapped a GUI around the CLI-only Linux version of Povray. All it really does is build the command arguments and shell out to run the renderer. The almost 1000 lines of code I wrote to do this could best be described as fractally wrong. As bad as the code is, it still works and I still use it :).

This really just scratches the surface of what Povray can do. If you are looking for a time-sucking hobby that will stress both your CPU and your brain, I highly recommend it. If you want to mess around with this scene you can download the source code and input png files here.