   Gaps in between polygons
  Hello,In my software renderer, I get fine gaps between polygons when viewing them at certain angles. I wish I could post a screenshot, but I don''t have access to any web space at the moment.The problem didn''t seem to exist at all in my node-based BSP engine, which led me to believe it had something to do with my leafy BSP compiler generating inaccurate results, but that doesn''t appear to be the issue.I think I''m just noticing it because in the data set I''m working with, there are a lot of new polygons formed from splits.I don''t think it''s the rasterizer, because I use a fairly simple algorithm which shouldn''t cause problems with lined-up polygons. I''ve tried tweaking the rasterizer anyway, but to no avail.I''m assuming these problems might be introduced during the various world-to-camera-to-screen transformations I have to perform with single-precision floats, but I can''t verify this.Any ideas what the problem could be?Thanks in advance.    ----Bart  
  Beware the T-vertex.  ;  I''m not sure how T-vertices would be generated by the BSP compiler.Whenever a split occurs, the same vertex is added to both resultant polygons. I don''t yet use a single, global vertex list (with polygons using indexes into it); each polygon carries around its own vertex list.The problem didn''t seem to occur with node-based BSPs, which I find odd.What can I do to identify whether T-vertices are being generated and how can they be corrected? I''ve been looking around for information, but haven''t found much Thanks, ----Bart  ;  Make sure to test your rasterizer thoroughly. Don''t just assume it works, that''s one of the basic rules about debugging!The way I did this was to take a big sphere which fills the whole viewport, and use additive blending on a black background. If not all pixels have the same color after rendering, you''ve got cracks between your polygons that are caused by your rasterizer.  ;  Could you describe your method in a little more detail?Do you mean filling the screen with various connected polygons and testing for gaps?I''ve definitely been investigating the rasterizer as thoroughly as I can, but I have not been able to reproduce the gaps using 2 side-by-side polygons. ----Bart  ;  Well, first you clear the screen (black). Then you render the sphere with a constant color. But instead of replacing the black background color, add it up. Also make sure the sphere has a lot of polygons, and you''re close to it so it fills the screen. Also make it rotate arbitrarily every frame so you get all kinds of orientations for the polygons.Now you can test for gaps by checking if the whole screen has the same color as the sphere. The addition instead of replacement is needed to detect overlapping pixels. Don''t do the checking visually, but write a little function that tests every pixel individually and halts the program when an error is detected. Also try different resolutions.  ;  I''ll have to write some code to generate such a sphere. But by rotating it, I''m performing transformations and I''d have to clip, which wouldn''t help isolate whether the problem is in the rasterizer or somewhere else.I''ve posted a screenshot, BTW. I''ve been having some problems with the trzy.org domain, but it should be working now:http://www.trzy.org/shot.png ----Bart  ;  Ah, thanks for the screenshot. Those gaps look really big, so you must be right it''s not the rasterizer. Can you move closer to the gaps until they become wider than a few pixels? If that is the case then you can be 100% sure it''s a problem with vertices and not pixels.  ;  EDIT: Was missing an endquote in my link. Oops!Well, I don't think the gaps are that big. What's interesting is that they remain the same size no matter how close to get.An important thing to remember is that they only appear at certain orientations (they aren't fixed, so to speak -- they change size and disappear when moving around.) If you can run a DOS VESA-based program, I can post an executable and the BSP file (or the source code, but it's messy and probably wouldn't help.)There's another shot at: http://www.trzy.org/shot2.pngI just can't think of what it could possibly be. I don't think T-vertices are the issue here. I did notice some cases in the BSP file where there were 2 similar vertices, for example (these aren't exact numbers from the file, but they should give you an idea of what the problem):20.00000,50.00000,60.00000...19.99998,50.00000,60.00000I'm not sure how these were generated, but I patched them up by hand (there were only a few occurances -- not enough to account for all those gaps even if it was the problem) and nothing changed. ----Bart[edited by - trzy on December 30, 2002 3:25:55 AM];  LOL, that post really messed up this page.  