• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# modelview and projection matrices

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

### #1kyewong  Members

Posted 19 November 2013 - 04:05 AM

Hi guys, I've got a tough problem regarding the modelview/projection matrix in opengl.

Say, I have a set of 3D points, and also their corresponding 2D screen positions, is it possible to solve for the optimal modelview (or the scale/rotation/translation) matrix which transforms all these 3D points to the 2D screen positions, when the projection matrix is fixed? or, is it possible to solve for such a projection matrix, when the modelview matrix is fixed?

### #2sgt_barnes  Members

Posted 19 November 2013 - 05:42 AM

Yes, that's possible in principle, but it's not simple.

Basically you just solve the resulting system of linear equations and you are done.

What makes this hard is that  the system may be massively over-determined.This means, that some equations contradict each other, so you have to find a way of resolving those contradictions.

Google for suitable algorithms, if unsure.

### #3kyewong  Members

Posted 19 November 2013 - 06:14 PM

Yes, that's possible in principle, but it's not simple.

Basically you just solve the resulting system of linear equations and you are done.

What makes this hard is that  the system may be massively over-determined.This means, that some equations contradict each other, so you have to find a way of resolving those contradictions.

Google for suitable algorithms, if unsure.

Yes, it may probably be a over-determined problem, that's the reason why I said "optimal". My question now is, whether it is simple to solve for such a modelview matrix (or the translation/rotation/scale matrix), or such a projection matrix? don't know if there's any prior attempts on solving this problem...

### #4sgt_barnes  Members

Posted 20 November 2013 - 03:27 AM

In photogrammetry, this is a pretty standard problem, so we can consider it solved. ;-)

But as I already said: It is not simple.

You can probably get away with a reasonably good approximation by doing the following:

1) Solve the equation system for each pair of projected and unprojected points. This yields a transformation matrix for each pair.

2) Choose a good one from these by projecting all the points with each matrix and pick the one that produces the least error.

### #5kyewong  Members

Posted 20 November 2013 - 07:17 PM

In photogrammetry, this is a pretty standard problem, so we can consider it solved. ;-)

But as I already said: It is not simple.

You can probably get away with a reasonably good approximation by doing the following:

1) Solve the equation system for each pair of projected and unprojected points. This yields a transformation matrix for each pair.

2) Choose a good one from these by projecting all the points with each matrix and pick the one that produces the least error.

Do you mean I should compute such a transformation matrix which is one part of the modelview matrix? If yes, then the projection matrix and factors should be considered fixed for this problem, it is right?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.