Perpective Projection of Vertices Routines

Started by
6 comments, last by JasperW 22 years, 12 months ago
I have a question regarding the perspective projection of vertices. Could you show me your (optimized) routines to translate, rotate and perspective project your vertices (in software) using matrix multiplication. I would like to compare them to my routine which uses standard geometric functions to accomplish this. If you''re not willing to show your code, could you give me the number of additions, multiplications, divisions and comparisons (if any)? I know that doesn''t prove if a routine is faster but it gives me an indication about the speed. I want the whole transformation from a point in 3D space, to a 2D point on screen. Preferably with rotations around all three axis. Any help on this would be greatly appreciated. Thanks. Jasper
Advertisement
Quake1 Source
The improvement of a multiplication with a matrix, rather than standard geometric functions is, that you may have as many rotations / scalings / whatever without any speed impact. So if you do matrix transformations, and, let me say, have 20 rotation axes, around different rotation points (you know, the earth rotates around the sun and itself, on the earth a car drives to the left, whereas the dirver turns to the right, his head up and his eye left-down, which results in some rotations and you have a camera that rotates in some other direction, you need 9 multiplications and 9 adds for the whole transformation, and maybe another 2 multiplications and 2 divisions for the projection (or 4 multiplications and 1 division, which is much faster) and no more... (if I counted correctly)

So if rotating around only 3 axes, your code may be faster. But in a standard game or so you will always have several more axes (with the center of rotation in different points) and this is hard to do without matrices...

Moreover, matrices are simpler to implement... you will for sure find a good article about that.

Edited by - Chock on April 25, 2001 8:31:50 AM
Anonymous Poster: I''m not really interested in reading and trying to understand the source code of Quake (it''s probably a little out of my league). But thanks anyway.

Chock:
* Regarding multiple transformations: That''s just a question of setting up your (what I call) camera in a different way (about the same as multiplying those 20 matrices before you start to transform). It''s all precomputing. Then I still have just one routine to transform individual vertices just as with matrix multiplication (BTW I didn''t claim my routine is faster).
* Doesn''t the perpective projection also need two additions because (0,0) is at the center of the screen, not in the upperleft corner?
* I don''t really think matrices are easier to learn. I looked at the articles here at GameDev about them and most of them are really bad (IMHO).
* Thanks for your help!

Anyway, I just want to check out the differences between them and see what you have to say about it. I think that you should not automatically use the most popular method without investigating the alternatives. If people have any opinions about this I would certainly like to hear from them.

Jasper
Anonymous Poster: I''m not really interested in reading and trying to understand the source code of Quake (it''s probably a little out of my league). But thanks anyway.

Chock:
* Regarding multiple transformations: That''s just a question of setting up your (what I call) camera in a different way (about the same as multiplying those 20 matrices before you start to transform). It''s all precomputing. Then I still have just one routine to transform individual vertices just as with matrix multiplication (BTW I didn''t claim my routine is faster).
* Doesn''t the perpective projection also need two additions because (0,0) is at the center of the screen, not in the upperleft corner?
* I don''t really think matrices are easier to learn. I looked at the articles here at GameDev about them and most of them are really bad (IMHO).
* Thanks for your help!

Anyway, I just want to check out the differences between them and see what you have to say about it. I think that you should not automatically use the most popular method without investigating the alternatives. If people have any opinions about this I would certainly like to hear from them.

Jasper
Anonymous Poster: I''m not really interested in reading and trying to understand the source code of Quake (it''s probably a little out of my league). But thanks anyway.

Chock:
* Regarding multiple transformations: That''s just a question of setting up your (what I call) camera in a different way (about the same as multiplying those 20 matrices before you start to transform). It''s all precomputing. Then I still have just one routine to transform individual vertices just as with matrix multiplication (BTW I didn''t claim my routine is faster).
* Doesn''t the perpective projection also need two additions because (0,0) is at the center of the screen, not in the upperleft corner?
* I don''t really think matrices are easier to learn. I looked at the articles here at GameDev about them and most of them are really bad (IMHO).
* Thanks for your help!

Anyway, I just want to check out the differences between them and see what you have to say about it. I think that you should not automatically use the most popular method without investigating the alternatives. If people have any opinions about this I would certainly like to hear from them.

Jasper
Anonymous Poster: I''m not really interested in reading and trying to understand the source code of Quake (it''s probably a little out of my league). But thanks anyway.

Chock:
* Regarding multiple transformations: That''s just a question of setting up your (what I call) camera in a different way (about the same as multiplying those 20 matrices before you start to transform). It''s all precomputing. Then I still have just one routine to transform individual vertices just as with matrix multiplication (BTW I didn''t claim my routine is faster).
* Doesn''t the perpective projection also need two additions because (0,0) is at the center of the screen, not in the upperleft corner?
* I don''t really think matrices are easier to learn. I looked at the articles here at GameDev about them and most of them are really bad (IMHO).
* Thanks for your help!

Anyway, I just want to check out the differences between them and see what you have to say about it. I think that you should not automatically use the most popular method without investigating the alternatives. If people have any opinions about this I would certainly like to hear from them.

Jasper
You get a timeout from the server so you resend. Of couse I''m not smart enough to enter my user name again :-( So now I have four of the same posts. Great! Can somebody delete these please?

This topic is closed to new replies.

Advertisement