Goodbye Jamario Moon and Hello FlarToolkit/Flash Augmented Reality Papervision3D

With Jamario Moon being dealt away to Miami just last week, it seems fitting that I revisit an old project Paper-Robo and resurrect Paper Jamario Moon.

I finally got a chance to sit down and play with FlarToolkit. For those unfamiliar, FlarToolkit is a open source library that allows you to manipulate 3D objects using a pattern (like QR codes), a webcam and Flash.

Thanks to Mikko Haapoja and Saqoosha for some awesome start up guides:

http://www.mikkoh.com/blog/?p=182

http://saqoosha.net/en/flartoolkit/start-up-guide/

I had to jump through some Flex hoops to get through some of the demo examples to work. Apparently you can only use the following syntax in Flex to embed binary files:

“[Embed(source=”../lib/mypattern.pat”, mimeType=”application/octet-stream”)]”

Since I haven’t used Flex before (I use FDT), I got around embedding these camera calibration and pattern binary files by using loaders. If you are using loaders, be sure to add MIME types on your server for .dat and .pat files. Other than that I didn’t change the original source code too much, other than replacing the basic cube primitive with a collada model. I also threw in some animated MD2 quake models (Boba Fett and Starscream) for good measure.

Briefly to use this library you need two binary files, a calibration file “.dat” for a webcam and a pattern file “.pat” representing your printed pattern. You specify a desired accuracy, and using a detector class you can determine if the marker is FOV of the camera. If the marker is detected you add whatever 3D object you want to a Flarbasenode, which is a Papervision3D Display Object. The Flarbasenode can then be translated/rotated using information from the detector class.

Try it yourself:

Download and print pattern

 

Test the application here (Webcam required)

 

Here is some sample code and other resources to jump start your Augmented Reality project:

Here’s a good repo of free animated MD2 models Project:

http://polycount.com/models/quake2/

Sample Code:

http://www.mikkoh.com/blog/wp-content/uploads/2008/12/learningflartoolkit.zip

http://www.boffswana.com/news/wp-content/uploads/augmentedreality/AR_dev_source.zip

Air application to make binary marker files:

http://saqoosha.net/lab/FLARToolKit/MarkerGenerator/MakerGenerator.air