View this PageEdit this PageUploads to this PageVersions of this PageHomeRecent ChangesSearchHelp Guide

Tutorial 2 - Marker Tracking and 3D objects

Now that you have successfully set up the camera and tested the live camera in tutorial one, you can create your first augmented reality experience. In this tutorial you will learn to:

  • print physical markers (also called fiducials)
  • create an ObjectActor to be a 3D box
  • place the 3D box onto the physical marker in the background video feed
  • modify the properties on the 3D box (colors, textures, size)

If you download DART-tutorial-2.dir (25 KB) and play the application, you will see something like the image below. This tutorial shows how to setup this experience, working from the final .dir file provided in tutorial one.

Uploaded Image: t2-image4.jpg



Printing Fiducials

For applications that place objects onto special markers, one of the first things to do is print out physical markers. This type of augmented reality application is based largely on the ARToolkit from the HIT Lab at the University of Washington. DART users can utilize the square-based patterns provided with the installation or you may create your own markers. See the DART Documentation for more information on creating homemade fiducials and modifying the data directory.

For now, let’s assume you will use the pattern files and markers distributed with the DART installation. First, print out a few of the marker panels. They are located under “…\square-panel-pics\” in the Data directory of the DART installation and they look like this:

Uploaded Image: thumbnail-squares 01-06.jpg

Print a few of these markers on a standard black and white printer. Generally, each black box in the image is about 6.35 cm, but because of differences in printer dpi and software tools, the actual difference might vary. You should physically measure the printed marker and update the cooresponding .calib file. For example, if squares01-06.jpg prints six boxes that are all 6.37 cm on a side, then change squares01-06.calib. All the places the value 0.0635 appears should be changed to 0.0637. The file reference-squares01-06.jpg was created as a reference file to help you see the links between the image and the corresponding calibration file.

The square patterns on each image are based on the Boolean numbering system, where each black box is one number. There are calibration (.calib) files to correspond with each image. In DART, you will indicate which image you want to locate in the scene based on the name of the calibration file.

Hint: It helps to mount the marker panels on a solid board and to have good lighting conditions when looking for the markers in live video.


ObjectActor

One of the simplest applications that can be built in DART is moving a 3D model around on a physical marker. You must create an ObjectActor and give it the appropriate properties to create this effect.

First, first you need a container for the ObjectActor on the score. The DART distribution includes a cast member named Actors in the DART-Actors cast library. Drop this on the score underneath the loop you already created in Tutorial-1. Then find the ObjectActor behavior under DART-Actors and drag this on top of the Actors sprite you just put on the score. You should see the following dialog box:

Uploaded Image: t2-image2.jpg

ObjectActor Properties

The properties box for the ObjectActor determines the appearance and behavior of the object in the world. The designer can modify the fields in this properties window at any time by clicking on the gears symbol in the properties inspector.

Uploaded Image: t2-image3.jpg

To turn this ObjectActor into a cube that rests on top of a marker panel in the live video, set the properties to the following values:

  • Primitive: Box
  • Object position in Z: 3.17
  • Object X scale: 6.35
  • Object Y scale: 6.35
  • Object Z scale: 6.35
  • Link actor to: ARToolkit Fiducial
  • Link will update actor’s: Position and Rotation
  • If link is to ARToolkit Fiducials, select fiducial panel: squares_01-06

The ARToolkit centers the object at the (x,y,z) middle of the first square pattern in each panel. The positioning in Z is needed to keep the object on the surface of the sheet. The scale value in each dimension makes the box 6.35 cm square to correspond with the physical size of the black square. Make sure to link the ObjectActor’s rotation and position to an ARToolkit fiducial.


TimeAction

A TimeAction must be added to make the ObjectActor appear. Actions are DART abstractions that tell the application when something should start based on time, user intervention, or other cues. Drop a TimeAction onto the Actor you have already created. Keep the default properties, which is to start (or show) the actor starting at time 0.

Uploaded Image: t2-image5.jpg


MarkerTracking

You must set up the global marker tracking properties on the Cameras container you created in Tutorial 1. Find the MarkerTracking behavior under DART-Framework:

Uploaded Image: markerConfig.jpg
(MarkerTracking icon)

Drop this behavior onto the Cameras sprite on the score. You should get the following dialog box:

Uploaded Image: t2-image6.jpg

The default properties should work, but make sure the markerfile is in the Internal cast library. If the marker tracking does not work very well, you can come back to these properties and adjust the threshold value. Also adjust the lighting conditions in the physical space.

Running the Application

Now to test your application, make sure you first save the Director Movie, and then rewind the play head. Press play and make sure you get live video in the background. Next, point the camera at the physical markers you printed out earlier. You should see a gray box floating on top of the fiducial panel!

Go back to the ObjectActor properties and change some of the properties such as transparency, color, positioning, and scale and see what effect this has on the cube. Also, there are fields in the ObjectActor’s property window to add a texture to a primitive. This drop down list includes all bitmap images found in the Internal cast library.

Another option is to select a 3D model rather than a primitive. Uncheck the box “Would you like to create a primitive object?” and then select a 3D model to load. The drop down box for this option includes all shockwave3D files found in the Internal cast library. When you work with 3D models, the program used to create the model often uses completely different units. You may have to scale the object down (0.02, for example) to make the object a reasonable size.



Link to this Page

  • DART Tutorials last edited on 5 June 2004 at 5:50 pm by dhcp122.mobile.cc.gt.atl.ga.us