CACS305 Computer Graphics And Animation

Computer Graphics And AnimationUnit 88 min read

Display Systems & Rasterization: Raster vs Vector, Video Controllers, Framebuffers

Unit 8 of Computer Graphics And Animation covers how display systems render images—raster vs. random scan architectures, the role of video controllers, framebuffer memory, refresh rates, and pixel-level rasterization techniques. Learn how monitors work, why refresh rates matter, and how real-world apps (like games or Y

TAKEAWAYS:

  • Raster vs. random scan: Raster scans pixels row-by-row (used in modern monitors), while random scan draws vectors (used in older CAD systems).
  • Video controller: Manages framebuffer memory, refresh cycles, and pixel data for display.
  • Framebuffer: A memory buffer storing RGB values for each pixel before rendering.
  • Refresh rate: Determines how often the screen redraws (e.g., 60Hz = 60 redraws/sec).
  • Rasterization: Converts vector graphics (lines, polygons) into pixels for display.
  • Real-world tie: Games like PUBG Mobile use rasterization to render 3D scenes in real-time.

1. Display Systems: Raster vs. Random Scan

Display systems convert digital data into visual output. There are two primary architectures:

A. Random Scan (Vector) Display

  • How it works:
    • Uses an electron beam to draw lines (vectors) directly on the screen.
    • The beam moves only where lines or edges exist (no blanking time).
    • Requires precise control of beam intensity and position.
  • Components:
    • Electron gun: Generates the beam.
    • Deflection coils: Control beam movement (X-Y coordinates).
    • Phosphor screen: Glows when hit by the beam.
  • Advantages:
    • High precision for geometric shapes (e.g., CAD software).
    • No flicker (since only active lines are drawn).
  • Disadvantages:
    • Slow for complex scenes (must redraw entire image per frame).
    • Expensive hardware (requires high-speed beam control).
  • Real-world use:
    • Older CAD systems (e.g., AutoCAD in engineering).
    • Flight simulators (precise vector rendering for instruments).
graph LR
    A["Electron Gun"] --> B["Deflection Coils"]
    B --> C["Phosphor Screen"]
    C -->|"Beam"| D["Diagonal Line"]
    D -->|"Redraw"| C

B. Raster Scan Display

  • How it works:
    • Scans the screen row-by-row (left to right, top to bottom).
    • Each pixel is turned on/off independently (like a grid of LEDs).
    • Uses horizontal and vertical retrace (blanking periods) to return the beam to the start of the next row.
  • Key terms:
    • Horizontal retrace: Beam returns to the left after a row.
    • Vertical retrace: Beam jumps to the next row.
    • Refresh rate: How often the screen redraws (e.g., 60Hz = 60 full scans/sec).
    • Persistence: How long phosphors glow after being hit (affects flicker).
  • Advantages:
    • Faster for complex images (parallel processing of pixels).
    • Cheaper and more scalable (used in all modern monitors).
  • Disadvantages:
    • Requires more memory (framebuffer stores every pixel).
    • Flicker if refresh rate is too low (<60Hz).
graph TD
    A["Start Top-Left"] -->|Scan Left--> B["Pixel 1"]
    B --> C["Pixel 2"] --> ... --> D["Pixel N"]
    D -->|"Horizontal Retrace"| E["Next Row"]
    E --> F["Pixel 1 (Next Row)"]

2. Framebuffer and Video Controller

A. Framebuffer Memory

  • A memory buffer storing RGB values for every pixel on the screen.
  • Resolution: Defined by width × height × color depth (e.g., 1920×1080×24-bit).
  • Example:
    • For a 1024×768 screen with 24-bit color:
      • Total pixels = 1024 × 768 = 786,432 pixels.
      • Each pixel = 3 bytes (R, G, B).
      • Total memory = 786,432 × 3 = ~2.36 MB.

B. Video Controller

  • Role:
    1. Reads data from the framebuffer.
    2. Converts pixel data into signals for the monitor.
    3. Controls refresh rate and synchronization (horizontal/vertical retrace).
  • Key functions:
    • Double buffering: Uses two framebuffers (front and back) to avoid flicker during rendering.
    • Z-buffering: Stores depth values for 3D rendering (hidden surface removal).
    • DMA (Direct Memory Access): Transfers pixel data directly to the monitor without CPU overhead.

3. Rasterization: Converting Vectors to Pixels

Rasterization converts geometric primitives (lines, polygons) into pixels for display.

A. Line Rasterization (Bresenham’s Algorithm)

  • Goal: Draw a diagonal line between two points and .
  • Steps:
    1. Calculate the slope and error term.
    2. Decide whether to increment or based on slope.
    3. Plot pixels while adjusting the error to stay close to the ideal line.
  • Worked Example: Draw a line from to :
    • Slope = (steep, so increment first).
    • Initialize: , , error = 0.
    • For each step, plot and update error:
      • If error > 0.5, increment and adjust error.
      • Else, increment and adjust error.
graph TD
    A["Start (2,2)"] --> B["Plot (2,2)"]
    B --> C["Error = 0.25"] --> D["Increment y to (2,3)"]
    D --> E["Error = -0.25"] --> F["Increment x to (3,3)"]
    F --> G["Plot (3,3)"]
    G --> H["... Continue until (10,8)"]

B. Polygon Rasterization (Scanline Algorithm)

  • Goal: Fill a polygon by scanning row-by-row and finding intersections.
  • Steps:
    1. Sort edges by -coordinate.
    2. For each scanline, find intersections with polygon edges.
    3. Fill pixels between intersections.
  • Worked Example: Fill a triangle with vertices , , :
    • Scanline : Intersections at and → fill pixels from to .
    • Scanline : Find intersections with edges and .
graph TD
    A["Triangle Vertices"] --> B["(2,2)"] --> C["(6,2)"] --> D["(4,6)"]
    D --> B
    E["Scanline y=2"] --> F["Fill x=2 to x=6"]
    G["Scanline y=3"] --> H["Find intersections"]

4. Refresh Rate and Persistence

A. Refresh Rate

  • Definition: Number of times the screen redraws per second (measured in Hz).
  • Impact:
    • Low refresh rate (<60Hz): Causes flicker (visible to the eye).
    • High refresh rate (≥120Hz): Smoother motion (used in gaming).
  • Example:
    • A 60Hz monitor redraws 60 times per second.
    • For a 1080p screen, each frame must be rendered in ~16.67 ms.

B. Persistence

  • Definition: How long phosphors (or LCD pixels) retain brightness after being activated.
  • Problem: If persistence is too short, the screen flickers.
  • Solution: Use interlacing (alternating odd/even lines) or higher refresh rates.

5. Real-World Applications

A. Games and Animation

  • PUBG Mobile / Free Fire:
    • Uses rasterization to render 3D environments in real-time.
    • The video controller manages framebuffer updates for smooth gameplay.
  • YouTube / Netflix:
    • Streams rasterized video frames (compressed but still pixel-based).

B. Banking and E-Sewa

  • Transaction screens:
    • Display rasterized UI elements (buttons, graphs) for user interaction.
    • Refresh rate ensures no lag when updating balances.

C. NTC and Ncell Billing Systems

  • Graphical dashboards:
    • Use raster scan to display real-time data (e.g., call volumes, network maps).
    • Framebuffer stores pixel data for quick updates.

6. Comparison: Raster vs. Random Scan

Feature Raster Scan Random Scan (Vector)
Scan Method Row-by-row (pixel grid) Direct line drawing
Speed Fast for complex images Slow for complex scenes
Memory Usage High (framebuffer stores all pixels) Low (only stores vectors)
Flicker Depends on refresh rate No flicker (only active lines)
Cost Cheaper (modern monitors) Expensive (specialized hardware)
Use Cases Games, videos, general computing CAD, flight simulators

7. Exam Tip

  • Key focus areas:
    1. Define and differentiate raster vs. random scan (include diagrams).
    2. Explain framebuffer and its role in storing pixel data.
    3. Describe the video controller’s functions (refresh rate, DMA, double buffering).
    4. Trace a simple rasterization example (e.g., Bresenham’s line or polygon filling).
    5. Relate to real-world apps (e.g., games use rasterization; CAD uses vector).
  • Common mistakes to avoid:
    • Confusing horizontal vs. vertical retrace.
    • Forgetting to mention refresh rate in display system explanations.
    • Skipping worked examples (always show step-by-step calculations).
  • High-mark answers:
    • Include diagrams (raster scan path, framebuffer layout).
    • Compare raster vs. vector in a table.
    • Link concepts to real-world systems (e.g., YouTube’s video frames).

Based on the TU BCA syllabus for Computer Graphics And Animation (CACS305), unit 8.

Discussion

Loading…