Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm using ARToolkit to do an augmented reality application, but my problem is really with the 3D coordinates.

In this application, I use my webcam to generate the scene. I have two markers (printed - they have a thick black border with a letter inside to signify which object is to be drawn), and when the ARtoolkit framework recognizes the object, it will draw a specific OpenGL object on top of the marker in real time.

So onto the actual problem.

The first marker I consider to be my world coordinates, and the second to be a floating object that I will move around the scene.

The overall problem is that when I translate my secondary object to my world coordinate system, the Z-value is typically way off from what it should be, and I'm not sure how to rectify this (this is really my first foray into 3D programming).

As a note, I get the OpenGL 1x16 matrix in from the ARToolkit, using the recognized marker as (0,0,0).

First, I take the world coordinate system marker, store it into a 4x4 matrix, and then create a variable to hold its affine inverse (I am using a framework to do this part, so I don't think it is anything I'm doing here).

Next, I take the secondary marker and store that into a 4x4 matrix.

Finally, to move the secondary marker into the world coordinate system, I multiply them in-order, together, as such:

new_coords = world_coords_affine * secondary_coords

For my understanding, this should take the secondary object and move it to the world coordinates, so that I can simply draw it based on the new x, y and z values.

As I mentioned however, the Z coordinate is far greater than it should be. I am drawing my scene typically at about (0, 0, 50) to hide the markers in the scene, and the secondary object tends to have Z-coordinates in the thousands when it is debugged. For reference, I am actually putting the two markers directly next to each other, so really there should only be an X-offset (which I am seeing at least).

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Are your values normalized? It would cause that kind of problem.

share|improve this answer
    
rookie mistake, good call. i thank you, kind sir, for the time you put into thinking about this problem –  espais Apr 26 '12 at 15:07
    
hmm, so when i normalize it seems that i'm still within the old coordinate system –  espais Apr 26 '12 at 16:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.