home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / graphics / 12964 < prev    next >
Encoding:
Text File  |  1992-12-16  |  4.1 KB  |  80 lines

  1. Newsgroups: comp.graphics
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!geraldo.cc.utexas.edu!portal.austin.ibm.com!awdprime.austin.ibm.com!mark
  3. From: mark@austin.ibm.com (Mark Einkauf)
  4. Subject: Re: Z Buffer Precision and Homogeneous Coordinates
  5. Originator: mark@einkauf.austin.ibm.com
  6. Sender: news@austin.ibm.com (News id)
  7. Message-ID: <BzDEyv.yKr@austin.ibm.com>
  8. Date: Wed, 16 Dec 1992 21:13:43 GMT
  9. References:  <78173@hydra.gatech.EDU>
  10. Organization: IBM Austin
  11. Lines: 67
  12.  
  13.  
  14. In article <78173@hydra.gatech.EDU>, gg10@prism.gatech.EDU (GALLOWAY) writes:
  15. >                       B
  16. >     Z(screen) = A + ------
  17. >                     Z(eye)
  18. > where A and B are constants.  And that this is done so that "in moving
  19. > from eye space to screen space, lines transform into lines and planes
  20. > transform into planes."  The depth value gets normalized from the range
  21. > [near, far] to [0, 1].
  22. > If the viewing transformation matrix consists of only linear operations,
  23. > translation, rotation, and scaling, then this appears to degrade the
  24. > precision of the depth value.  In my current Z buffer-based renderer my
  25. > Z buffer is an array of 32 bit floats.  I preform clipping in the 3D view
  26. > space (or eye space) before perspective projection.
  27. > My questions are:
  28. > a) Why do software (non-hardware) Z buffers normalize the depth value?
  29. >    Why not just keep around a float and compare floats?
  30.         
  31.      Compares are OK for clipping to a rectangular volume, but the trouble
  32.      comes when trying to clip to a frustum (truncated pyramid) - which is 
  33.      what you must do if you want a perspective view (as opposed to parallel).
  34.      There, you want the equations of the planes of the frustum to be very simple
  35.      so your intersection calculation is in turn simple (and therefore fast).
  36.      Likewise, even in a parallel view, if your transforms are such that the 
  37.      view volume is a nice normalized cube (0->1, or 1->1 on all sides) then you can
  38.      use the same equation for finding intersections.  You are then always intersecting    
  39.      with 0 and 1 or 1 and 1, rather than arbitrary boundaries.
  40.  
  41. > b) Are most Z buffers integerized as well?  How many bits?
  42. >    What is the advantage?
  43.  
  44.      Hardware z buffers are integerized, just like the x,y coordinates of your
  45.      display (i.e. there is no such physical pixel as x=145.982, y=389.004).
  46.      In hardware, all there is is bits, so whether you say they are simple
  47.      integers, or in an elaborate float format, your resolution remains the same and
  48.      is determined by the actual number of physical bits per pixel.  Its simpler to
  49.      treat everything as an integer.  Typical z buffers are 16 to 24 bits.
  50.      The more bits, the greater resolution.  If too few bits, things that are actually
  51.      separated in z may map to same hardware z value and interfere with each other.
  52.  
  53. > c) When is the correct time to clip?  And are homogeneous coordinates
  54. >    necessary if you are not current rendering NURBs?
  55. >    For most surface, except NURBs, W is always 1 anyway, right?
  56.      If you have a perspective view, homogenous coordinates are convenient to
  57.      use for clipping.  In the answer to (a) above, recall the frustum.  If you clip
  58.      to the 3d frustum , you must apply the perspective after clipping, which means
  59.      you need more math (takes time).  Foley and Van Dam show how these steps are 
  60.      combined so that you apply the perspective transform before clipping, then
  61.      clip to +/- w.  In this case, w is definitely not always = 1.  After clipping
  62.      to +/- w, you divide x,y,z by w which gets you to your normalized cube.  After
  63.      this divide, w is 1 and you can breathe a sigh of relief - you have survived 4
  64.      dimensions.  From the normalized cube you apply your device scale/translate
  65.      to map to the physical window.  
  66.  
  67.  
  68. -- 
  69.   Mark Einkauf     [ mark@einkauf.austin.ibm.com (only valid within ibm.com) ]
  70.   IBM-AWD Graphics [ VNET EINKAUF@AUSVM6                                     ]
  71.   Austin TX        [                                                         ]
  72.  * Views and opinions expressed herein are not necessarily those of IBM Corp. *
  73.