Computer Graphics Core Concepts: Display, Rendering, Algorithms

Display Technologies: Beam Penetration vs. Shadow Mask

Beam PenetrationShadow Mask
Used in older color CRTs.Used in modern color CRTs/LCDs.
Two layers of phosphor (red & green); beam depth controls color.Three separate phosphors (R, G, B) and a mask to direct beams.
Limited color range (4–7 colors).Millions of colors possible.
Cheaper.Higher cost.
Lower image quality.High image quality.

Graphics Rendering: Raster Scan vs. Vector Scan

Raster ScanVector Scan
Displays image as a matrix of pixels.Draws image directly as a set of lines.
Refreshes entire screen sequentially.Refreshes only the lines needed.
Used in TVs, modern monitors.Used in oscilloscopes, plotters.
Produces jagged edges for curves.Produces smooth lines.
Requires frame buffer.Requires display list (vector memory).

Object Space vs. Image Space in Computer Graphics

AspectObject SpaceImage Space
Working Domain3D coordinates (world/view space)2D coordinates (screen space)
Data TypeVertices, edges, polygonsPixels/fragments
Visibility TestsPer object/polygonPer pixel
Example AlgorithmBack-face removal, bounding volume testsZ-buffer, scan-line
SpeedOften faster for culling large objectsSlower if many unnecessary pixels
AccuracyHigh for geometryHigh for final pixel colors

Computer Graphics Fundamentals

What is a Computer?

A computer is an electronic device that accepts data as input, processes it according to instructions, and produces output.

Advantages of Computer Graphics

  • Visual representation of data.
  • Easy understanding of complex concepts.
  • Interactive communication.
  • Realistic image generation.

Application Areas of Computer Graphics

  • CAD (Computer-Aided Design)
  • Animation & Gaming
  • Scientific Visualization
  • Virtual Reality & Simulation
  • Education & Training

Z-Buffer Algorithm

The Z-Buffer algorithm is a common technique for hidden surface removal in 3D computer graphics.

Step 1: Initialize

  • Depth buffer: Set all values to Zmax (farthest possible depth).
  • Frame buffer: Set all pixels to background color.

Step 2: Process Each Polygon

For each polygon in the scene:

  • Project it onto the screen.
  • For each pixel inside the polygon:
    • Calculate the polygon’s depth (Z) at that pixel.
    • Compare it with the depth buffer value at that pixel.
    • If closer:
      • Update the depth buffer with the new Z.
      • Update the frame buffer with the polygon’s color.

Step 3: Final Image

The frame buffer now contains the final visible image.

The Painter’s Algorithm

The Painter’s Algorithm is a simple hidden surface removal algorithm that renders polygons from back to front.

Step 1: Sort Polygons

Sort polygons based on their depth (e.g., average Z or farthest vertex Z).

Step 2: Render Polygons

For each polygon in sorted order:

  • Project to the 2D screen.
  • Fill the pixels in the frame buffer (overwriting previous colors if needed).

Step 3: Complete Image

The visible image is complete.

Scan-Line Algorithm

The Scan-Line algorithm is used for rendering polygons by processing them scan line by scan line.

Step 1: Sort Edges

Sort all polygon edges by their Y-coordinates.

Step 2: Process Each Scan Line

For each scan line (horizontal row of pixels):

  • Find all polygon edges intersecting this scan line (Active Edge Table – AET).
  • Determine intersection points with the scan line.
  • Sort intersection points by X-coordinate.
  • Fill the pixels between pairs of intersections with the polygon’s color.
  • Update edges in the Active Edge Table for the next scan line.

Step 3: Repeat

Repeat until all scan lines are processed.

Back-Face Removal

Back-Face Removal is an object-space hidden surface removal technique.

Purpose

To skip rendering polygons that face away from the camera, because they can never be visible.

Mathematical Test

  1. Let:
    • N = surface normal vector of polygon (in view space)
    • V = view vector from the eye (camera) to the polygon
  2. Compute the dot product:

    D = N . V

  3. If:
    • D > 0 → Polygon is facing the viewer → keep it.
    • D ≤ 0 → Polygon is facing away → discard it.

Light, Color, and Color Models

Light & Color Basics

  • Light: Visible electromagnetic waves (380–780 nm).
  • Color: Perception from light wavelengths reflected/emitted by objects.

Color Models

  1. RGB (Additive)

    • Components: Red, Green, Blue.
    • Mix light: Black = (0,0,0), White = (255,255,255).
    • Used in: Monitors, TVs, cameras.
  2. CMY (Subtractive)

    • Components: Cyan, Magenta, Yellow.
    • Mechanism: Inks subtract light colors.
    • Conversion: C=1−R, M=1−G, Y=1−B.
    • Used in: Printing.
  3. YIQ

    • Components: Y (brightness), I (orange–cyan), Q (purple–green).
    • Application: Y for B/W TVs, I & Q for color information.
    • Used in: NTSC TV broadcast.

The 2D Graphics Pipeline

  1. Modeling Transformation

    • Convert objects from model coordinates (local space) to world coordinates.
    • Example: Move a square from its local origin to a position in the scene.
  2. World to Viewing Transformation

    • Map world coordinates to view coordinates (camera space).
    • Positions objects relative to the viewer’s window.
  3. Clipping

    • Remove (clip) portions of objects outside the view window (viewport in world coordinates).
    • Saves processing by ignoring unseen parts.
    • Example: If part of a line lies outside the drawing area, only the visible part is kept.
  4. Window-to-Viewport Transformation

    • Map the clipped coordinates from the world view window to the screen’s viewport.
    • Converts world units to device units (pixels).
    • Ensures the scene fits on the display.
  5. Rasterization (Scan Conversion)

    • Convert vector data (lines, shapes) into pixel data.
    • Fills polygons, draws lines as discrete pixels.
  6. Display

    • Send rasterized image to the frame buffer for display on the screen.


Beam PenetrationShadow Mask
Used in older color CRTs.Used in modern color CRTs/LCDs.
Two layers of phosphor (red & green); beam depth controls color.Three separate phosphors (R, G, B) and a mask to direct beams.
Limited color range (4–7 colors).Millions of colors possible.
Cheaper.Higher cost.
Lower image quality.High image quality.
Raster ScanVector Scan
Displays image as a matrix of pixels.Draws image directly as a set of lines.
Refreshes entire screen sequentially.Refreshes only the lines needed.
Used in TVs, modern monitors.Used in oscilloscopes, plotters.
Produces jagged edges for curves.Produces smooth lines.
Requires frame buffer.Requires display list (vector memory).
AspectObject SpaceImage Space
Working Domain3D coordinates (world/view space)2D coordinates (screen space)
Data TypeVertices, edges, polygonsPixels/fragments
Visibility TestsPer object/polygonPer pixel
Example AlgorithmBack-face removal, bounding volume testsZ-buffer, scan-line
SpeedOften faster for culling large objectsSlower if many unnecessary pixels
AccuracyHigh for geometryHigh for final pixel colors