Need help with Augmented Reality and Matrix Projections

Hi all. I’m working on an augmented reality project and have hit a little snag.
In my mind, this problem is very easy, but for some reason I can’t seem to get it
to work. I’ll explain below. I should also say that even though I am familiar with
matrix math and understand the basics, i’m not exactly a matrix guru.

I’m tracking multiple markers, where one marker will act as a “ground” plane, and
the others as objects on that plane. If you point the marker towards the camera,
the marker has +z looking at the camera. All of the 3d objects are in one container
that sits on (0, 0, 0) and is not rotated, so it’s an identity.

What i’m trying to do is take all markers except ground, and project them onto
ground plane. Let’s say the ground is a flat grid, I want my objects to sit on
this grid, have the same up-vector and retain the z-axis rotation around
their own axis.

I’ve tried searching all 3d math resources as well as google, but all I get is
stuff about projection matrices to screen coordinates.

I though it would be a simple solution of taking the inverse of ground and
multiplying with the object matrix, and setting the z translation to 0 (up) so
that the object would sit on the ground with some additions for rotation, but it
does not seem to work out at all. I’ve fiddled with this for hours and hours now
without a solution and it’s slowly driving me crazy.

I hope this explanation makes sense, any help is highly welcome and appreciated.

Thanks in advance.

  • Edvin

you dont have to take the inverse.- Think of the groundPlane Matrix as your world Matrix. Then you should be done by simply multiplying your groundPlane Matrix with the Transformation Matrix of the other objects.