Tribhuwan University

Institute of Science and Technology

2080

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.
How can polygons be clipped? Describe Gouraud Shading model with necessary derivations.[10]

How Can Polygons Be Clipped? Describe Gouraud Shading Model with Necessary Derivations


Part A: Polygon Clipping

Polygon clipping is the process of removing portions of a polygon that lie outside a specified clipping window, while retaining and correctly connecting the portions that lie inside.

Sutherland-Hodgman Algorithm is the most common method for polygon clipping. It clips a polygon against each edge of the clipping window one at a time.

Working Principle:

The polygon (as a list of vertices) is clipped against each of the four boundaries (left, right, top, bottom) in sequence. For each boundary, the algorithm processes every edge of the polygon and produces a new list of vertices.

Four Cases for Each Edge (vertex SS to vertex $P$):

  • Case 1: Both SS and PP are inside → Add PP to output list
  • Case 2: SS is inside, PP is outside → Add intersection point II to output list
  • Case 3: Both SS and PP are outside → Add nothing
  • Case 4: SS is outside, PP is inside → Add intersection point II and then PP to output list

Diagram Description: Imagine a rectangular clipping window with a polygon partially inside and partially outside. The algorithm clips the polygon edge-by-edge against each window boundary, producing a new clipped polygon that fits entirely within the window.


Part B: Gouraud Shading Model

Gouraud Shading (also called intensity interpolation shading) is a polygon shading technique that calculates illumination at each vertex and then linearly interpolates the intensity values across the polygon surface.

Purpose: To eliminate intensity discontinuities at polygon boundaries and produce a smooth appearance for curved surfaces approximated by polygon meshes.

Steps in Gouraud Shading:

  • Step 1: Determine the average unit normal at each polygon vertex
  • Step 2: Apply an illumination model at each vertex to calculate vertex intensity
  • Step 3: Linearly interpolate intensities across the polygon surface

Derivation:

Step 1: Computing Vertex Normal

The normal at vertex VV is the average of normals of all polygons sharing that vertex:

NV=k=1nNkk=1nNk\vec{N}_V = \frac{\sum_{k=1}^{n} \vec{N}_k}{|\sum_{k=1}^{n} \vec{N}_k|}

where Nk\vec{N}_k are the normals of the nn polygons sharing vertex VV.

Step 2: Intensity at Each Vertex

Using any illumination model (e.g., Phong illumination):

IV=IaKa+IdKd(NVL)+IsKs(RV)nI_V = I_a K_a + I_d K_d (\vec{N}_V \cdot \vec{L}) + I_s K_s (\vec{R} \cdot \vec{V})^n

This gives intensity values I1I_1, I2I_2, I3I_3 at vertices of a triangle.

Step 3: Interpolation Along Edges

For a scan line at position yy, interpolate intensity along left and right edges:

Ia=I1+(I2I1)yy1y2y1I_a = I_1 + (I_2 - I_1) \cdot \frac{y - y_1}{y_2 - y_1}

Ib=I1+(I3I1)yy1y3y1I_b = I_1 + (I_3 - I_1) \cdot \frac{y - y_1}{y_3 - y_1}

where IaI_a and IbI_b are intensities at the left and right intersection points of the scan line with the polygon edges.

Step 4: Interpolation Along Scan Line

For a pixel at position xx on the scan line:

Ip=Ia+(IbIa)xxaxbxaI_p = I_a + (I_b - I_a) \cdot \frac{x - x_a}{x_b - x_a}

where xax_a and xbx_b are the x-coordinates of left and right edge intersections.


Advantages:

  • Eliminates Mach band effect between adjacent polygons
  • Computationally less expensive than Phong shading
  • Produces smooth shading for diffuse surfaces

Limitations:

  • Specular highlights may be averaged out or distorted
  • Linear interpolation can miss intensity peaks within polygons

Conclusion: Polygon clipping using Sutherland-Hodgman algorithm systematically clips against each window boundary. Gouraud shading provides smooth intensity variation across polygon meshes by interpolating vertex intensities, making it a widely used real-time rendering technique.

2.
Write the algorithm for Bresenham's line drawing? Digitize a line with end points A(6, 9) and B(10,5) using Bresenham's line drawing algorithm.[10]
3.
Differentiate between parallel and perspective projection. Perform the rotation of triangle with vertices A(5,7), B(12,85) and C(5,3) counterclockwise 30 degree about the pivot point (5,3).[10]
Section B

Short Answers Questions

Attempt any Eight questions.
[8*5=40]
4.
Explain motion capture with an example. [5]
5.
Explain about parametric curve. Describe the properties of Bezier curve. [5]
6.
Explain the wireframe representation of 3D objects. [5]
7.
How does a polygon can be created in OpenGL? Illustrate with an example. [5]
8.
Write short notes a. Z-Buffer b. Polygon Table [5]
9.
Explain architecture of random scan display systems with suitable diagram. [5]
10.
Explain Cohen-Sutherland Line Clipping algorithm with example. [5]
11.
Reflect a line segment having end points (9,3) and (12,10) about a line X = 7. Draw initial and final result graph as well. [5]
12.
Explain ambient light, diffuse reflection and specular reflection with examples. [5]