Path: utzoo!attcan!uunet!bellcore!rutgers!mcnc!thorin!homer!leech From: leech@homer.cs.unc.edu (Jonathan Leech) Newsgroups: comp.graphics Subject: Re: Blinn's article Message-ID: <18068@thorin.cs.unc.edu> Date: 11 Dec 90 22:03:51 GMT References: <1990Dec7.105837.19722@funet.fi> Sender: news@thorin.cs.unc.edu Reply-To: leech@homer.cs.unc.edu (Jonathan Leech) Organization: University Of North Carolina, Chapel Hill Lines: 43 Summary: Expires: Sender: Followup-To: Distribution: Keywords: In article <1990Dec7.105837.19722@funet.fi> jk87377@tut.fi (Kouhia Juhana Krister) writes: >I have problem with Jim Blinn's perspective projection matrix > >c 0 0 0 >0 c 0 0 >0 0 Q s >0 0 -Qn 0 > >where Q = s/(1-n/f) > c = cos(viewing angle/2) > s = sin(viewing angle/2) > n = depth of the near clipping plane > f = depth of the far clipping plane > eye point is (0,0,0) The transformation as specified has at least two uses. First, to allow additional clipping planes at Znear and Zfar in addition to the normal viewport clipping planes (this is the reason he cited when I took and later TAed his graphics class at Caltech). Second, to compress Z values in the range in a nonlinear fashion suitable for depth-buffering, providing greater precision of transformed Z values close to the eye. The actual Z value after perspective is Zfar Z - Znear ---- * ------------ [Znear,Zfar] -> [0,1] Z Zfar - Znear which as you observe degenerates to a constant if Znear = 0. The solution is simply to specify a nonzero Znear, prererably reasonably large. If you are using the direct-quadric rendering algorithm Blinn describes elsewhere in conjunction with this perspective matrix, you definitely want a large Znear; otherwise, large relative errors can creep into normal vectors and points on the surface back-transformed into object space for texturing. -- Jon Leech (leech@cs.unc.edu) __@/ "Why do you suppose we only feel compelled to chase the ones who run away?" "Immaturity." _Dangerous Liasons_