Augmented Reality
Recently Saqoosha’s port of ARToolkit from C to Flash has taken the Flash world by storm. The biggest hurdle for me was that the comments in the source were all in Japanese. That was until Mikko Haapoja published a getting started in FLARToolkit entry. Now we’re witnessing an onslaught of Augmented Reality projections available right in our browsers.
My initial experiments with the toolkit are really no different from anyone else’s. I had Neil send me a 3D model which we skinned and dropped into Papervision. Immediately the clients at work started to pay attention. But aside from seeing a thousand advertising campaigns six months from now all with their own 3D model that spins around, what can we do with this technology?
- Most computers outfitted with webcams have the camera’s targetted at the user’s face. This means the marker used to identify the placement of the model should be placed in that zone in order for a 3D model to appear. On my development system I’m using a PS2 Eyetoy, which is a camera on a USB cable enabling it to be moved around. In many user situations this will not be the case — so orient your models with the marker standing up.
- Through the input I’ve received markers with thin lines in them tend not to be recognized at long distances. This could be due to the resolution of my camera, but even with a high resolution web cam it will cause a problem at longer distances. Make your marker files bold without fine detail and they should work better in different environments (poor lighting, greater distance, oblique angles).
- Print your marker on card stock. If the marker bends it won’t register. I’ve found smaller markers won’t distort as much.
Now currently I’m working on adding some physics to the 3D scene. I’m using a mixture of Papervision and WOW-Engine. One of the difficulties I’m encountering is determining the rotation of the marker. From what I’ve determined, the Papervision camera is static. The camera is your eye which looks at the marker. As the marker changes orientation the camera does not move. Within FLARToolkit the scene includes a class named FLARBaseNode which extends DisplayObject3D. Tracing out rotationX/Y/Z results in 0/0/0 as the marker rotates. But what is shifting is the rotation matrix of the FLARBaseNode. So essentially if we wish to derive the rotationX/Y/Z we need to retrieve the Matrix3D of the FLARBaseNode and translate the coordinates back into degrees. From what I’ve been told, Papervision includes a static method Matrix3D.matrix2Euler() which should provide this data returning radians.
And I’ve been at this off and on for three days now but haven’t quite found the results I’m looking for. I’ll be sure to post more (plus examples) once I get everything working. In the meantime, this document does a brilliant job explaining Matrix3D.