Re: Project and unProject

Re: Project and unProject

howie's responce is no where near what it takes to project a point in 3D space. for one thing, it does not take into account parallel projections.

The process of projecting a point is very complex. The red book MIGHT have it (though I don't recall it), I doubt the blue book has it, as that is just documentation on the ogl functions.

Pickup a copy (it's expensive though) of "Computer Graphics: Principles and Practice" by Foley, Va Dam, Feiner, and Hughes. It will have all of what you need, practically for anything related to graphics (unless it's something uber-new). I don't really think I can explain all of what you have to do in order to project a point.

However, once you figure out how to project a point, unprojecting it is easy. You just find the inverse of the projection matrix and use THAT matrix to "project" your point.

Re: Project and unProject

The code above assumes the point has been translated by your matrix. Before you project a point, say on a quad or a try, you have to clip all the points to the near Z plain. But that was not part of his question.

He asked how to project a point, and that's how I do it. Perhaps there's more then one way to do it, but that's how I do it.