Computer Graphics and Multimedia Software - Knowledge Sharing

Showing posts with label VRML. Show all posts
Showing posts with label VRML. Show all posts

Tuesday, December 14, 2010

How to import VRML model in ARToolkit

Each pattern is associated with an image.
The mapping between pattern and image is found in
C:\ARToolkit\bin\data\vrml_data for simpleVRML.exe program
and C:\ARToolkit\bin\data\multi_vrml_data for the multiVRML.exe program.


For the simpleVRML.exe program, the patterns to be recognized and their associated models are specified in the Data/vrml_data file. In this file you will see a set of lines like this:

#pattern 1
VRML Wrl/bud_B.dat
Data/patt.hiro
80.0 0.0 0.0

In order to import your own model you will have to follow this pattern (Using your_file as example name):

1. Copy your_file.wrl into the Wrl directory

2. Make a your_file.dat file and associate it with your_file.wrl by typing Wrl/ your_file.wrl on the first line. (You may take a copy of one the existing .dat files and edit it to fit your wrl file). Place it in the Wrl directory.

3. Make a new marker (Se section 3.2) or use one that is not yet in use.

4. Edit the Data/vrml_data file by adding a new paragraph:
#pattern 3
VRML Wrl/ your_file.dat
Data/patt.sample1 -- Alternatively your new marker (See on How to make your own marker) 80.0
0.0 0.0

Start the simpleVRML.exe program. When the camera recognizes the pattern associated with your model, the model will be loaded and rendered.


Share:

How to generate marker

Marker





In order to create your own markers you have to start with a new blank rectangle. To make it simple you can use the blankPatt.gif (Picture 5) located in the patterns folder of the ARToolKit installation.

The next thing you have to do is start the mk_patt.exe file located in the bin folder. The file requires an input for the camera. You can use "data/camera_para.dat". This is the default setting for the camera.

Position the camera right over the marker. You should be able to see a red and green square around the pattern. This means that ARToolKit has found your marker. Rotate the camera until the red corner is in the upper left (Picture 7).

How to create Marker Using ARToolkit

In order to capture the marker, we must run an executable that is included in the software library. Make sure your camera is plugged in!

1. The file, mk_patt.exe, can be located in the ARToolKit\bin directory


2. Double click the mk_patt.exe, screen below will appear.


3. Attach the camera to detect your pattern of marker.


4. Enter your pattern name. For example patt.aku


5. Press Enter to saved the pattern.


6. Once you have created the pattern file using the mk_patt executable, copy the pattern file into the ARToolKit\bin\Data directory. This is important as the pattern files are accessed in this directory.



7. Once the pattern file has been copied, you will then need to edit the object_data_vrml file in the ARToolKit\bin\Data directory. Right click the object_data_vrml file and open it in WordPad.



8. The file required . dat file. Next you will learn how to create .dat file


How to create file .dat

Once you have the file in this directory, you will need to create a .dat file that is required from the toolkit. To create the .dat file, right click any empty space in the ARToolKit\bin\Wrl directory. Select New Text Document when the menu appears. Rename this document file to nameOfModel.dat. In our example, we have named it pasu.dat


In the .dat file you will specify the model file and the translation, rotation, and scale parameters.



Using your favourite 3D modelling program, export the model or animation into a .WRL file. If you are using any textures for your model, have the path of the texture set to “./textures/nameOfTexture.gif”. One thing to note is that ARToolKit only supports .GIF formats. Make sure your texture file is in gif format before you export the model!
Once you have the 3D model exported, copy it into the ARToolKit\bin\Wrl directory.

Model yang support
- Obj
- WRL // untuk VRML
Convert your model kepada WRL atau OBJ jika model itu format .3ds, .stl, .max, .dxf and so on

Save this file and run the SimpleVRML executable. Your model should now display on your
custom marker!

Share:

Malaysia Augmented Reality

Its incredibly difficult to discover the undiscovered. Here will see how I can help you. Cheers - Ajune (comp.utm.my/ajune)
ajune@utm.my. Powered by Blogger.