Jump to content
  • Advertisement
Sign in to follow this  
kyewong

OpenGL modelview and projection matrices

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

 

Thank you and waiting for your answer(any suggestions or useful links are welcome!!)

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!