Painter's algorithm
- BSP trees, however, solve both these problems by splitting up objects and ordering them so that the painter's algorithm will draw them correctly without need of a Z-buffer and without overdraw.
This seems to be in error to me. Using a BSP does not eliminate overdraw with the painter's algorithm. The only point, if I'm not mistaken, about using BSP combined with the painter's algorithm is that it provides an extremely fast way to sort the polygons by distance. Using Z-buffering with a front-to-back rendering method is what eliminates overdraw. Fredrik (talk) 17:42, 1 Jun 2004 (UTC)
- No. BSP trees do remove overdraw by the painter's algorithm. If you look at the painter's algorithm page you'll see an example of a scene that won't draw correctly. One purpose of BSP is to convert that scene into one which will draw correctly by splitting overlapping polygons into non-overlapping polygons. Another purpose is to provide an extremely fast way to sort the polygons. Scenes drawn using BSP do not require z-buffers. When z-buffers are used they are only filled by the BSP scene to be used later, when drawing movable objects such as doors. Note that Doom's doors are not considered movable since doom's map are 2D and doom's bsp is 2d. Quake's doors and mosters are movable and need to be merged into the scene using the z-buffer provided by the rendering of the background. -- cbraga 18:04, Jun 1, 2004 (UTC)
-
- On second thought, you're at least partly correct, since that would depend on the particular implementation of the algorithm. But at lease in Doom's and Quake's case they are used to eliminate overdraw. If the trees were being used solely for other purposes (such as collision detection or ray tracing) overdraw would not be an issue and would not need to be taken into consideration when building the trees. cbraga 18:22, Jun 1, 2004 (UTC)
- The point of the painter's algorithm is that you draw back to front. This means you'll draw several times to each pixel (or am I using the wrong word here?). The BSP FAQ describes what I'm saying here (section "How do you remove hidden surfaces with a BSP Tree?"). Doom doesn't use the painter's algorithm since it draws front-to-back. Fredrik (talk) 18:27, 1 Jun 2004 (UTC)
-
- Yes, it seems you are correct. BSPs will never elliminate overdraw, just assure that the painter's algorithm will work correctly, plus provide a fast way to sort the polygons. I'll correct the article.
-
- But in Doom's case there's no overdraw since, drawing front to back, it draws beginning at the ceiling and the floor, moving away from the viewer and towards the center of the screen. There's no overdraw since it will never overwrite a pixel from a close source with one from a distant source. And, it's very simple to determine what part of a sector (if any) is visible based on the last pixels drawn. It's a sort of reverse painter's algorithm where you never draw over what you have already drawn. It is simple in Doom's case since its maps are essentialy 2D, but that would be undoable in full 3D. -- cbraga 19:12, Jun 1, 2004 (UTC)