jk87377@tavi.tut.fi (Kouhia Juhana Krister) (12/07/90)
Hi, In IEEE CG&A has an article written by Jim Blinn: Nested Transformations and Blobby Man October 1987 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) If I set n = 0 and f = +oo matrix is: c 0 0 0 0 c 0 0 0 0 s s 0 0 0 0 I have 3d point (x,y,z); same point is (x,y,z,1) in homogeneous coordinates. I multibly it by matrix and I get (cx/sz, cy/sz, sz/sz) = (cx/sz, cy/sz, 1) QUESTION: --------- If I have polygon in 3d space, how I calculate the depth by interpolation? At every vertex there's z = 1. While go I looked at the another paper, where eye point is (0,0,-1) and perspective projection matrix is 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 1 Now we have the point (x,y,z) --> (x/(z+1), y/(z+1), z/(z+1)) Now there's a little sense exists. If I now interpolate depth between vertexes I got everything right, though. QUESTION: --------- Have I found an error from Jim Blinn's nested transformations article? I have suggestion for the new matrix (eye point is (0,0,0) as in article, n = 0, f = +oo): c 0 0 0 0 c 0 0 0 0 s s 0 0 -1 0 Now the result point is (cx/sz, cy/sz, (sz-1)/sz) I tested this and it's ok, though. I found an another weierd thing from this article, but that's is an another story. Juhana Kouhia jk87377@tut.fi
leech@homer.cs.unc.edu (Jonathan Leech) (12/12/90)
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_