DEPTH-BUFFER METHOD
A commonly used image-space approach to detecting visible surfaces is that the depth-buffer method, which compares surface depths at each pixel position on the projection plane. This procedure is additionally named because the z buffer method, since object depth is typically measured from the view plane along the z axis of a viewing system. Each surface of a scene is processed separately, one point at a time across the surface. the tactic is typically applied to scenes containing only polygon surfaces, because depth values may be computed very quickly and also the method is straightforward to implement. But the tactic may be applied to no planar surfaces. With object descriptions converted to projection coordinates, each (x, y, 2) position on a polygon surface corresponds to the orthographic projection point (x, y) on the view plane. Therefore, for every pixel position (x, y) on the view plane, object depths may be compared by comparing z values. Surface 5, is close
st at this position, so its surface intensity value at (x, y) is saved. we will implement the depth-buffer algorithm in normalized coordinates, so z values range from 0 at the rear clipping plane to zmax, at the front clipping plane. the worth of zmax, may be set either to 1 (for a unit cube) or to the biggest value which will be stored on the system. As implied by the name of this method, two buffer areas are required. A depth buffer is employed to store depth values for every (x, y) position as surfaces are processed, and also the refresh buffer stores the intensity values for every position. Initially, all positions within the depth buffer are set to 0 (minimum depth), and also the refresh buffer is initialized to the background intensity. Each surface listed within the polygon tables is then processed, one scan line at a time, calculating the depth (z value) at each (x, y) pixel position. The calculated depth is compared to the worth previously stored within the depth buffer at that position. If the calculated depth is bigger than the worth stored within the depth buffer, the new depth value is stored, and also the surface intensity at that position is decided and within the same xy location within the refresh buffer. We summarize the steps of a depth-buffer algorithm as follows:
Depth(x,y) = 0, refresh(x,y) = Ibackground
2. for every position on each polygon surface, compare depth values to previously stored values within the depth buffer to see visibility.
Calculate the depth t for every (x, y) position on the polygon. If z > depth(x, y), then set
Depth(x,y) = z, refresh(x,y) = Isurf(x,y)
where Ibackground is that the value for the background intensity, and Isurf(x,y) is that the projected intensity value for the surface at pixel position (x,y). in the end surfaces are processed, the depth buffer contains depth values for the visible surfaces and also the refresh buffer contains the corresponding intensity values for those surfaces.
Depth values for a surface position (x, y) are calculated from the plane equation for every surface:
Comments
Post a Comment