I am messing around with some augmented reality library, which I have working. Now, I don't actually plan to use it for augmented reality, but rather to help me track markers.
Now, the output of the library algorithm is a transformation matrix. What I really need, is screen coordinates.
Now, my question is this:
Given my transformation (World) matrix, my View matrix, my Projection matrix and the Vector3 that is the position of my model, can I get the screen coordinates?
I tried:
Vector3.Transform(Positon, World*Projection*View), but that leaves me with another Vector3.
I'm a but lost here, so any advice you can give is appreciated.
On a second note, should I be using a different library for this? (as in: not an augmented reality library)
I want to create a board game where a projector projects the board and a webcam tracks the pieces. So basically, I just want a plane in 3D space. (I cannot be certain that the webcam and the projector are perfectly aligned*)
*some would even argue that it is a physical impossibility.
World, View and Projection
You don't mention what API you're using. For C#, you can use Project(viewport,projection,view,world). In DX (C++), D3DXVec3Project(...).
The vector returned has x & y values as screen coordinates (floats which can be converted to integers). The z value is a normalized depth (and can be ignored if you don't need it).
The vector returned has x & y values as screen coordinates (floats which can be converted to integers). The z value is a normalized depth (and can be ignored if you don't need it).
Quote:Original post by chucaraThat is the correct approach, though I expect that you need to change the order in which you multiply the matrices.
I tried:
Vector3.Transform(Positon, World*Projection*View), but that leaves me with another Vector3.
The x and y coordinates of the result will be screen-space x and y, while the z coordinate will be the depth into the scene. You can safely ignore the z component, and just use x, y as a point in screen coordinates.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement