2082

BIT304 · TU past paper

Computer Graphics 2082 question paper

The complete TU 2082 exam paper for Computer Graphics (BIT304), all 12 questions with solved model answers written to the mark scheme.

Past Papers2082208120802079

Tap a question to open its answer.

  1. 110 marksNumericalDDA line drawing algorithmAnswer

    Bresenham's Circle Drawing Algorithm & DDA Line Algorithm Trace [10]

    Model Answer: Bresenham's Circle Drawing Algorithm & DDA Line Trace [10 marks]

    Given Data (Extracted)

    Part B (numeric):

    • Start point: $(x_1, y_1) = (2, 2)$
    • End point: $(x_2, y_2) = (6, 6)$

    Part A is descriptive (no numeric inputs required).


    Part A: Bresenham's Circle Drawing Algorithm [5 marks]

    Definition: Bresenham's circle drawing algorithm is an efficient scan-conversion technique that plots the pixels closest to a true circle using only integer arithmetic. It uses the eight-way symmetry of a circle, so it computes points only for one octant ($0°$ to $45°$) and reflects them to the other seven.

    Eight-Way Symmetry: For a point $(x, y)$ on a circle centered at origin, the following also lie on the circle:

    $$(x, y),\ (-x, y),\ (x, -y),\ (-x, -y),\ (y, x),\ (-y, x),\ (y, -x),\ (-y, -x)$$

    Algorithm Steps:

    1. Input radius $r$ and center $(x_c, y_c)$.
    2. Initialize starting point: $x = 0,\ y = r$.
    3. Compute initial decision parameter: $p_0 = 3 - 2r$.
    4. At each step, test $p_k$:
      • If $p_k < 0$: next point is $(x_k + 1,\ y_k)$ and $p_{k+1} = p_k + 4x_k + 6$
      • If $p_k \ge 0$: next point is $(x_k + 1,\ y_k - 1)$ and $p_{k+1} = p_k + 4(x_k - y_k) + 10$
    5. Plot all 8 symmetric points, translated by adding $(x_c, y_c)$.
    6. Repeat steps 4-5 until $x \ge y$.

    Advantages:

    • Uses only integer addition/subtraction (no multiplication or trigonometry)
    • Fast and hardware-friendly
    • Produces smooth, symmetric circles

    Part B: DDA Algorithm Trace - Line from $(2, 2)$ to $(6, 6)$ [5 marks]

    Step 1: Compute differences: $$dx = x_2 - x_1 = 6 - 2 = 4$$ $$dy = y_2 - y_1 = 6 - 2 = 4$$

    Step 2: Number of steps: $$steps = \max(|dx|, |dy|) = \max(4, 4) = 4$$

    Step 3: Increments: $$x_{inc} = \frac{dx}{steps} = \frac{4}{4} = 1, \qquad y_{inc} = \frac{dy}{steps} = \frac{4}{4} = 1$$

    Step 4: Iteration Table:

    Step$x$$y$Pixel Plotted $(\text{round}(x), \text{round}(y))$
    02.02.0(2, 2)
    13.03.0(3, 3)
    24.04.0(4, 4)
    35.05.0(5, 5)
    46.06.0(6, 6)

    Explanation: Slope $m = \dfrac{dy}{dx} = \dfrac{4}{4} = 1$ (a $45°$ line). Both $x$ and $y$ increase by exactly 1 each step, giving a perfect diagonal.

    Result: Pixels plotted: $(2,2), (3,3), (4,4), (5,5), (6,6)$ - five pixels forming a continuous diagonal line.

  2. 210 marksNumericalScaling transformation and matricesAnswer

    What is scaling in 3D graphics? Derive the scaling matrix for scaling along the X, Y, and Z axes. Apply the scaling transformation to a point (2,3,4) with scaling factors $S_x = 2$, $S_y = 3$, $S_z = 4$. [10]

    Scaling in 3D Graphics

    Step 1 - Given Data

    • Point: $P = (2, 3, 4)$
    • Scaling factors: $S_x = 2$, $S_y = 3$, $S_z = 4$

    Step 2 - Solution

    Definition of Scaling

    Scaling is a geometric transformation that alters the size of an object by multiplying each coordinate of its points by scaling factors along the coordinate axes. If all factors are equal, the scaling is uniform (shape preserved); if they differ, it is non-uniform (shape distorted). Scaling is performed relative to the origin unless a fixed point is specified.

    Derivation of the Scaling Matrix

    For a point $P(x, y, z)$, scaling produces $P'(x', y', z')$ such that each coordinate is multiplied by its scaling factor:

    $$x' = S_x \cdot x, \qquad y' = S_y \cdot y, \qquad z' = S_z \cdot z$$

    Writing this as a matrix relation on the 3-vector:

    $$ \begin{bmatrix} x' \ y' \ z' \end{bmatrix}

    \begin{bmatrix} S_x & 0 & 0 \ 0 & S_y & 0 \ 0 & 0 & S_z \end{bmatrix} \begin{bmatrix} x \ y \ z \end{bmatrix} $$

    The off-diagonal entries are zero because each new coordinate depends only on the corresponding old coordinate. To combine scaling with translation using a single uniform representation, we use homogeneous coordinates, giving the $4 \times 4$ scaling matrix:

    $$S = \begin{bmatrix} S_x & 0 & 0 & 0 \ 0 & S_y & 0 & 0 \ 0 & 0 & S_z & 0 \ 0 & 0 & 0 & 1 \end{bmatrix}$$

    The bottom-right element is $1$ so that the homogeneous component ($w = 1$) is unchanged.

    Application to the Point (2, 3, 4)

    Step 1: Construct the scaling matrix

    $$S = \begin{bmatrix} 2 & 0 & 0 & 0 \ 0 & 3 & 0 & 0 \ 0 & 0 & 4 & 0 \ 0 & 0 & 0 & 1 \end{bmatrix}$$

    Step 2: Point in homogeneous coordinates

    $$P = \begin{bmatrix} 2 \ 3 \ 4 \ 1 \end{bmatrix}$$

    Step 3: Apply $P' = S \cdot P$

    $$ P' = \begin{bmatrix} 2 & 0 & 0 & 0 \ 0 & 3 & 0 & 0 \ 0 & 0 & 4 & 0 \ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 2 \ 3 \ 4 \ 1 \end{bmatrix}

    \begin{bmatrix} 2 \times 2 \ 3 \times 3 \ 4 \times 4 \ 1 \end{bmatrix}

    \begin{bmatrix} 4 \ 9 \ 16 \ 1 \end{bmatrix} $$

    Final Result

    $$\boxed{P' = (4,\ 9,\ 16)}$$

    The point $(2, 3, 4)$ scales to $(4, 9, 16)$ under factors $S_x = 2$, $S_y = 3$, $S_z = 4$.

  3. 310 marksBezier curves and propertiesAnswer

    Describe the concept of Bezier curves in 3D modeling. Derive the equation for a Bezier curve and discuss how it is used in curve modeling and animation.[10]

    A Bezier curve is a parametric curve defined by a set of control points that influence the shape of the curve without necessarily lying on it. The curve is smooth and continuous, making it ideal for modeling complex shapes in 3D graphics...

  4. 45 marksRasterization and rendering conceptsAnswer

    Discuss how rasterization and rendering help in generating a realistic image from a 3D model and what factors affect the quality of the rendered output. [5]

    Rasterization and Rendering in 3D Image Generation

    Overview

    Rasterization and rendering are fundamental processes that convert 3D geometric models into 2D pixel-based images suitable for display. Together, they bridge the gap between mathematical 3D scene descriptions and visual output.

    How Rasterization and Rendering Generate Realistic Images

    Rasterization Process

    • Converts 3D primitives (triangles, polygons) into 2D screen coordinates
    • Projects 3D vertices onto the 2D viewport using transformation matrices
    • Determines which pixels are covered by each primitive (scan conversion)
    • Interpolates attributes (color, texture coordinates, normals) across pixels

    Rendering Process

    • Applies lighting models to calculate pixel colors based on material properties and light sources
    • Performs shading calculations (Phong, Gouraud, or flat shading) at vertices or pixels
    • Applies textures to add surface detail without geometric complexity
    • Handles visibility through depth testing (z-buffer) to determine which surfaces are visible

    Combined Effect

    The two processes work together to:

    1. Transform 3D geometry to screen space (rasterization)
    2. Calculate realistic colors and lighting (rendering)
    3. Produce final 2D image with depth, shading, and texture

    Factors Affecting Rendered Output Quality

    FactorImpact
    ResolutionHigher pixel density produces sharper, more detailed images
    Shading ModelAdvanced models (Phong, PBR) produce more realistic lighting than flat shading
    Texture QualityHigh-resolution textures with proper filtering reduce aliasing and blur
    Lighting SetupNumber and placement of lights, shadow mapping affect realism
    Anti-aliasingMSAA, FXAA reduce jagged edges and improve smoothness
    Depth PrecisionZ-buffer precision affects visibility accuracy and prevents z-fighting
    Polygon CountMore triangles capture finer geometric details
    Material PropertiesSpecular, diffuse, normal maps enhance surface realism

    Conclusion

    Rasterization efficiently converts 3D geometry to screen space, while rendering applies visual effects and lighting. Quality depends on balancing geometric detail, texture resolution, lighting complexity, and anti-aliasing techniques within performance constraints.

  5. 55 marksTranslation transformationAnswer

    Explain the concept of translation transformation in 2D graphics. Discuss the effect of translation on objects. [5]

    Translation is a geometric transformation that moves every point of an object by a fixed distance in a specified direction. It shifts an object from one position to another without changing its shape, size, or orientation. For a point P(...

  6. 65 marksNumericalSutherland-Hodgman polygon clipping algoriAnswer

    Given a polygon with vertices $A(3, 4)$, $B(7, 4)$, $C(7, 8)$, $D(3, 8)$, clip it against a rectangular window with coordinates $(4, 5)$, $(6, 7)$ using Sutherland-Hodgman polygon clipping algorithm. [5]

    Polygon vertices (in order): - A(3, 4) - B(7, 4) - C(7, 8) - D(3, 8) Clipping window (rectangle): - Lower-left corner: (4, 5) - Upper-right corner: (6, 7) Derived window edges: - Left: $x{min} = 4$ - Right: $x{max} = 6$ - Bottom:

  7. 75 marksObject space techniquesAnswer

    What are object space techniques in visible surface detection? Explain how these techniques are used in 3D graphics. [5]

    Object Space Techniques in Visible Surface Detection

    Definition

    Object space techniques are methods for determining which surfaces are visible in a 3D scene by performing visibility calculations in the original coordinate system of the 3D objects (object space), before projection to the screen.

    Key Characteristics

    Object space techniques work directly with 3D geometric data and determine visibility relationships between objects and surfaces in their native 3D coordinates.

    Main Object Space Techniques

    1. Depth Sorting (Painter's Algorithm)

    • Sorts all surfaces by their depth (distance from viewer)
    • Renders surfaces from back to front
    • Surfaces rendered last appear on top
    • Simple but can fail with intersecting or cyclic depth relationships

    2. Binary Space Partition (BSP) Trees

    • Recursively divides 3D space using planes
    • Organizes surfaces into a tree structure
    • Allows efficient visibility determination by traversing the tree from viewer's position
    • Particularly useful for static scenes

    3. Back-Face Culling

    • Eliminates surfaces facing away from the viewer
    • Uses surface normal vectors to determine orientation
    • Reduces number of surfaces requiring visibility testing
    • Efficient preprocessing step

    Application in 3D Graphics

    Advantages:

    • Works with exact geometric data before rasterization
    • Can handle complex spatial relationships precisely
    • Useful for scenes with many overlapping objects
    • Enables efficient culling of invisible geometry

    Disadvantages:

    • Computationally expensive for large scenes
    • Difficult to handle intersecting surfaces
    • Less efficient than image space methods for complex scenes

    Usage: Object space techniques are commonly used in game engines and CAD systems for preprocessing and organizing scene geometry before rendering.

  8. 85 marksScan-line method for visible surface detecAnswer

    Describe the Scan-Line method for visible surface detection. Write its advantages and limitations. [5]

    The Scan-Line method is an image-space algorithm that determines visible surfaces by processing the scene one horizontal line (scan line) at a time across the viewport. Working Principle: 1. Scan Line Processing: The image plane is divid...

  9. 95 marksAmbient light and ambient reflectionAnswer

    Explain the concept of ambient reflection in the context of illumination models. How does it affect the overall lighting in a 3D scene? [5]

    Ambient reflection is the component of light reflection that accounts for indirect, non-directional illumination in a 3D scene. It represents light that has been scattered and reflected multiple times throughout the environment, coming f...

  10. 105 marksGouraud shading model and derivationsAnswer

    Describe the Gouraud Shading model. How does Gouraud shading improve the rendering of 3D objects compared to constant shading? [5]

    Gouraud shading is an interpolation-based shading technique that computes color values at polygon vertices and then linearly interpolates these colors across the surface of each polygon during rasterization. It provides a smooth appearan...

  11. 115 marksVirtual reality and VR system componentsAnswer

    What is virtual reality? Describe the components of VR system. [5]

    Virtual Reality: Definition and Components

    What is Virtual Reality?

    Virtual Reality (VR) is a computer-generated simulation of a three-dimensional environment that can be interacted with using special electronic equipment. It creates an immersive experience where users feel present in and can interact with a completely artificial digital world, often in real-time. VR aims to provide a sense of immersion and presence, making users believe they are actually inside the simulated environment.

    Components of a VR System

    A complete VR system typically consists of the following key components:

    1. Display Device (Head-Mounted Display - HMD)

    • Provides the visual output to the user
    • Displays stereoscopic images (separate images for each eye) to create depth perception
    • Examples: VR headsets like Oculus Rift, HTC Vive, PlayStation VR
    • Creates the immersive visual experience

    2. Tracking System

    • Monitors the user's head position and orientation in real-time
    • Tracks hand/controller movements and body position
    • Uses sensors like accelerometers, gyroscopes, and magnetometers
    • Enables the system to update the display based on user movement

    3. Input Devices (Controllers/Interaction Devices)

    • Allow users to interact with the virtual environment
    • Include hand controllers, gloves, joysticks, or gesture recognition systems
    • Enable selection, manipulation, and navigation within the VR world
    • Provide haptic feedback in advanced systems

    4. Processing Unit (Computer/Console)

    • Generates and renders the virtual environment in real-time
    • Processes user input and tracking data
    • Performs calculations for physics, collision detection, and graphics rendering
    • Requires significant computational power for smooth performance

    5. Audio System

    • Provides spatial/3D sound to enhance immersion
    • Delivers directional audio cues that match the visual environment
    • Includes headphones or speakers integrated into the HMD

    6. Software (VR Applications)

    • Contains the virtual environment and interactive content
    • Manages user interactions and environment responses
    • Handles graphics rendering, physics simulation, and event logic

    These components work together to create a cohesive, immersive virtual reality experience.

  12. 125 marksArea subdivision methodAnswer

    Write short notes on: a) Area subdivision method Write short notes on: b) OpenGL viewing [2.5+2.5]

    Model Answer: Area Subdivision Method & OpenGL Viewing

    a) Area Subdivision Method (2.5 marks)

    Definition: Area subdivision method is a visible surface determination algorithm that recursively subdivides the projection plane (viewing area) into smaller rectangular regions until each region contains a simple case that can be easily resolved.

    Basic Principle:

    • Divide the display area into quadrants
    • For each quadrant, test whether it is simple (can be easily classified)
    • If not simple, subdivide further recursively
    • Continue until all regions are resolved

    Algorithm Steps:

    1. Start with the entire viewing area
    2. Classify the area based on object relationships:
      • Trivial Accept: All surfaces are in front (visible)
      • Trivial Reject: All surfaces are behind (invisible)
      • Ambiguous: Surfaces overlap - requires subdivision
    3. If ambiguous, divide into 4 equal quadrants
    4. Recursively apply the same process to each quadrant
    5. Stop when reaching pixel level or trivial case

    Advantages:

    • Efficient for complex scenes with many overlapping surfaces
    • Naturally handles antialiasing
    • Works well with hierarchical data structures

    Disadvantages:

    • Can be computationally expensive for simple scenes
    • Requires careful implementation of classification tests

    b) OpenGL Viewing (2.5 marks)

    Definition: OpenGL viewing defines how 3D scene objects are transformed and projected onto a 2D display surface through a series of coordinate transformations.

    Viewing Pipeline (Transformation Sequence):

    1. Model Transformation: Positions objects in world coordinates
    2. View Transformation: Positions camera/viewer in the scene
    3. Projection Transformation: Defines viewing volume (perspective or orthographic)
    4. Viewport Transformation: Maps to screen coordinates

    Key Components:

    ComponentPurpose
    Camera PositionEye/viewpoint location in world space
    Look-at PointTarget point the camera views
    Up VectorDefines camera orientation
    Projection TypeOrthographic (parallel) or Perspective
    Clipping PlanesNear and far planes defining visible depth range

    Common OpenGL Functions:

    • gluLookAt(): Sets camera position, target, and up vector
    • glOrtho(): Defines orthographic projection
    • glPerspective(): Defines perspective projection
    • glViewport(): Sets viewport dimensions

    Viewing Volume:

    • Orthographic: Rectangular box (parallel projection)
    • Perspective: Frustum/pyramid shape (converges to eye point)