|
![](/i/fill.gif) |
Diego Krota <Xdk### [at] geocities com> wrote:
: I'm developing for my software D-form a depth sort renderer.
: For the first draft I did a raw bubblesort and it worked OK.
: A last question. I confronted the average Z coordinates of each poly to
: determine the nearer. Are there better methods?
With that method you will get errors, since it's very difficult, if not
impossible (I don't know which one) to sort all polygons perfectly.
Imagine the following case:
\
\
A/ \
/ \B
\
\
\
\
V <- eye
There are two polygons here, A and B. If you sort them with that average Z
method, you will get that A is behind B, which isn't true.
What you need is to maintain a Z-buffer. When you draw a polygon, you
store the z value of each pixel in the buffer, unless there is a value
which is smaller.
This allows also making space cutting of polygons.
--
- Warp. -
Post a reply to this message
|
![](/i/fill.gif) |