quote:
It''s impossible to define a unit cube, but it''s not impossible to define a ''unit frustum''. By scaling x and y you can make the frustum planes 90 degrees, which simplify the distance calculations a little. It''s called affine clipping if I recall correctly and it''s the first step towards homogenous clipping. If you write down the formulas of clipping and projection you automatically go to homogeneous clipping:
-1 < X < 1
-1 < Y < 1
Where X and Y are affine screen coordinates scaled into a [-1, 1]x[-1, 1] viewport.
-1 < x/z < 1
-1 < y/z < 1
Where x and y are unprojected, scaled camera view coordinates. Z is the distance from the point of view. Because we often also want to scale z in [0, 1] for the depth-buffer, let''s call that coordinate w:
-1 < x/w < 1
-1 < y/w < 1
0 < z/w < 1
Now the step to homogeneous clipping is trivial:
-w < x < w
-w < y < w
0 < z < w
Exegant, efficient, robust. And the real pretty part is that all projection information can be stored in a 4x4 matrix. No more explicit working with projection plane distance, etc. You can do any transformation on your geometry you want, it will always be clipped correctly. 2D clipping might look simpler at first but it''s a pain...
buddy can u please explain this method in details?i can''t get it right.10x!
"Tonight we strike,there is thunder in the sky,together we''ll fight,some of us will die,but they''ll always remember that we''ve made a stand and many will die by hand!" - ManOwaR