The quad-bug in the libraries
how it looks like
whats the problem in the LIBs regarding the handling of small-quads (in my
opinion).
1) testing of visibility is not done with the traditional
backface-culling method (looking at the angle between poly-normal and
eye-to-vertex-vector), but, like Lewis Evans said, depends on the order of vertices on
SCREEN.
If you look on top of a (visible) quad, and define the vertices following
2 3 0 1
2 3
* --- *
/
/
* --> *
0 1
after local-to-screen transformation and perspective conversion, the quad is
handled as visible if the calculated SCREEN-coords (always looking on first 3 vertices)
are still:
2:top-left 3:top-right 0:bottom-left
or:
1 0 3 2
2 3
* <-- *
/
/
* --- *
0 1
1:bottom-right 0:bottom-left 3:top-right
2) The problems with small quads crop up if SCREEN-coords fall together.
While it seems this is handled correct in triangles, it isn't in quads (it seems to be
handled same as in triangles).
What I have seen: If 2 or 3 of the 3 SCREEN-coords (3 in triangles, first 3 in quads) fall
together, it is handled as not-visible
for example:
2 3
* --- *
/
/
* --- *
0 1
SCREEN-coords 2 & 0 fall together
in Triangle:
two Triangles: 2 3 0 , 3 1 0
230 is not drawn, 310 is drawn -> OK, because 310 covers 230
in Quads:
one PLANAR-Quad: 2 3 0 1
230 is taken for visible-detection, and handled as not-visible, not drawn, although quad
is visible
This quads-error appears not only on quads with not-reasonable angles. It appears also if
you go into more "polygon-detail", and there are a lot of moiré-effects.
Sometimes large areas are not drawn.
If I am wrong please let me know
Andreas Schrattenecker