Advertisement

View Transformation

Started by March 07, 2001 10:52 AM
5 comments, last by Mr Cucumber 23 years, 11 months ago
Could someone please help me with the geometry pipeline. I am developing a software engine. I know that you should multiply the vertices that are in model space with the models matrix to get the vertices to world space. And I also know what to do with the vertices after they''ve gone through the view transformation to translate them to screen coordinates. So what I need to know is how the view transformation is done.
Please help me!
Advertisement
Sorry for this but I need this bad.
I am supposed to hand this is very soon.
Ummm if you understand the model transformation and the projection transformation then the view trans should be easy. Basically your view matrix is your ''camera''. What i like to do is have a matrix for the camera, and rotate and move it exactly like i would do to a model matrix. Then every frame i get the inverse of this matrix and multiply all vertices by this. You need to get the inverse, because if the camera is turning to the right, all points will be turning to the left.

Hope that helps
Thank you sooooo much!
This means a lot to me. Now I might be able to hand it in in time.
So just to check if I understand everything:

I take the vertices in model space, multiply them with the models matrix to get the vertices to world space. I then take the cameras matrix which is calculated with rotations and translations the same way as a models matrix, take the inverse of that matrix and multiply the vertices which are in world space. The resulting vertice I use in my projection transformation.
Is all of this correct?

Thanks again for your help.
Yes. You can also think of the world and camera matrices as three orthogonal vectors attached to the model and rotating this vector set around x,y,z axis will get your model from one space into another. Thinking it this way you first do rotations than translations. You can think of transforms as moving vertices around or as moving the axes attached to the model. In both cases the vertices move around one coordinate system (in reality there is no camera nor world or model space).

If you envision the matrix composed of orthogonal vectors then in opengl the first column is the x-axis the second column the y-axis and third column is the z-axis. In direct3d just transpose this opengl matrix i.e. first row is x-axis, second row is y-axis and third the z-axis. There are many ways to think about transforms and sometimes it''s confusing.
Advertisement
Yes. Infact one of my main problems was when i wanted to convert my code from OGL to D3D, i had to go and fix all the matrix stuff because the all matrices are like...rolled 90 degrees. I think these two systems are refered to as right and left handed systems, but anyway

you order should be : (and i''m only 99% sure because D3D handles tranformations itself any way)

1) Transform model verts by your model matrix to get world verts
2) Transform all world verts by your view matrix (inverse of camera matrix)
3) Project your verts onto screen using your projection matrix

This topic is closed to new replies.

Advertisement