Wanting to learn about 3D rendering...

Started by
1 comment, last by uncle_rico 17 years, 6 months ago
I was wondering if anyone knew of any good online resources for learning how 3D rendering is typically performed. I have searched the articles here and I wasn't able to find much at my level. I am familiar, basically, with the different types of transformations that need to happen. For instance, I am aware that most point values are in "object space", and they all need to be transformed into the world according to the position of the object in that world. Then, you have the position of the camera, and the entire world needs to be transformed inverse to the camera's coordinates. Then, you have several different projection types (perspective, orthographic, or whatever). I'm aware that all this is traditionally performed with matrix multiplications. So, there is a projection matrix which is multiplied by the inverse of the view matrix, which is in turn multiplied by the world matrix (which represents the objects position in the world), which is multiplied by the object-space point. The result is a homogeneous space coordinate, which represents the position on screen, and ranges from -1 to 1. So, the position -1,-1 represents the lower left corner of the screen, and position 1,1 represents the upper-right. Position 0,0 represents the middle. The purpose behind learning all of this is because I am creating a program with which one could edit spline patch control points. The spline patch itself is drawing perfectly, and thanks to the API I don't have to worry about how this projection is done. I just have to remember to transform each of the points to world coordinates, supply the view and projection matrices, and the API does the actual projection for me. But for the control points for the spline patch, I want to draw them as 2D squares on the screen. For this, I need to calculate the projection myself. I tried doing so using the steps I outlined above, and it works GREAT when the spline patch itself is at the world's origin, but if I rotate the object and then try to edit the control points, some weird behavior occurs. So obviously I don't fully understand the process. In the first place, I didn't know the proper order with which to multiply the matrices. What I achieved so far I did through trial and error. Something tells me that there is something wrong with the way the control points are being transformed in the world. Perhaps they're being translated then rotated, when they should be rotated then translated. I dunno. I just grab the world matrix and then run with it. So yeah, I'd give more details about my specific problem, but honestly I think I'd have a hard time describing it, so if anyone has any more-general resources on this topic, that would be awesome.
Advertisement
Actually, you understand the process perfectly, it's just the implementation details you're not sure about. You want each transformation to be applied to the original object-space vertex in turn, such that the first transformation is closest to the vertex and the last transformation in farthest. So given the world-space transform W, the view-space transform V, and the clip-space (projection) transform P, and object-space vertex x, the transformation should be PVWx. If you're using an API with row vectors, then the transformation would be xWVP. And that's the order you multiply them in as well.
Thanks! It works perfectly now.

This topic is closed to new replies.

Advertisement