Long ago, there was talk of having VRML support a non-proceedural
iterator (a kind of "make/draw n copies of this" primitive). The idea
behind the iterator is that you would specify a (translation) matrix
to iterate on. In very garbled syntax:
Tranlate 0 0 1,
would draw 50 cubes in a row, along z axis.
Would such a thing really be useful? Would it be of broad interest?
Or is it a neat trick that no one would use?
> if a Z-buffer is implemented AND the cubes are sorted FRONT to back, then
> the front surface of the closest cube will be drawn and all of the cubes
> that are "behind" those pixels will test as the z-values are further, so
> they will fail the test of "should the pixel be drawn", which will avoid
> drawing (which is an time consuming operation on most hardware.), and
> will give the most significant speed up to those people with the slowest
BZZT. This is wrong. If you're touching z, you've already blown
performance. Specifically, you MUST: transform, light & clip,
compute triangle edge slopes, walk triangle edges, walk spans,
interpolate r, g, b, texture s, t, depth z. That's the majority
of CPU time. Whether or not you actually plop a color into the frame
buffer at this point is almost completely irrelevent. And you have to
do all of the previous before you do the z-test.
However, front-to-back is interesting if you DON'T z-buffer, and DO
maintain a "visibility list". You draw front to back. You maintain
a list of polygonal 2D clipping regions, at first empty. Every new
thing you draw, you compute intersection against the clip list.
If its visible, you draw it. If not, you discard the polygon (DON'T
do lighting, don't do transform, don't rasterize, nothing). Evry thing
that you drew, you add it to the clip list. Eventually, the clip list
grows to fill the screen, and you are done -- nothing else can possibly
be visible. In this way, you touch each & every pixel once and only
once. Can be a good cpu saver on small/medium models (less than 50K
Linas Vepstas Graphics Architecture
IBM PPS Zip 9260 Tie Line: 678-1116
11400 Burnet Road External Phone: 1-(512)-838-1116
Austin TX 78756-9260 mail: email@example.com </a>