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.
- 110 marksNumericalThree-Dimensional ViewingHideAnswer
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...
- 210 marksBinary Space Partition TreesHideAnswer
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 ...
- 310 marksApplication of VRHideAnswer
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:
-
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.
-
Entertainment and Gaming: VR creates fully immersive gaming and entertainment experiences where users feel physically present inside the virtual world, greatly enhancing user experience.
-
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.
-
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.
-
Scientific Visualization: Scientists use VR to visualize complex data, molecular structures, astronomical phenomena, and simulations that are otherwise impossible to observe directly.
-
Military and Defense: VR is used for battlefield simulations, vehicle operation training, and strategic planning without putting soldiers in actual danger.
-
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.
Basis Virtual Reality (VR) Augmented Reality (AR) Definition Creates an entirely virtual world using software A mix of the real world and the virtual world Real World Completely replaces the real world with a simulated environment Superimposes digital information on the real world Distinction It is hard to differentiate between what is real and what is not real Users can clearly distinguish between the real and virtual elements Hardware Used Generally achieved by wearing a helmet or goggles having VR technology Achieved by holding a smartphone or using AR glasses in front of us Immersion Level Fully immersive; user is isolated from the real world Partially immersive; user remains aware of the real world Types Single type of fully simulated environment Markerless 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()andglEnd()functions along withglVertex2f()orglVertex3f()to specify the vertices of the polygon.Key OpenGL Functions Used:
glBegin(GL_POLYGON)- Starts the definition of a polygonglVertex2f(x, y)- Specifies a 2D vertex of the polygonglEnd()- Ends the definition of the polygonglColor3f(r, g, b)- Sets the drawing colorglClear(GL_COLOR_BUFFER_BIT)- Clears the screenglFlush()- 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:
Step Function Purpose 1 glutInit()Initializes the GLUT library 2 glutInitDisplayMode()Sets single buffer and RGB color mode 3 glutInitWindowSize()Sets the width and height of the display window 4 glutInitWindowPosition()Fixes the position of the window on the screen 5 glutCreateWindow()Creates the window and gives it a title 6 glClearColor()Sets the background colour of the window 7 glutDisplayFunc()Registers the callback function that draws the scene 8 glutMainLoop()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 betweenglBegin(GL_POLYGON)andglEnd()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. -
- 45 marksRepresenting CurvesHideAnswer
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...
- 55 marksNumericalScan Converting Circle and EllipseHideAnswer
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...
- 65 marksRepresenting CurvesHideAnswer
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+1control 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
nforn+1control 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 pointsN_{k,d}(t)= B-Spline basis functions of degreed- The basis functions are defined recursively using the Cox-de Boor recursion formula.
Advantages over Bezier Curves
Feature Bezier B-Spline Degree vs control points Degree depends on number of control points Degree can be set independently of control points Control Global control Local control over curve shape Complexity Simpler More 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
Feature Fractal Bezier Curve B-Spline Curve Nature Self-similar geometric figure Parametric approximation curve Piecewise polynomial curve Control N/A Global (all control points) Local (individual control points) Degree Fractional dimension Depends on control points Independent of control points Use Natural shapes, terrain CAD, font design CAD, surface modeling - 75 marksNumericalTwo-Dimensional translation, Rotation, ScaHideAnswer
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...
- 85 marksPolygon SurfaceHideAnswer
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...
- 95 marksPolygon Rendering MethodsHideAnswer
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 Shading Phong 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.
- 105 marksBack Face Detection, Depth BufferHideAnswer
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.
Feature Real-Time Rendering Offline Rendering Speed Renders frames instantly (30-60+ FPS) Can take minutes/hours per frame Use Case Games, simulations, interactive apps Movies, animations, visual effects Interactivity High - user can interact immediately Low - no real-time feedback Key Advantages of Real-Time Rendering:
-
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.
-
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.
-
Immediate Feedback: Designers and developers can see the result of changes immediately, which speeds up the development and testing process.
-
Lower Latency: In simulations (flight simulators, surgical training), real-time rendering ensures that the system responds to user input without noticeable delay.
-
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) = 0andframebuffer(x, y) = background color - For each polygon, calculate depth
zat each pixel(x, y) - If
z > depthbuffer(x, y), update the depth buffer and frame buffer with the new surface color
Limitations:
-
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).
-
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.
-
Aliasing Problems:
- Because depth comparisons are done per pixel, the algorithm can produce aliasing artifacts (jagged edges) along polygon boundaries.
-
No Support for Shadows Directly:
- The standard Z-buffer algorithm does not inherently compute shadows. Additional techniques (like shadow mapping) must be added separately.
-
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.
-
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.
-
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.
-
- 115 marksArea FillingHideAnswer
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...
- 125 marksQuadric SurfaceHideAnswer
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...