Tribhuwan University

Institute of Science and Technology

2081

Bachelor Level / Third Year / Fifth Semester / Science

Bachelors in Information Technology (BIT304)

(Computer Graphics)

Full Marks: 60

Pass Marks: 24

Time: 3 Hours

Candidates are required to give their answers in their own words as for as practicable.

The figures in the margin indicate full marks.

Section A

Long Answers Questions

Attempt any TWO questions.
[2*10=20]
1.
Describe z-buffer method for visible surface detection. State its limitations and how these limitations can be reduced.[10]

Z-Buffer Method for Visible Surface Detection

Z-Buffer (Depth Buffer) method is an image-space approach for visible surface detection that compares surface depths at each pixel position on the projection plane to determine which surface is closest to the viewer and should be displayed.


Principle

The Z-Buffer method uses two buffers:

  • Frame Buffer — stores the color/intensity value for each pixel
  • Depth Buffer (Z-Buffer) — stores the depth (z-value) of the closest object at each pixel position

For every pixel, the algorithm checks whether the current polygon's depth is less than (closer to viewer) the value stored in the depth buffer. If yes, it updates both buffers.


Algorithm Steps

a. Initialize the depth buffer to the maximum depth value (farthest distance, typically 1 or ∞)

b. Initialize the frame buffer to the background color

c. For each polygon in the scene:

  • For each pixel (x,y)(x, y) that falls within the polygon's projection:
    • Calculate the depth value z(x,y)z(x, y) at that pixel
    • If z(x,y)z(x, y) < depth_buffer$(x, y)$:
      • Set depth_buffer$(x, y)$ = z(x,y)z(x, y)
      • Set frame_buffer$(x, y)$ = color of the polygon at (x,y)(x, y)

d. Display the frame buffer


Depth Calculation

For a plane with equation Ax+By+Cz+D=0Ax + By + Cz + D = 0, the depth at any point is:

z=AxByDCz = \frac{-Ax - By - D}{C}

For the next pixel along a scan line (x+1,y)(x+1, y):

z=zACz' = z - \frac{A}{C}

This incremental calculation makes the method efficient.


Advantages

  • Simple to implement
  • No sorting of surfaces is required
  • Can be implemented in hardware easily
  • Handles complex scenes with many polygons efficiently
  • Polygons can be processed in any order

Limitations

  • Large memory requirement — requires an entire depth buffer of the same resolution as the frame buffer (e.g., 1024×1024 pixels × 32 bits = 4 MB)
  • Aliasing effects — since it works at pixel level, edges appear jagged (staircase effect)
  • Cannot handle transparent surfaces — only the nearest surface is stored; translucency and transparency are difficult to implement
  • Depth precision problem (Z-fighting) — when two surfaces have nearly the same depth, flickering or incorrect display occurs due to limited precision of z-values
  • Overdraw problem — pixels may be shaded multiple times (wasted computation) since polygons are processed in arbitrary order
  • No reflection or shadow computation — it only determines visibility, not global illumination effects

How to Reduce These Limitations

Limitation Solution
Large memory Use scanline Z-buffer which processes one scan line at a time, reducing buffer to one row
Aliasing Apply anti-aliasing techniques (super-sampling, area averaging)
Transparency Use A-buffer (Accumulation buffer) which stores a list of surfaces at each pixel with opacity values
Z-fighting Increase depth buffer precision (use 32-bit instead of 16-bit), or offset overlapping polygons slightly
Overdraw Use front-to-back rendering with early depth testing, or apply spatial subdivision (BSP trees, octrees) to cull hidden objects before rasterization
Shadows Combine with shadow mapping techniques using a secondary depth buffer from light's viewpoint

Conclusion

The Z-Buffer method is the most widely used visible surface detection algorithm due to its simplicity and hardware compatibility. Its limitations regarding memory and aliasing are effectively overcome using modern techniques like the A-buffer, anti-aliasing, and hierarchical depth testing, making it the standard in real-time graphics and GPU architectures.

2.
What is the role of clipping? Plot the line with end points (20, 10) and (30, 18) using DDA.[10]
3.
List the rotation matrix in clockwise direction with respect to x-axis, y-axis and z-axis. Rotate the object (0, 0, 0), (2, 3, 0), (5, 4, 0) about the rotation axis y = 4.[10]
Section B

Short Answers Questions

Attempt any Eight questions.
[8*5=40]
4.
Write procedure to render the polygon surface by using Phong shading model. [5]
5.
Explain about parametric cubic curve with its properties. [5]
6.
Digitize circle with center (0, 0) and radius = 6. [5]
7.
Explain the use of polygon tables for boundary representations. [5]
8.
Differentiate between raster scan and random scan display systems. [5]
9.
What is intensity attenuation? Describe the various types of projection. [5]
10.
Explain about openGL and call back functions. [5]
11.
How the geometric and attribute information of a 3D objects are stored for the object representations? Explain with suitable example. [5]
12.
Write short notes on: a) Ambient light b) Diffuse reflection [5]