2078

CSC214 · TU past paper

Computer Graphics 2078 question paper

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

Tap a question to open its answer.

  1. 110 marksNumericalThree-Dimensional ViewingAnswer

    Question

    Define orthographic, parallel, and perspective projections. Consider a region defined by the position vector P below, relative to global XYZ axis system. It is rotated by +30° about X-axis and passes through points (1.5, 1.5, 1.5). Find the final position of the region.

    $$P = \begin{bmatrix} 1 & 1 & 2 & 1 \ 2 & 1 & 2 & 1 \ 2 & 2 & 2 & 1 \ 1 & 2 & 2 & 1 \end{bmatrix}$$

    [10]

    Parallel Projection: The projectors (lines joining object points to the view plane) are parallel to each other; the centre of projection is located at infinity. It preserves relative proportions and is used for engineering/technical draw...

  2. 210 marksBinary Space Partition TreesAnswer

    What is the method to recognize boundary point and interior point in solid modeling? Describe how BSP recursively subdivided a space into convex sets.[10]

    --- Solid modeling is the representation of solid parts of an object on a computer. It is the most advanced method of geometric modeling in three dimensions. It provides a complete geometric data representation of an object that enables ...

  3. 310 marksApplication of VRAnswer

    List some significance of virtual reality. Differentiate between virtual reality and augmented reality with example. Demonstrate how a polygon can be created using OpenGL.[10]

    Virtual Reality: Significance, VR vs AR, and Polygon Creation in OpenGL


    1. Significance of Virtual Reality (4 marks)

    Virtual Reality (VR) is an artificial environment created with software and presented to the user in such a way that the user suspends belief and accepts it as a real environment. It uses computer technology to create a simulated, interactive 3D environment.

    The key significances of Virtual Reality are:

    1. Education and Training: VR provides a safe and controlled simulated environment for training purposes. Medical students can practice surgeries, pilots can practice flying, and soldiers can practice combat scenarios without real-world risk.

    2. Entertainment and Gaming: VR creates fully immersive gaming and entertainment experiences where users feel physically present inside the virtual world, greatly enhancing user experience.

    3. Healthcare and Therapy: VR is used in pain management, rehabilitation, treatment of phobias (exposure therapy), and post-traumatic stress disorder (PTSD) treatment by simulating controlled therapeutic environments.

    4. Architecture and Design: Architects and designers use VR to create virtual walkthroughs of buildings and structures before they are physically built, helping clients visualize the final product.

    5. Scientific Visualization: Scientists use VR to visualize complex data, molecular structures, astronomical phenomena, and simulations that are otherwise impossible to observe directly.

    6. Military and Defense: VR is used for battlefield simulations, vehicle operation training, and strategic planning without putting soldiers in actual danger.

    7. Natural Interaction: VR supports natural input devices such as joysticks, tracking balls, data gloves, and motion platforms, allowing users to interact with the virtual environment in an intuitive and immersive manner.


    2. Difference Between Virtual Reality (VR) and Augmented Reality (AR) (3 marks)

    Augmented Reality (AR) is the technology that expands our physical world by adding layers of digital information (such as sound, images, and text) on top of the real world we see.

    BasisVirtual Reality (VR)Augmented Reality (AR)
    DefinitionCreates an entirely virtual world using softwareA mix of the real world and the virtual world
    Real WorldCompletely replaces the real world with a simulated environmentSuperimposes digital information on the real world
    DistinctionIt is hard to differentiate between what is real and what is not realUsers can clearly distinguish between the real and virtual elements
    Hardware UsedGenerally achieved by wearing a helmet or goggles having VR technologyAchieved by holding a smartphone or using AR glasses in front of us
    Immersion LevelFully immersive; user is isolated from the real worldPartially immersive; user remains aware of the real world
    TypesSingle type of fully simulated environmentMarkerless AR, Marker-based AR, Projection-based AR, Superimposition-based AR

    Examples:

    • VR Example: A user wearing an Oculus Rift headset is completely immersed in a virtual game world such as a battlefield or a fantasy land. The user sees nothing of the real world.

    • AR Example: Using the smartphone app Pokemon Go, virtual Pokemon characters are superimposed on the real-world camera view. The user sees both the real street and the virtual Pokemon at the same time.


    3. Creating a Polygon Using OpenGL (3 marks)

    OpenGL (Open Graphics Library) is a general-purpose graphics programming package that contains graphics functions used with high-level programming languages like C, C++, Java, etc.

    In OpenGL, a polygon can be created using the glBegin() and glEnd() functions along with glVertex2f() or glVertex3f() to specify the vertices of the polygon.

    Key OpenGL Functions Used:

    • glBegin(GL_POLYGON) - Starts the definition of a polygon
    • glVertex2f(x, y) - Specifies a 2D vertex of the polygon
    • glEnd() - Ends the definition of the polygon
    • glColor3f(r, g, b) - Sets the drawing color
    • glClear(GL_COLOR_BUFFER_BIT) - Clears the screen
    • glFlush() - Forces execution of OpenGL commands

    Complete Program to Draw a Triangle (3-sided Polygon):

    #include <GL/glut.h>
    
    void display() {
        // Clear the screen with background color
        glClear(GL_COLOR_BUFFER_BIT);
    
        // Set the drawing color to red (R=1, G=0, B=0)
        glColor3f(1.0, 0.0, 0.0);
    
        // Begin drawing a polygon (triangle)
        glBegin(GL_POLYGON);
            glVertex2f(0.0, 0.5);    // Top vertex
            glVertex2f(-0.5, -0.5);  // Bottom-left vertex
            glVertex2f(0.5, -0.5);   // Bottom-right vertex
        glEnd();
    
        // Flush the drawing to the screen
        glFlush();
    }
    
    int main(int argc, char** argv) {
        // Initialize GLUT
        glutInit(&argc, argv);
    
        // Set display mode
        glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    
        // Set window size
        glutInitWindowSize(500, 500);
    
        // Set window position
        glutInitWindowPosition(100, 100);
    
        // Create the window with a title
        glutCreateWindow("Polygon using OpenGL");
    
        // Set background color to white
        glClearColor(1.0, 1.0, 1.0, 0.0);
    
        // Register display callback function
        glutDisplayFunc(display);
    
        // Enter the GLUT event loop
        glutMainLoop();
    
        return 0;
    }
    

    Explanation of Steps:

    StepFunctionPurpose
    1glutInit()Initializes the GLUT library
    2glutInitDisplayMode()Sets single buffer and RGB color mode
    3glutInitWindowSize()Sets the width and height of the display window
    4glutInitWindowPosition()Fixes the position of the window on the screen
    5glutCreateWindow()Creates the window and gives it a title
    6glClearColor()Sets the background colour of the window
    7glutDisplayFunc()Registers the callback function that draws the scene
    8glutMainLoop()Enters the event loop so the window stays on screen

    Running this program draws a solid red triangle on a white background, which is the simplest polygon OpenGL can render. Adding further glVertex2f() calls between glBegin(GL_POLYGON) and glEnd() produces a polygon with as many sides as vertices supplied, and the vertices must be given in order around the boundary so that the polygon stays simple and convex.

  4. 45 marksRepresenting CurvesAnswer

    Discuss the strength and weakness of the human visual system. Describe Spline representation for the curve. [5]

    --- (Standard CS/Graphics knowledge, Do not cover this topic directly.) Strength ------------- 1 Wide dynamic range: The human eye can adapt to a very large range of light intensities, from bright sunlight to dim moonlight. 2 Color perce...

  5. 55 marksNumericalScan Converting Circle and EllipseAnswer

    Plot the 1st octant of a circle centered at origin, having the radius 10 units. [5]

    • Center: origin $(0, 0)$ - Radius: $r = 10$ units - Required: 1st octant only (arc from $(0, 10)$ to the $x = y$ line, i.e. 90° to 45°) Starting point: $(x0, y0) = (0, r) = (0, 10)$ Initial decision parameter: $$p0 = 1 - r = 1 - 10 = -9...
  6. 65 marksRepresenting CurvesAnswer

    Define fractal. Explain the Bezier curve and B-Spline curve. [5]

    Fractal, Bezier Curve, and B-Spline Curve


    1. Fractal (Definition)

    A fractal is a geometric figure or natural phenomenon that exhibits self-similarity at every scale of magnification. This means a fractal looks similar (or identical) when zoomed in or out at any level. Fractals are used in computer graphics to model complex natural shapes such as mountains, clouds, coastlines, and trees that cannot be easily described by classical Euclidean geometry.

    Key properties of fractals:

    • Self-similarity: Each part resembles the whole.
    • Fractional dimension: They have non-integer (fractional) dimensions.
    • Infinite detail: They show complexity at every level of magnification.

    Example: Koch Snowflake, Sierpinski Triangle, Mandelbrot Set.


    2. Bezier Curve

    As noted in the reference, the Bezier spline was developed by French engineer Pierre Bezier and is widely used in CAD systems for curve and surface design.

    Definition

    A Bezier curve is a parametric curve defined using a set of control points. It does not necessarily pass through all control points (except the first and last); instead, it approximates the shape defined by those points.

    Blending Functions (Bernstein Polynomials)

    For n+1 control points P0, P1, ..., Pn, the Bezier curve is defined as:

    $$Q(t) = \sum_{k=0}^{n} P_k \cdot B_{k,n}(t), \quad 0 \leq t \leq 1$$

    Where the blending functions (Bernstein basis polynomials) are:

    $$B_{k,n}(t) = \binom{n}{k} t^k (1-t)^{n-k}$$

    Properties of Bezier Curves

    • The curve passes through the first and last control points.
    • The curve lies within the convex hull of the control points.
    • The degree of the curve is n for n+1 control points.
    • Changing any one control point affects the entire curve (global control).
    • Easy to implement and widely available in CAD systems.

    3. B-Spline Curve

    As stated in the reference, B-Splines are the most widely used class of approximating splines.

    Definition

    A B-Spline (Basis Spline) curve is a piecewise polynomial curve defined by a set of control points and a knot vector. It generalizes the Bezier curve and provides greater flexibility.

    $$Q(t) = \sum_{k=0}^{n} P_k \cdot N_{k,d}(t)$$

    Where:

    • P_k = control points
    • N_{k,d}(t) = B-Spline basis functions of degree d
    • The basis functions are defined recursively using the Cox-de Boor recursion formula.

    Advantages over Bezier Curves

    FeatureBezierB-Spline
    Degree vs control pointsDegree depends on number of control pointsDegree can be set independently of control points
    ControlGlobal controlLocal control over curve shape
    ComplexitySimplerMore complex

    Properties of B-Spline Curves

    • Provides local control: modifying one control point affects only a portion of the curve.
    • The degree of the curve can be chosen independently of the number of control points.
    • The curve lies within the convex hull of the control points.
    • More flexible for modeling complex shapes.
    • Disadvantage: More complex to implement than Bezier splines.

    Summary Table

    FeatureFractalBezier CurveB-Spline Curve
    NatureSelf-similar geometric figureParametric approximation curvePiecewise polynomial curve
    ControlN/AGlobal (all control points)Local (individual control points)
    DegreeFractional dimensionDepends on control pointsIndependent of control points
    UseNatural shapes, terrainCAD, font designCAD, surface modeling
  7. 75 marksNumericalTwo-Dimensional translation, Rotation, ScaAnswer

    Find the new c-coordinate of the triangle ABC, with co-ordinates A(0, 0), B(1, 1) and C(5, 2) after it has been magnified to twice of its size. [5]

    Given data: - Triangle vertices: - $A(0, 0)$ - $B(1, 1)$ - $C(5, 2)$ - Transformation: magnify to twice the size, so scaling factors $Sx = 2$, $Sy = 2$ The question specifically asks for the new C-coordinate. --- Uniform scaling by facto...

  8. 85 marksPolygon SurfaceAnswer

    What is the task of a polygon table? Why do we have to remove hidden surfaces? Explain with any one methodology. [5]

    --- A polygon table is the specification of polygon surfaces using vertex coordinates and other attributes. It organizes the geometric and qualitative data needed to describe a 3D object. Polygon tables are organized into two groups: Thr...

  9. 95 marksPolygon Rendering MethodsAnswer

    Define intensity attenuation. Distinguish between Gouraud shading and Phong shading model. [5]

    Intensity Attenuation and Shading Models


    Intensity Attenuation (2 marks)

    Definition: The rate of decrease in intensity with respect to the distance between the light source and objects is called intensity attenuation.

    • If a point light source is used, the intensity attenuation is given by:

    $$\text{Attenuation} = \frac{1}{d^2}$$

    where d is the distance between the light source and the object.

    • If a distributed light source is used, the intensity attenuation factor is given by the function:

    $$f(d) = \frac{1}{a_0 + a_1 d + a_2 d^2}$$

    where:

    • $a_0$, $a_1$, $a_2$ are surface (attenuation) parameters
    • $d$ is the distance between the object and the distributed light source

    Distinction Between Gouraud Shading and Phong Shading (3 marks)

    S.No.Gouraud ShadingPhong Shading
    1.Named after Henri Gouraud.Named after Bui Tuong Phong.
    2.Computes illumination at border vertices and interpolates intensity/color at every interior point of the polygon surface.Computes illumination by interpolating surface normals at every pixel and then applying the lighting equation per pixel.
    3.Interpolates colors along edges and scan lines.Interpolates normals instead of colors.
    4.Less expensive computationally.More expensive than Gouraud shading.
    5.Lighting equation is applied at each vertex.Lighting equation is applied at each pixel.
    6.Requires moderate processing and time; produces acceptable quality.Requires complex processing and is slower, but produces better (more realistic) quality images.

    Summary: Gouraud shading is faster but may miss specular highlights at polygon interiors since it only evaluates lighting at vertices. Phong shading is more realistic because it evaluates the lighting model at every pixel using interpolated normals, making it the more preferred method for high-quality rendering despite its higher computational cost.

  10. 105 marksBack Face Detection, Depth BufferAnswer

    What is the advantage of real time rendering over offline rendering? Discuss the limitation of Z-Buffer algorithm. [5]

    Advantages of Real-Time Rendering over Offline Rendering & Limitations of Z-Buffer Algorithm


    Part 1: Advantages of Real-Time Rendering over Offline Rendering

    Real-time rendering and offline rendering are two major approaches used in computer graphics.

    FeatureReal-Time RenderingOffline Rendering
    SpeedRenders frames instantly (30-60+ FPS)Can take minutes/hours per frame
    Use CaseGames, simulations, interactive appsMovies, animations, visual effects
    InteractivityHigh - user can interact immediatelyLow - no real-time feedback

    Key Advantages of Real-Time Rendering:

    1. Interactivity: The user can interact with the scene immediately. Changes in viewpoint, lighting, or object positions are reflected instantly on screen. This is essential for games and simulations.

    2. Speed: Frames are generated fast enough to give the illusion of smooth motion (typically 30 or more frames per second), making it suitable for real-time applications.

    3. Immediate Feedback: Designers and developers can see the result of changes immediately, which speeds up the development and testing process.

    4. Lower Latency: In simulations (flight simulators, surgical training), real-time rendering ensures that the system responds to user input without noticeable delay.

    5. Cost Efficiency in Time: Although offline rendering produces higher quality, real-time rendering saves enormous amounts of computation time for interactive applications.


    Part 2: Limitations of the Z-Buffer Algorithm

    The Z-Buffer (Depth Buffer) algorithm is a widely used visible surface detection method. The algorithm works as follows:

    • Initialize depthbuffer(x, y) = 0 and framebuffer(x, y) = background color
    • For each polygon, calculate depth z at each pixel (x, y)
    • If z > depthbuffer(x, y), update the depth buffer and frame buffer with the new surface color

    Limitations:

    1. Large Memory Requirement:

      • The Z-buffer requires a separate depth buffer of the same size as the frame buffer. For high-resolution displays, this requires a significant amount of memory (one depth value per pixel).
    2. Limited Handling of Transparent Surfaces:

      • The basic Z-buffer algorithm cannot correctly handle transparent surfaces. Since it only stores one depth value per pixel, it cannot blend colors from multiple overlapping transparent objects properly.
    3. Aliasing Problems:

      • Because depth comparisons are done per pixel, the algorithm can produce aliasing artifacts (jagged edges) along polygon boundaries.
    4. No Support for Shadows Directly:

      • The standard Z-buffer algorithm does not inherently compute shadows. Additional techniques (like shadow mapping) must be added separately.
    5. Precision Issues (Z-Fighting):

      • When two surfaces are very close in depth, limited floating-point precision in the depth buffer causes z-fighting, where pixels flicker between two surfaces.
    6. Wasted Processing:

      • All polygons are processed regardless of whether they are ultimately visible. There is no early rejection of hidden geometry, leading to overdraw and wasted computation.
    7. Cannot Handle Cyclic Overlapping:

      • If three or more polygons overlap each other cyclically (A in front of B, B in front of C, C in front of A), the Z-buffer may not resolve the visibility correctly.

    Summary

    The Z-buffer is simple and easy to implement but suffers from high memory usage, precision problems, inability to handle transparency and shadows natively, and aliasing issues. Real-time rendering, despite lower quality than offline rendering, is preferred wherever interactivity and speed are critical requirements.

  11. 115 marksArea FillingAnswer

    Describe the requirement for line clipping. Explain the scan line polygon filling algorithm. [5]

    --- Line clipping is the process of removing (clipping) portions of a line that lie outside a defined clipping window, retaining only the visible portion inside the window. 1. Clipping Window Definition: A rectangular clipping window mus...

  12. 125 marksQuadric SurfaceAnswer

    What is quadric surface? Compare between diffuse reflection and specular reflection. [5]

    --- A quadric surface is a frequently used class of 3D objects described by second-degree (quadratic) equations. These surfaces are defined mathematically using polynomials of degree two in x, y, and z. Common examples of quadric surface...