Monday 16 March 2009

The OPAQUE Filter

I haven't done anything on my website for a couple of months now, so with easter coming up I decided to make an easter edition of my Snappy card game. I did one for Christmas, so an easter one would be exactly the same only with different images. I needed some images of easter eggs and so Processing seemed like an ideal solution. It took me some hours to find a simple example I could work with but I finally tracked down a rotating textured globe in the processing forum. Many thanks to the author (doozer) for making the source code available!
3d Textured Globe
After some minor edits I changed the globe to a sphere and added in some chunk 16 images. I kachunked some files to make 4 backgrounds. The globe applet rotates on both axes so I disabled one. I am intending using the code to generate easter egg images so I didnt need the egg rotating vertically. The result looked really good, but the image was a bit transparent and the background was showing through and this was not what I needed for an easter egg image. Aha, I thought the OPAQUE filter would come in useful here. This was a real coincidence, as this is the final filter I need to describe here on the blog. I applied the opaque filter and it worked perfectly. A side effect was the sphere stopped rotating altogether but as I'm generating static images this proved to be no hardship. Now I have my images, I can place them in the Java snap game as card images.















Translucent Image
Same image with OPAQUE filter applied


To see the spinning egg, before the opaque filter was applied and to play the finished snap game visit here.

No comments:

Post a Comment