Neil Matson (matson++at++vulcan.ncsc.navy.mil)
Mon, 16 Jun 1997 11:28:31 -0500
Over time I seen quite a number discussions of "flickering" caused by
polygons
close together (not necessaryily coplaner) and a large far/near frustum
ratio (generally greater than 1000). A partial solotion to this is displace
polygon and stencil, but this does not always solve the problem. A classic
example is a land and an active ocean surface. From certain viewpoints the
land is drawn over the water, and vice-versa. This causes problems because
it is not always an easy task to have a definitive drawing order, either
computationally or just because of the polygonal structure.
A partial solution to this (which I can only get to work correctly for opaque
polygons) goes roughly something like this:
Say you want a z buffered scene with front plane = 1 and back plane = 100000.
With one channel for these frustum limits, this presents hideous Z-buffer
flickering because of the finite number of bits allocated to Z. In any case,
it is the ratio of back to front which causes this problem.
The idea is to create two channels where there were originally one. Let's call
them "front" and "back." Now, "front" is a frustum from 1->305, and "back" is
a frustum from 295->100000. Notice the ratios for each frustum are around
300ish, definitely less than the 1000 ratio. Also, note that they overlap a
bit (reader is encouraged investigation here, but basically the seam for the
two won't EXACTLY fit unless you overlap them). Now, the rendering order for
a basic scene (no stencil) with Z buffering (make sure they are ordered
"back" first, then "front"!) is 1) if "back" channel -> pfClearChan(back_chan),
else if "front" -> pfClear(PFCL_DEPTH, NULL) (could also clear STENCIL etc).
2) render the scene normally.
This basically draws the front frustum on top of the back frustum, with only
a Z clear. Notice that you can get color information from the back channel
(blending purposes) but at the seam, the translucent polygons get rendered
twice so they are twice as dark. Basically, if you overlay the frustums,
you will see the seam only on translucent polygons (at certain angles).
If they are "exactly" matched you will see cracks in the polygons at the seam
(again, at certain angles). Thus, this works really well for opaque polygons,
but messes up on translucent ones at the seam. I implemented this a while ago
in GL, but also found it works great in Performer.
I know SGI is aware of the Z buffering bit-size limitations and future stuff
(don't know when) will probably address this, but for now this seems to be
a viable alternative.
Neil
matson++at++phoebus.ncsc.navy.mil
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
SGI DevForum 97 info: http://www.sgi.com/Forum97/
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:26 PDT