# Projectors and Perspective Matrices

This topic is 2773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all,

I've been working on a game over the last week which uses a projector to project little cars onto a table. Then it uses the Kinect to sense stuff on the table, which it then turns into terrain for the game. The effect is really simple, and pretty cool! Here are some pics:

http://goo.gl/nsy1w

However, there is a visual problem with the projection perspective maths which I would really love to solve. If I understand correctly, the maths should be pretty simple for someone who knows how. :-)

In the pic below you can see that as the height of a virtual object in the scene increases (the vertex pos are written as y) then the more "compressed" it becomes due to the shrinking frustrum of the projector.

What I would like to do, is calculate a perspective matrix, takes account of this and ensures that vertices with a higher "y" value are projected in the right place given the frustrum of the projector. Unfortuanately, I lack the maths skills needed to ask properly, so I hope my picture will do instead!

Here is an annotated pic which shows the problem in the real world:

Any help you can give me on how to construct that perspective matrix would be very much appreciated!

Cheers!

John

##### Share on other sites
I have no idea but I have to comment on how awesome that is!

Haha cheers!

Any ideas folks?

John

##### Share on other sites
I don't think this is something you can fix just by choosing a proper perspective projection. This is because the surface you're projecting to isn't flat, and thus you need to need to account for the varying height at each different pixel that you render. I don't think it would be too hard to do with a fullscreen pass that calculates new UV's with an approach similar to parallax mapping, but I'll have to think about it some more to come up with an exact solution.

Really cool project, btw!

##### Share on other sites
I am not sure I understand what the problem is. Presumably your virtual scene contains the same ramps as you have in the real scene. You render from the point of view of the projector and then project. What part of this doesn't work?

##### Share on other sites
Maybe using OpenAR to recognize a special mark would possibly allow to obtain a transform matrix but as MJP noticed, doing this for arbitrary surfaces is going to be a quite a difficult problem.

For multiple flat surfaces, marking the edges might work, but the white paper sheet in the background... I'm fairly scared. And that requires all the marks to be visible.

##### Share on other sites
Thanks for the feedback. :-)

[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 9
• 11
• 15
• 21
• 26