CG Unit 7 Full
CG Unit 7 Full
Types of Buffers
Depth Buffer
Refresh Buffer
Algorithm
1. Initialize the depth buffer and refresh buffer so that for all buffer
positions(x, y),
depth(x,y)=0 and refresh(x,y)=Ibground
2. For each position on each polygon surface, compare depth values
to previously stored values in the depth buffer to determine visibility.
where Ibground is the value for the background intensity, and Isurface(x,y) is
the projected intensity value for the surface at pixel position (x,y).
After all surfaces have been processed, the depth buffer contains
depth values for the visible surfaces and 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
each surface:
A-BUFFER METHOD
• An extension of the ideas in the depth-buffer method is the A-buffer method.
• it deals only with opaque surfaces and cannot accumulate intensity values
for more than one surface.
• Each position in the A-buffer has two fields:
1.depth field - stores a positive or negative real number
2. intensity field - stores surface-intensity information or a pointer value.
Background
opaque
surface Foreground
Transprent
surface
A-BUFFER METHOD
• For positions along this scan line between edges AB and BC, only
the flag for surface Sl is on.
• Similarly, between edges EH and FG, only the flag for surface S2 is
on.
• For scan lines 2 and 3 the active edge list contains edges AD, EH,
BC, and FG.
• But between edges EH and BC, the flags for both surfaces are on.
DEPTH-SORTING METHOD
• Using both image-space and object-space
operations, the depth-sorting method
performs the following basic functions:
1. Surfaces are sorted in order of decreasing
depth.
2. Surfaces are scan converted in order,
starting with the surface of greatest depth.
DEPTH-SORTING METHOD
9
5
4
3
2
2 4,3,1 0
-1
9
3 1,5 2
1
4 3 1
2
0
5 2
2
6 0
-1
DEPTH-SORTING METHOD
Triangle Front List Behind counter output New Behind
counter
1 5
1 1
2 4,3,1
-1 -1
9
3 1,5
1 0
4
4 3 2
0 -1
5
2 2
6
-1 -1
DEPTH-SORTING METHOD
Triangle Front List Behind counter output New Behind
counter
1 5
1 0
2 4,3,1
-1 -1
9
3 1,5
0 -1
4
2
4 3
-1 3 -1
5
2 1
6
-1 -1
DEPTH-SORTING METHOD
Triangle Front List Behind counter output New Behind
counter
1 5
0 -1
2 4,3,1
-1 -1
9
3 1,5
-1 -1
4
2
4 3
-1 3 -1
1
5
1 0
6
-1 -1
DEPTH-SORTING METHOD
Triangle Front List Behind counter output New Behind
counter
1 5
-1 -1
2 4,3,1
-1 -1
9
3 1,5
-1 -1
4 35
4 3 2
-1 -1
1
5
0 -1
6
-1 -1
BSP-TREE METHOD
• binary space-partitioning (BSP)
AREA-SUBDIVISION
b1ETHOD
No further sub division is needed if
Overlapping surface
inside surface
Surrounding surface
Outside surface
OCTREE METHODS
RAY-CASTING METHOD