A problem in 3D computer graphics
. You have some model
of the world
stored in your computer's memory. For simplicity, a bunch of polygons
, each with different colour
s and texture
s. But they're not stored in any order in memory. What you want, though, is for the ones that are closest to the eye to be visible. For example, if a monster
is standing in front of a wall from your point of view
, and you draw the monster first, wall second, then the wall will cover the monster, so you won't see the monster.
A secondary reason for visible surface determination (VSD), is if you have to render less, you can render faster, so if you can throw away a lot of things, then you can draw more.
There are a whole bunch of techniques for solving the problem. This includes:
- Depth-sorting (aka painter's algorithm): The oldest and simplest approach, but has problems with some types of scenes. Easily implemented in software; almost impossible in hardware.
- Z buffer: This works great when implemented in hardware and is the one used in modern 3D cards. Can be done in software, but can be very slow.
- BSP trees: An advanced technique that was the best "software only" technique until hardware z buffer support came around, especially for walk-through type rendering.
- Ray tracing (well, sort of, the visible surface determination problem gets solved as part of the process of ray tracing).
There are other approaches that can be used; for example, the original Quake used a hybrid of BSP trees and software z buffer to do the job. You can also use backface culling orthogonally to any of the approaches above (although, for example, it's easier to use with some than others. For example, backface culling works really well together with BSP trees).