coder9
coder9

Reputation: 1549

3D model manipulation for a Desktop Augmented Reality application

I'm working on an Augmented Reality project that uses multiple markers to get positions for 3D models that I'm planning to overlay. (I'm doing this from scratch using OpenCV and I'm not using ARToolkit or any other off the shelf marker detection libraries).

Environment: Visual C++ 2008, Windows 7, Core2Duo 1GB ram, OpenCV 2.3

I want the 3D models to be manipulated by user so it will turn out to a sort of simulation.

For this I'm planning to use OpenGL. What are your suggestions, recommendations? Can the simulation part be done by using OpenGL itself or will i need to use something like OpenSceneGraph/ODE/Unity 3D/Ogre 3D?

This is for an academic project so better if I can produce more self-coded system rather than using off-the-shelf products.

Upvotes: 2

Views: 1029

Answers (1)

the swine
the swine

Reputation: 11031

it would seem that OpenGL is pretty enough for your needs (drawing a model with a specific colour and size).

If you're new to OpenGL, and you are not going to be using it for your future projects, it might be easier to use the old fixed-function pipeline, which already has the lighting and color system ready and doesn't require you to learn how to write shaders.

For your project, you will need a texture where you would copy the image from camera using glTexSubImage2D() which you would in turn draw to background (or you can use glDrawPixels() in case you don't require any scaling). After that, you need to have your model, complete with normals for lighting. Models can be eg. exported from Blender or 3DS Max to ascii format, which is pretty easy to parse. Then you can draw the model. Colors can be changed using glColor3f() before drawing the model (make sure you don't specify different color while drawing the model). Positioning of the models is done using matrices. The old OpenGL have some handy and easy-to-use functions for rotating and translating objects. There are also functions for scaling the objects (changing size), so that is covered pretty easy. All you need is to figure out camera position, relative to the marker (which i believe is implemented in OpenCV).

If you were to use the forward-compatible OpenGL, you would need to set up vertex buffer objects to contain model data and write vertex and fragment shaders to shade and display your model. That's kinda more work for which you get extended flexibility. But you can use shaders in the old OpenGL as well, if you decide you need them (eg. for some special effects).

Learning how to use a scenegraph or an engine (ogre) can take some time, i would not recommend it for your task.

Upvotes: 2

Related Questions