Homework2W13
Contents |
Homework Assignment 2: ARToolkit
For this assignment you can obtain 100 points, plus up to 10 points for optional work.
The goal of this project is to add inexpensive, but true 3D interaction to your application from homework project 1. You will use the ARToolkit API to allow positioning and orienting the pan with a hand-held ARToolkit marker. This project will require you to use a webcam, and to print out an ARToolkit marker on a piece of paper.
ARToolkit and osgART
You can choose to integrate the ARToolkit library directly into your application from homework project 1. There is excellent documentation on the ARToolkit web site. You could start by running their demo applications.
You might find these specific instructions for how to install ARToolkit on Windows 7 with Visual Studio 2010 useful.
The other alternative is to use osgART: The HITLab in New Zealand has already integrated the ARToolkit API with OpenSceneGraph. Download osgART and integrate it into your version of Visual Studio. Unfortunately, osgART only comes with Visual Studio 2005 project files, so they will have to be converted to your version of Visual Studio.
Webcam
Next you will need to get access to a webcam. You can either use your own, which can be an USB-connected device, or a camera built into your laptop. As long as it acts like a webcam in other Windows applications, it will work with ARToolkit. If you don't have your own webcam, the instructor is going to loan you one for the duration of the project.
Build a Marker (10 Points)
ARToolkit works by tracking markers printed on paper. For this project, you will need to print at least one marker. Find out where to find a marker image to print, which your ARToolkit library will recognize. Glue the marker to a piece of cardboard, so that it is easier to hold it without deforming it. When the marker deforms, it will be harder or impossible for the tracking algorithm to recognize it. You might want to leave a generous border around it so that you can hold it without occluding the marker with your hand.
Control the Pan with ARToolkit (50 Points)
Once you have a marker which can be tracked with your webcam, you are ready to move the pan. Experiment with the placement of your webcam (or the angle of your laptop screen if your camera is built-in) to find a good camera placement so that it can see the marker when you hold and move it.
Your goal is to map the marker movements to movements of the pan in your kitchen scene. Find a good transformation to transform the marker coordinates and orientation to kitchen coordinates. You will need to be able to move the pan from the countertop under the open cabinet all the way into the cabinet. If your kitchen is relatively small, add OSG's mouse interaction routines and zoom into the kitchen until you can easily see the pan and the cabinets around it.
Collision Detection (40 Points)
Whereas in the first homework project, you were allowed to move pot and pan through cabinet walls, this time you need to implement collision detection. Use OpenSceneGraph's intersection handling routines to detect when the pan intersects with a cabinet. When an intersection happens, paint the pan yellow and stop its motion until the user moves it away from the blocking surface.
In order to use OSG's IntersectVisitor, you will have to approximate the pan with line segments. Using three such segments will suffice: one along each coordinate axis, through the center of the pan, across the length of the pan in each axis.
To make the pan yellow, write a NodeVisitor which you pass a copy of the pan and which will set the colors of all polygons to yellow and remove all textures.
Grading
On the due date, you will need to demonstrate that, using an ARToolkit marker as your input device, you can move the pan into the cabinet without going through cabinet walls.
Extra Credit (10 Points)
Modify your application so that it supports two (different) ARToolkit markers, so that you can independently move the pot and the pan around the kitchen.
Notes
If you don't like the pan and the pot, feel free to use other household items you find in a 3D model data base, or design your own with a 3D modeling tool. If you use Google Sketchup and need to export to VRML, which the free version won't do, send the .skp file to the instructor and he will send you back the corresponding VRML file.