In good "Distilled" fashion, I'll support Pauls explanation, but would like to provde a couple more pieces of information that might help expound a little.
During the transform stage in the graphics pipeline, vertecies are actually transformed by a concatenation of the Projection, Model and View matrices. (Note that I'm dividing the modelview matrix into two: Model and View). As Paul says, the definition of the viewing frustum is contained in the Projection matrix.
The View matrix, however, with a small correction to Paul's answer, moves the world to the eye point. In OpenGL we never really "move a camera", though it is convenient to think in these abstractions. In fact, a View matrix consisting of translations and rotations that would "place the camera in the world" needs to be inverted.
The Model matrix is what is used to move objects from Model coordinate space to world coordinate space.
One other small correction to Paul's email (and looking on page 77 of his book, I know he meant what I'm about to say), NDC (normalized device coordinates) occur after the Projection transformation AND the perspective devide. That is, coordinates X and Y coordinates are divided by W (a normalized version of Z) to come up with coordinates that lie in the range -1 - 1, -1 - 1, -1, - 1. Finally, these are transformed to window coordinates.
Interestingly, OpenGL refers to the ModelView matrix as a concatenation between Model and View matrices. It could, in fact, simply concatenate all of them and transform vertices by a ProjectionModelView matrix. (Often you use this very matrix in shaders). However, because lighting must computed between the Projection and ModelView stages, there are two matrices instead of one.
-don
On 11/1/06, Paul Martz <[EMAIL PROTECTED]> wrote:
Shameless plug: You might consider buying the book "OpenGL Distilled"
(http://www.opengldistilled.com).
The projection matrix defines the size and shape of the view frustum, but
doesn't control its (world coordinate) location or orientation.
The modelview matrix is responsible for positioning and orienting the camera
in the scene, and therefore by implication, it positions and orients the
view frustum in the scene. Another way to look at it is that the modelview
matrix places within the view volume the parts of the scene to be viewed.
Incoming vertices are multiplied by the modelview matrix, then by the
projection matrix. The result is normalized device coordinates in the range
-1 to 1 in XYZW. Again I'll mention "OpenGL Distilled", which I believe does
a pretty decent job of covering OpenGL coordinate transformations.
-Paul
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto: [EMAIL PROTECTED]] On Behalf Of
> Jean-Sebastien Guay
> Sent: Wednesday, November 01, 2006 8:17 AM
> To: osg users
> Subject: [osg-users] ModelView matrix math explanation
>
> Hello,
>
> A bit unrelated to OSG, but still in graphics... Does anyone
> have a good reference to the relationship between the
> ModelView matrix, the Perspective matrix and the view frustum?
>
> I remember that it's something like multiplying an object's
> vertices by the ModelView matrix brings them in the range
> [-1,1] for each axis, or something like that, but I can never
> remember. I seem to remember finding a website on the subject
> a while back, but I can't find anything now.
>
> The general goal is to transform a ray the same way as OpenGL
> transforms vertices, so that I can make a raytraced picture
> that corresponds to the realtime OpenGL rendering. I just
> can't seem to remember the details!
>
> Thanks,
>
> J-S
> --
> ______________________________________________________
> Jean-Sebastien Guay [EMAIL PROTECTED]
> http://whitestar02.webhop.org/
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
