0% found this document useful (0 votes)
3 views20 pages

Chapter2 Graphics Hardware StudyGuide

Chapter 2 of the Computer Graphics study guide discusses the hardware components involved in graphics systems, including the roles of the CPU, system memory, GPU, and display devices. It explains the operation of various display technologies such as CRTs, LCDs, and the differences between random-scan and raster-scan displays. Additionally, it covers the architecture of raster graphics systems, the importance of frame buffers, and the evolution of graphics workstations and input devices.

Uploaded by

hunegnawwondatir
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views20 pages

Chapter2 Graphics Hardware StudyGuide

Chapter 2 of the Computer Graphics study guide discusses the hardware components involved in graphics systems, including the roles of the CPU, system memory, GPU, and display devices. It explains the operation of various display technologies such as CRTs, LCDs, and the differences between random-scan and raster-scan displays. Additionally, it covers the architecture of raster graphics systems, the importance of frame buffers, and the evolution of graphics workstations and input devices.

Uploaded by

hunegnawwondatir
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Computer Graphics — Chapter 2: Graphics Hardware

Chapter 2
Graphics Hardware
Computer Graphics — Study Guide

2.1 Raster Display Systems

Overview of Graphics Systems


A computer graphics system converts digital data into visible images on a display device. To understand
how this works, you need to know the hardware components involved and how they communicate. Every
graphics system — whether a gaming PC or a scientific workstation — shares the same fundamental
building blocks.

Component Role
CPU Executes application logic; passes graphics commands to the display
processor
System Bus Communication highway connecting CPU, memory, and peripheral
devices
System Memory Stores program data; may also hold the frame buffer in simpler
systems
Display Processor Dedicated hardware that executes graphics routines and writes pixel
(GPU) data into the frame buffer
Frame Buffer 2-D memory array storing pixel color values for the current image
Video Controller Reads the frame buffer continuously and drives the CRT or other
display hardware
Monitor / Display The physical output device that shows the final image to the user

Video-Display Devices
Display devices are the output face of any graphics system. At the most basic level, every display device
does one thing: illuminate a small dot (a pixel) at a specific (x, y) position with a specific color. The entire
visible image is built from millions of such dots.

The main categories of display device you will encounter in this course are:
• Cathode Ray Tubes (CRT) — the dominant technology for decades and the focus of this
chapter
• LCD (Liquid Crystal Display) — increasingly common; uses a backlight and liquid crystals to
control pixel brightness
• LED displays — variants of LCD using LED backlighting or direct-emission LEDs
• Projectors — project an image onto a surface

Page 1
Computer Graphics — Chapter 2: Graphics Hardware

The Cathode Ray Tube (CRT)


How a CRT Works
A CRT is an evacuated glass tube. Inside the tube, one or more electron guns heat a filament to produce
a stream of electrons. These electrons are accelerated toward the front of the tube, focused into a tight
beam, and steered across the screen by electromagnetic deflection coils (the deflection yoke). When the
electron beam strikes the phosphor coating on the inside face of the tube, the phosphor emits visible
light.

Key points about CRT operation:


• The brightness of each spot is proportional to the intensity of the electron beam at that instant.
• The beam is steered horizontally and vertically by changing the current in the deflection coils.
• Phosphors only glow briefly after being struck — this is called persistence. The shorter the
persistence, the faster the image fades, requiring more frequent refreshing.

CRT Internal Structure (Conceptual Diagram Description)


From left to right inside the tube:
1. Electron Gun — contains a heated filament (cathode) that emits electrons
2. Control Grid — controls the intensity (brightness) of the beam
3. Focusing Anode — narrows the beam into a sharp point
4. Deflection System — magnetic or electrostatic coils that steer the beam in X and Y
5. Shadow Mask (colour CRTs only) — ensures each beam hits the correct colour
phosphor
6. Phosphor-Coated Screen — emits red, green, or blue light when struck

Colour CRTs
A monochrome CRT uses a single electron gun and a uniform phosphor coating. Colour CRTs are
considerably more complex:
• Three separate electron guns are used — one each for red (R), green (G), and blue (B).
• The screen phosphor is arranged in clusters of three tiny dots: one red, one green, one blue,
grouped together so closely that human eyes blend their light into a single perceived colour.
• A shadow mask — a thin metal plate with one tiny hole per pixel position — sits just behind the
screen. Because the three guns are positioned at slightly different angles, all three beams
converge through the same hole but land on their respective coloured phosphor dots.
• The perceived colour at any pixel is determined by the relative intensities of the R, G, and B
beams at that moment.

Two physical arrangements exist for colour phosphor patterns:


• Delta arrangement: R, G, B dots arranged in a triangular pattern; used in older monitors.
• In-line (stripe) arrangement: R, G, B dots arranged in vertical stripes; used in most modern
CRT monitors for sharper images.

Page 2
Computer Graphics — Chapter 2: Graphics Hardware

The Electron Gun in Detail


Understanding the electron gun clarifies how the CRT achieves precision imaging:
1. A heating filament (cathode) is brought to high temperature, causing thermionic emission —
electrons 'boil off' the surface.
2. The electrons are repelled by the cathode and attracted toward a positively charged anode,
forming a beam.
3. A control grid (Wehnelt cylinder) modulates the intensity of the beam by applying a small
negative voltage — this is how brightness is controlled per pixel.
4. Focusing anodes concentrate the beam into a tight spot, ensuring a sharp phosphor impact.
5. Magnetic deflection coils (outside the tube) steer the beam: horizontal coils move it left/right;
vertical coils move it up/down.
6. The beam strikes the phosphor-coated screen, producing a glowing spot.

Random-Scan (Vector) Displays


There are two fundamentally different strategies for using a CRT to display an image. The first is the
random scan approach.

What It Is
In a random-scan (vector) display, the electron beam is directed only to the areas of the screen that need
to be illuminated. The beam traces out each line or curve in the image directly, in much the same way a
human would draw with a pen — going from point to point. Blank areas are never touched by the beam.

Analogy
Think of drawing on paper by lifting your pen and placing it only where ink is needed.
If you are drawing a triangle, the pen moves along three straight edges and stops.
Empty white space inside the triangle is never touched.

Because the image is stored as a list of geometric commands (draw a line from A to B, draw a circle at
C with radius r), random-scan displays are also called vector graphics displays.

Advantages and Disadvantages


Aspect Vector (Random Scan)
Image quality Very sharp, smooth lines and curves — no jagged edges
Speed for simple images Fast — only draws what exists
Speed for complex Slow — more primitives = more beam travel time
images
Memory Low — stores geometric commands, not pixel values
Filled areas / photos Poor — filling a solid polygon requires many lines
Modern use Hard-copy plotters; rare as a screen technology

Page 3
Computer Graphics — Chapter 2: Graphics Hardware

Raster-Scan Displays
The Core Idea
In a raster-scan display, the entire screen is treated as a uniform grid of pixels. The electron beam sweeps
across every row (scan line) from left to right, top to bottom, visiting every pixel position — whether it is
'on' or 'off'. The beam is switched on (high intensity) or off (low intensity) at each position based on data
stored in a frame buffer.

Analogy
Think of a printer laying down ink row by row across the full width of a page,
whether or not there is content at each spot. Every row is visited; the ink head
simply delivers no ink where the image is blank.

Raster Scan Terminology


You must know these terms precisely — they appear constantly in exams and technical discussion:

Term Definition
Raster The complete rectangular grid of phosphor dots (pixels) on the
display screen
Pixel (Picture Cell) A single addressable dot in the raster — the smallest unit of display
Scan Line A single horizontal row of pixels across the raster
X-Resolution The number of pixels per scan line (horizontal pixel count)
Y-Resolution The number of scan lines (vertical pixel count)
Resolution Expressed as X-Resolution × Y-Resolution, e.g. 640×480,
1280×1024
Aspect Ratio The ratio of horizontal to vertical dimensions; affects how images
appear (square vs. stretched)
Frame Buffer 2-D memory array storing the brightness/colour value of every pixel
Bit-Planes / Depth Number of bits used to store each pixel's value; determines the
number of displayable colours
Bitmap / Pixmap An image represented as a 2-D array of pixel values

The Frame Buffer in Detail


The frame buffer is the critical memory structure that makes raster scanning possible. It is a 2-D array of
values where each array cell corresponds to exactly one pixel on the screen. The video controller reads
through this array continuously and uses each stored value to determine the electron beam intensity (and
colour) at each pixel position.

Frame buffer size is calculated as: Resolution x Colour Depth

Page 4
Computer Graphics — Chapter 2: Graphics Hardware

Example: A 640x480 display with 8 bits per pixel requires 640 x 480 x 8 = 2,457,600 bits = approximately
300 KB of frame buffer memory.

For colour displays, each pixel stores values for its red, green, and blue channels. A common
configuration is 8 bits per channel x 3 channels = 24-bit colour (16.7 million possible colours). This is
called true colour.

Notation Resolution Depth (bits/pixel) Total Memory


640×480×8 640×480 8 ~300 KB (monochrome / indexed
colour)
640×480×24 640×480 24 (8×3 RGB) ~900 KB (true colour)
1280×1024×24 1280×1024 24 (8×3 RGB) ~3.75 MB (true colour)

Persistence and Refresh Rate


Phosphor dots only emit light for a brief period after the electron beam moves on — typically a few
milliseconds. To maintain the appearance of a steady, stable image, the entire raster must be redrawn
(refreshed) before the phosphor glow fades.

The number of times the full screen is redrawn per second is the refresh rate, measured in Hz (cycles
per second). Key thresholds:
• Below ~24 Hz: obvious flicker; the image appears to pulse and is uncomfortable to view
• 24–30 Hz: acceptable for some applications; still perceptible flicker under bright lighting
• 60 Hz: the standard for modern displays; virtually flicker-free for most viewers
• Modern high-performance displays: 120 Hz, 144 Hz, or 240 Hz

Interlaced vs. Progressive Scanning


Early graphics systems had refresh rates of only ~30 Hz, which caused noticeable flicker. A technique
called interlaced scanning was used to work around this limitation without requiring faster hardware.

Feature Progressive (Non-Interlaced) Interlaced


Scan order All lines scanned top to bottom in Odd lines first (1, 3, 5...), then even
sequence (1, 2, 3, 4 ...) lines (2, 4, 6...)
Perceived refresh Equal to actual refresh rate Appears doubled — 30 Hz
interlaced looks like 60 Hz to the
eye
Image quality Cleaner, no line artifacts Can show fine horizontal lines or
subtle combing artifacts
Modern use Standard for all modern monitors Legacy TV formats (PAL, NTSC);
and computer displays now largely replaced

Why interlaced scanning reduces flicker: because odd lines are refreshed in the first pass and even lines
in the second, every part of the screen is updated twice as often as a naive count would suggest —
tricking the eye into perceiving a smoother image.
Page 5
Computer Graphics — Chapter 2: Graphics Hardware

Common Video Format Specifications


Format Resolution Refresh Rate Scanning
VGA 640×480 60 Hz Non-interlaced (progressive)
NTSC (US TV) 525×480 (active) 30 Hz Interlaced
PAL (European 625×480 (active) 25 Hz Interlaced
TV)
SVGA 800×600 60–85 Hz Progressive
Full HD (1080p) 1920×1080 60–240 Hz Progressive

Architecture of Raster Graphics Systems


Simple System (Software Rendering)
In the simplest architecture, the frame buffer is a reserved region of main system memory. The CPU
executes graphics routines in software, writes pixel values directly into the frame buffer, and the video
controller reads from that same memory to drive the display. This is flexible but slow for complex scenes
because the CPU must handle all graphics computation.

Data Flow: Simple Raster System


CPU ←→ System Bus ←→ System Memory (contains Frame Buffer)

Video Controller → Monitor

The CPU computes pixel values and writes them into the frame buffer.
The video controller independently reads the frame buffer at the refresh rate.

System with a Display Processor (Hardware Rendering)


Modern graphics systems offload all rendering computation to a dedicated display processor —
commonly called the GPU (Graphics Processing Unit), graphics card, graphics accelerator, or video card.
The CPU sends high-level graphics commands to the GPU, which then executes them using dedicated
hardware, writes the resulting pixels into the frame buffer, and the video controller handles the display.

Data Flow: System with Display Processor


CPU ←→ System Bus ←→ System Memory

Display Processor (GPU)

Frame Buffer → Video Controller → Monitor

Page 6
Computer Graphics — Chapter 2: Graphics Hardware

The CPU sends drawing commands; the GPU handles all pixel computation.
Hardware rendering is significantly faster than software rendering.

The GPU contains dedicated circuitry for common graphics operations: line drawing, polygon filling,
texture mapping, lighting calculations, and geometric transformations. This hardware is optimised for
these tasks and runs them far faster than a general-purpose CPU.

Aspect Software Rendering Hardware Rendering (GPU)


Who does the work CPU (general purpose) GPU (specialised graphics
hardware)
Speed Slower — CPU shares time with Much faster — parallel,
all tasks dedicated hardware
Flexibility High — any algorithm can be Limited to operations supported
coded by the hardware/API
API support Any OpenGL, DirectX (Direct3D)
Frame buffer location System memory GPU-dedicated video memory
(VRAM)

Comparing Vector and Raster Display Systems


Feature Vector (Random Scan) Raster Scan
How image is stored List of geometric primitives 2-D pixel array in frame buffer
(commands)
Line/curve quality Mathematically perfect — Aliased — staircase edges on
smooth diagonals
Complex scenes Slow — more objects = more Fast — display time independent
beam travel of image complexity
Filled regions / photos Difficult Natural — every pixel can be
independently coloured
Memory requirement Low for simple scenes Fixed by resolution and colour
depth
Dominant use today Hard-copy plotters Virtually all screens (monitors,
TVs, phones)

Graphics Monitors and Workstations


A graphics workstation pairs a high-quality display with a GPU capable of accelerating the graphics
operations required by the application. In professional settings (CAD, medical imaging, film production),
monitors and GPUs are selected for specific properties:
• Colour accuracy and gamut (range of colours the display can reproduce)

Page 7
Computer Graphics — Chapter 2: Graphics Hardware

• Bit depth (professional monitors may support 10 or 12 bits per channel for smoother gradients)
• Refresh rate and response time (critical for animation and video work)
• Resolution — higher resolutions reveal finer detail in complex models

The video card (GPU) inside a workstation connects to the motherboard via a high-speed bus. Bus
technology has evolved significantly:
• PCI (1993): 32-bit, 33 MHz — the first standardised plug-and-play graphics bus
• AGP (1997): Dedicated 32-bit, 66 MHz bus exclusively for the graphics card — doubled
bandwidth over PCI
• PCI Express (PCIe, 2004): Point-to-point serial interface; PCIe x16 provides far greater
bandwidth than AGP and is the current standard

Input Devices
Graphics systems receive user input through a variety of devices. Input devices fall into two broad
categories based on how they communicate positional data:

Category Description Examples


Locator devices Provide continuous (x, y) position Mouse, trackball, joystick,
data, often with additional buttons graphics tablet/stylus,
touchscreen
Keyboard devices Provide text and command input; Keyboard, keypad
can also drive menus and
selections
Valuator devices Provide a single scalar value (e.g. Potentiometer dial, scroll
a dial or slider) wheel
Choice devices Select one option from a set Function keys, menu
selections
Pick devices Identify objects on the screen (by Mouse click + hit-testing
clicking them)
3-D input devices Capture motion and orientation in Data glove, motion tracker, 6-
three dimensions DOF mouse

3-D Display Devices


Standard monitors display 3-D scenes projected onto a 2-D surface, losing depth information. True 3-D
display devices present different images to the left and right eyes (a stereo pair), enabling the visual
system to perceive depth — a process called stereoscopy.

Type Head-Mounted Display (HMD) Head-Tracked Display (HTD)


What it is Display worn on the user's head; Stationary screen; viewer's head
moves with head movement position is tracked

Page 8
Computer Graphics — Chapter 2: Graphics Hardware

Stereo method Separate small screens for each Polarised filters, colour filters, or
eye directly in front of the eyes active shutter glasses
Immersion High — fully surrounds the field Moderate — user still sees the
of view real world peripherally
Application Virtual reality (VR), surgical Scientific visualisation, 3-D
simulation, flight training cinema, design review
Tracking Head tracker updates image as Head position tracked so correct
user turns head perspective is shown

Stereo separation techniques for HTDs include:


• Polarised light: Monitor emits alternating polarised frames; viewer wears passive polarised
glasses that route odd frames to one eye and even frames to the other.
• Anaglyphic (colour filter): Left-eye image is rendered in red, right-eye in cyan (or blue/green);
viewer wears matching tinted glasses. Cheap but poor colour reproduction.
• Active shutter glasses: Glasses with LCD lenses that rapidly alternate between transparent
and opaque, in sync with the monitor alternating between left- and right-eye frames.

KEY TAKEAWAYS
• A CRT fires electron beams at a phosphor-coated screen; brightness is proportional to
beam intensity.
• Colour CRTs use three guns (R, G, B) and a shadow mask to ensure beams hit the correct
phosphor dots.
• Random-scan (vector) displays draw only the geometric primitives; raster-scan displays
visit every pixel.
• The frame buffer stores pixel values for the entire screen; its size = resolution x colour
depth.
• Refresh rate must exceed ~24 Hz to avoid visible flicker; interlaced scanning doubles
perceived refresh for low-rate systems.
• Hardware rendering (GPU) is far faster than software rendering (CPU).
• VGA: 640x480, 60 Hz, progressive. NTSC: ~525x480, 30 Hz, interlaced. PAL: ~625x480,
25 Hz, interlaced.

Page 9
Computer Graphics — Chapter 2: Graphics Hardware

2.2 The 3D Graphics Pipeline


What Is the Graphics Pipeline?
When you play a 3-D video game or run a 3-D application, the software has a model of the scene stored
in memory — positions of objects, their shapes, their materials, the location of lights, and a virtual camera.
The graphics pipeline is the sequence of steps that converts this abstract 3-D description into a 2-D image
of pixels ready to appear on your screen.

The pipeline is implemented partly in software (on the CPU) and largely in dedicated hardware (on the
GPU). Like a factory production line, each stage processes the data handed to it by the previous stage,
and all stages run in parallel for maximum throughput. This is precisely why the analogy of a pipeline is
used.

Pipeline Overview (Left to Right)


Application → Geometry → Rasterization → Screen

Each arrow represents data passing from one stage to the next.
The pipeline runs continuously — while Stage 3 rasterizes triangle N,
Stage 2 is already processing triangle N+1, and Stage 1 is updating N+2.

Graphics APIs such as OpenGL and Direct3D exist to give programmers a consistent interface to the
GPU pipeline regardless of which manufacturer's hardware is installed. The API translates high-level
commands into hardware-specific operations.

Stage 1: Application
The application stage runs entirely on the CPU. Its job is to manage the scene and prepare data for the
geometry stage.

Responsibilities
• Reading user input (keyboard, mouse, game controller) and updating the scene accordingly
• Running game logic, physics simulation, and animation calculations
• Performing collision detection — determining whether objects intersect
• Managing spatial data structures (Quadtrees for 2-D, Octrees for 3-D) to efficiently determine
which objects are potentially visible
• Sending the list of visible geometry primitives (typically triangles) to the geometry stage

Why spatial subdivision?


A modern game world can contain millions of objects, far too many to
process every frame. Spatial data structures like Octrees partition 3-D space
into nested cubes. Only objects in the region visible to the camera need to be

Page 10
Computer Graphics — Chapter 2: Graphics Hardware

sent to the geometry stage — a massive reduction in work.

Stage 2: Geometry
The geometry stage is where the 3-D mathematics happens. It transforms every vertex of every visible
primitive through a sequence of coordinate spaces, computes lighting at vertices, and clips geometry to
the visible volume. This stage operates primarily on the GPU's vertex processors.

The geometry stage is divided into five sub-stages:

2a. Model & World Transformation


Every object is created in its own local coordinate system — also called the object or model coordinate
system. A tree model, for example, has its trunk at the origin of its own coordinate system. To place this
tree in the scene, its vertices must be transformed into the world coordinate system.

This transformation is accomplished by multiplying each vertex position by a matrix. The matrix encodes:
• Translation: moving the object to its world position
• Rotation: orienting the object in world space
• Scaling: resizing the object to its intended size

A powerful consequence: one original model can be reused many times with different transformation
matrices. Drawing an entire forest from a single tree model (each with its own position/rotation/scale) is
called instancing.

2b. Camera (View) Transformation


The world coordinate system describes where objects are globally. But the renderer needs to know where
things are relative to the virtual camera. The camera transformation (view transformation) repositions and
reorients the entire scene so that:
• The camera is at the origin
• The camera looks along the negative Z-axis (by convention)
• Up is the positive Y-axis

The resulting space is called camera space or view space. Every subsequent step works in this space,
making the mathematics simpler and more uniform.

2c. Projection
3-D scenes must be flattened to 2-D for display. Projection accomplishes this. Two types of projection
are used:

Type Perspective Projection Orthographic (Parallel)


Projection

Page 11
Computer Graphics — Chapter 2: Graphics Hardware

Appearance Objects farther from camera Objects appear the same size
appear smaller — realistic depth regardless of distance from
camera
Visual volume shape Frustum (truncated pyramid) — Rectangular box (cuboid)
wide at the far end, narrow at the
near end
Used for 3-D games, visualisations, films Technical drawings, CAD, maps,
— any realistic rendering architectural plans
Preserves parallel No — parallel lines converge at Yes — parallel lines remain
lines? vanishing points parallel in the projection

After projection, all vertices are mapped into a normalised volume — a cube with corners at (-1,-1,0) and
(1,1,1) in OpenGL convention. The Z values from this step are not discarded; they are preserved for
hidden surface removal (Z-buffering) in the rasterisation stage.

2d. Lighting
Lighting calculations determine how bright each vertex appears based on the scene's light sources and
the surface's material properties. This produces a colour (or colour modifier) at each vertex. Three types
of light contribution are typically computed:
• Ambient: uniform background illumination applied to all surfaces equally — prevents
completely unlit areas from being pure black
• Diffuse: directional light scattered equally in all directions from a surface; brightness depends
on the angle between the light direction and the surface normal (dot product). The sun is a
classic diffuse light source.
• Specular: highlights — the shiny spot on a surface where the light reflects directly toward the
viewer. Depends on both the view direction and the reflection direction.

During rasterisation (Stage 3), the colour values computed at each vertex are interpolated smoothly
across the interior of each triangle — a technique called Gouraud shading.

2e. Clipping
Only geometry inside the view volume (the frustum) is visible on screen. The clipping stage removes
geometry that falls outside this volume:
• Frustum culling: primitives entirely outside the view volume are discarded immediately.
• Partial clipping: primitives that straddle the boundary of the view volume are cut — new
vertices are generated at the intersection of the primitive with the frustum boundary.
• Backface culling: polygons facing away from the camera (their outward normal points away
from the camera) are discarded, since they would be hidden behind the front faces of solid
objects. This typically eliminates about 50% of triangles.

Clipping is computationally cheaper than rasterising invisible geometry. Only the surviving primitives
proceed to the next stage.

2f. Window-Viewport Transformation

Page 12
Computer Graphics — Chapter 2: Graphics Hardware

After projection and clipping, vertices are in normalised device coordinates. The window-viewport
transformation maps these coordinates to the actual pixel coordinates of the target area (viewport) on
the screen. This is a simple scale and translation.

Coordinate Space Summary


Object Space — local coordinates of each model
↓ (model matrix)
World Space — global scene coordinates
↓ (view/camera matrix)
Camera Space — coordinates relative to the camera
↓ (projection matrix)
Clip Space — normalised volume after projection; Z preserved
↓ (clipping, perspective divide)
NDC (Normalised) — cube from -1 to +1
↓ (viewport transform)
Screen Space — pixel coordinates on the display

Stage 3: Rasterisation
Rasterisation is the final major stage. It converts the mathematical descriptions of clipped, projected, lit
primitives into discrete fragments — one per pixel that the primitive covers on screen. Each fragment will
ultimately become a pixel in the output image.

What Happens During Rasterisation


1. The rasteriser determines which screen pixels each triangle covers by examining the triangle's
projected screen-space coordinates.
2. For each covered pixel, a fragment is generated. Vertex attributes (colour, texture coordinates,
depth) are interpolated across the triangle surface using barycentric coordinates.
3. A fragment shader (also called a pixel shader) runs on the GPU for each fragment. It computes
the final colour of the fragment based on the interpolated data, texture samples, and additional
lighting calculations.
4. Hidden surface determination is performed — see Section 2.3.
5. Surviving fragments are written to the frame buffer, potentially blended with existing values (for
transparency or anti-aliasing).

Double Buffering
A subtle but important problem: the rasteriser writes pixels to the frame buffer continuously, while the
video controller reads from the same frame buffer continuously to drive the display. If the user sees the
frame buffer while it is being partially written, they see a half-rendered, torn image — a visual artifact
called screen tearing.

Page 13
Computer Graphics — Chapter 2: Graphics Hardware

The solution is double buffering: two frame buffers are maintained. The rasteriser writes into the back
buffer (invisible to the display), while the video controller reads from the front buffer (what the user
currently sees). Once the back buffer is fully rendered, the two buffers are swapped atomically — the
completed back buffer becomes the new front buffer, and the empty front buffer becomes the new back
buffer.

Buffer Role
Front buffer Currently displayed; read continuously by the video controller
Back buffer Currently being rendered into; invisible to the user until swap

KEY TAKEAWAYS
• The graphics pipeline has three main stages: Application (CPU), Geometry (GPU vertex
processing), Rasterisation (GPU fragment processing).
• The geometry stage transforms vertices through: world space → camera space → clip
space → screen space.
• Two projection types: perspective (realistic depth, frustum view volume) and orthographic
(size-independent, box view volume).
• Lighting at vertices uses ambient + diffuse + specular contributions; colours are
interpolated across triangles during rasterisation.
• Clipping removes geometry outside the frustum; backface culling removes rear-facing
polygons — both reduce unnecessary computation.
• Double buffering prevents screen tearing by rendering into a hidden back buffer and
swapping when complete.
• The Z-buffer (from Stage 3) determines which surfaces are visible at each pixel — covered
in Section 2.3.

Page 14
Computer Graphics — Chapter 2: Graphics Hardware

2.3 Hidden Surface Removal


The Problem: What Should Be Visible?
When rendering a 3-D scene, multiple surfaces may overlap at the same pixel position. Without explicitly
determining which surface is closest to the camera at each pixel, the result would be a chaotic blending
of all surfaces — some surfaces that should be hidden would bleed through others. The process of
deciding which surface is visible at each pixel is called visible-surface determination (also called hidden-
surface elimination or hidden-line removal).

Consider a simple example: three coloured planes arranged so that from the camera's perspective they
overlap. At any pixel where all three planes project, only the frontmost plane — the one with the smallest
depth value relative to the camera — should be visible.

Intuition
Imagine looking at a stack of cardboard sheets placed at different distances from you.
The sheet closest to your eyes hides any parts of further sheets behind it.
Hidden-surface algorithms give computers the equivalent of this common-sense depth
judgement.

The Z-Buffer (Depth Buffer) Algorithm


Overview
The Z-buffer algorithm is the dominant hidden-surface method in real-time graphics. It is simple, fast, and
implemented directly in GPU hardware. The core idea: maintain a separate 2-D buffer — the depth buffer
or Z-buffer — alongside the frame buffer. For every pixel position (x, y), the Z-buffer stores the depth (Z-
value) of the closest surface written so far. Whenever a new fragment arrives at (x, y), its depth is
compared to the stored value. Only if the new fragment is closer does it replace both the stored colour
(frame buffer) and the stored depth (Z-buffer).

Assumptions and Setup


For the standard Z-buffer algorithm:
• The projection plane is the XY-plane (Z = 0).
• Orthographic (parallel) projection is assumed for simplicity — each point (x, y, z) on a surface
maps directly to pixel position (x, y).
• Depth increases along the positive Z-axis (objects further from the camera have larger Z
values).
• A smaller Z value means closer to the camera — and thus visible.

Data Structures Required


Two 2-D arrays are needed, both with the same dimensions as the frame buffer:
Buffer Notation Contents

Page 15
Computer Graphics — Chapter 2: Graphics Hardware

Depth buffer (Z- z-buffer(i, j) Stores the smallest (closest) Z-value seen so
buffer) far at pixel (i, j). Initialised to maximum depth
(infinity or far-plane depth).
Refresh buffer COLOR(i, j) Stores the colour (intensity) of the surface
(Colour buffer) currently considered visible at pixel (i, j).
Initialised to the background colour.

The Algorithm Step-by-Step


Z-Buffer Algorithm
INITIALISE:
For every pixel (i, j):
z-buffer(i, j) ← +∞ (or far-plane depth)
COLOR(i, j) ← background_colour

PROCESS each polygon surface S in the scene:


For every pixel (x, y) that S covers on the projection plane:
Compute z_S(x, y) = depth of surface S at position (x, y)

IF z_S(x, y) < z-buffer(x, y) THEN:


// S is closer than whatever was stored previously
z-buffer(x, y) ← z_S(x, y)
COLOR(x, y) ← intensity of S at (x, y)
END IF

(if z_S >= z-buffer, the current pixel is occluded — do nothing)

RESULT: COLOR array contains the correct visible colour at every pixel.

Worked Example
Suppose three surfaces S1, S2, and S3 all project onto pixel (x, y), with Z-values:

• S1: z = 3.0 (closest to camera)


• S2: z = 7.0
• S3: z = 12.0 (furthest from camera)

Step Surface z-buffer(x,y) COLOR(x,y) Reason


Processed
Init — +∞ Background Buffer initialised

Page 16
Computer Graphics — Chapter 2: Graphics Hardware

1 S2 (z = 7.0) 7.0 Colour of S2 7.0 < ∞, so S2 written


2 S3 (z = 12.0) 7.0 Colour of S2 12.0 > 7.0, S3 occluded
— no change
3 S1 (z = 3.0) 3.0 Colour of S1 3.0 < 7.0, S1 overwrites
S2
Final — 3.0 Colour of S1 S1 is correctly shown as
visible

Notice that the order in which surfaces are processed does not matter. Whether S1 is processed first or
last, the result is always correct because the algorithm continuously keeps track of the minimum depth
seen so far.

Why Z-Buffering is Dominant


Property Z-Buffer
Complexity O(1) per pixel per surface — constant time depth comparison
Order independence Surfaces can be submitted in any order; result is always
correct
Hardware support Built into every modern GPU — extremely fast in practice
Memory requirement One extra 2-D array the size of the frame buffer (16–32 bits
per pixel)
Handles any geometry Works correctly for polygons of any shape, including curved
surfaces approximated by triangles

Limitations of the Z-Buffer


• Z-fighting: when two surfaces have very similar (nearly identical) Z-values, floating-point
precision errors cause the depth comparison to flicker between the two surfaces, producing an
ugly shimmering artifact. Mitigated by keeping the near and far clipping planes close together to
maximise depth precision.
• Transparency: the basic Z-buffer only keeps the closest opaque surface. Transparent objects
require additional techniques (depth peeling, order-independent transparency).
• Memory bandwidth: reading and writing the Z-buffer for every fragment at high resolution
consumes significant memory bandwidth, though GPU hardware caching mitigates this.

Other Hidden-Surface Algorithms (for context)


While the Z-buffer dominates real-time rendering, other algorithms exist:
• Backface Culling: Cheapest first-pass removal — discards polygons whose outward normal
faces away from the camera. Not sufficient alone, but drastically reduces the work for
subsequent algorithms.
• Painter's Algorithm: Sort polygons by depth and draw furthest-to-closest. Simple but fails for
overlapping or intersecting polygons.
• BSP Trees (Binary Space Partitioning): Pre-process scene geometry into a tree that
guarantees a valid back-to-front drawing order. Used in early 3-D games (Quake).
Page 17
Computer Graphics — Chapter 2: Graphics Hardware

• Scanline Algorithm: Processes the scene one scan line at a time, determining visibility
intervals along each row. Historically important in offline rendering.
• Ray Casting / Ray Tracing: For each pixel, casts a ray into the scene and finds the first
surface it hits — inherently solves hidden-surface removal. Used for high-quality offline
rendering.

KEY TAKEAWAYS
• Hidden-surface removal ensures only the closest surface at each pixel is visible —
mimicking real-world depth occlusion.
• The Z-buffer algorithm maintains a depth buffer alongside the colour buffer; at each pixel it
keeps the smallest Z value seen.
• Algorithm is order-independent: surfaces can be processed in any order and the result is
always correct.
• Two buffers required: z-buffer(i,j) for depth, COLOR(i,j) for colour; both initialised at the
start of each frame.
• Z-buffer is implemented in GPU hardware and runs at full rendering speed; it is the
standard for real-time graphics.
• Z-fighting occurs when two surfaces have nearly equal depth — precision artifacts cause
flickering at their boundary.
• Backface culling is a fast pre-pass; BSP trees, painter's algorithm, and ray tracing are
alternative approaches.

Glossary of Key Terms


Term Definition
Aspect Ratio Ratio of display width to height; affects how images are proportioned
Backface Culling Discarding polygons whose surface normal faces away from the
camera
Bit-Planes (Depth) Number of bits used to store each pixel's colour value
CRT Cathode Ray Tube — display device using an electron beam and
phosphor
Deflection Yoke Electromagnetic coil assembly that steers the electron beam in X
and Y
Display Processor / Dedicated hardware for graphics computation; offloads work from
GPU the CPU
Double Buffering Technique using two frame buffers (front/back) to prevent screen
tearing
Fragment A potential pixel candidate during rasterisation, carrying colour and
depth data
Frame Buffer 2-D memory array storing pixel values for the current display frame

Page 18
Computer Graphics — Chapter 2: Graphics Hardware

Frustum The truncated-pyramid shaped view volume used in perspective


projection
Frustum Culling Discarding geometry that lies entirely outside the view frustum
Gouraud Shading Interpolating vertex colours across a triangle's surface during
rasterisation
Hidden-Surface Determining and displaying only visible surfaces, hiding occluded
Elimination ones
Instancing Reusing one geometry model multiple times with different transforms
Interlaced Scanning Refreshing odd-numbered and even-numbered scan lines in
alternating passes
NDC Normalised Device Coordinates — standard cube after projection
and clipping
Orthographic Projection that preserves size regardless of distance from camera
Projection
Persistence Duration for which phosphor continues to emit light after electron
beam passes
Perspective Projection that makes distant objects appear smaller (realistic)
Projection
Pixel Picture cell — the smallest addressable dot in a raster display
Progressive Refreshing all scan lines in sequential order (non-interlaced)
Scanning
Raster Rectangular grid of pixels covering the entire display surface
Rasterisation Converting mathematical primitives into discrete pixel fragments
Refresh Rate Number of times the complete display is redrawn per second (Hz)
Resolution Number of pixels in the display: x-resolution x y-resolution
Scan Line A single horizontal row of pixels across the raster
Shadow Mask Perforated metal plate ensuring each electron beam hits its correct
colour phosphor
Stereoscopy Technique of presenting separate images to each eye to create
depth perception
View Repositions the scene so the camera is at the origin looking along Z
Transformation
Z-buffer Depth buffer storing the smallest Z-value encountered at each pixel
during rendering
Z-fighting Depth precision artifact causing flickering where two surfaces have
nearly equal Z-values

Review Questions
Test your understanding by attempting these before consulting your notes:

Page 19
Computer Graphics — Chapter 2: Graphics Hardware

Section 2.1 — Raster Display Systems


1. What are the five main hardware components of a graphics system and what is each
component's role?
2. Explain how a CRT uses the shadow mask to produce colour. Why is the shadow mask
necessary?
3. Distinguish between random-scan and raster-scan displays. Give one advantage and one
disadvantage of each.
4. Define: pixel, scan line, x-resolution, y-resolution, aspect ratio, frame buffer, bit-planes.
5. What is phosphor persistence and why does it necessitate a refresh rate?
6. How does interlaced scanning reduce perceived flicker without increasing the actual refresh
rate?
7. Calculate the frame buffer memory required for a 1920x1080 display at 24-bit colour depth.
Express in MB.
8. What is the difference between hardware rendering and software rendering?

Section 2.2 — The 3D Graphics Pipeline


9. List and briefly describe the three main stages of the graphics pipeline.
10. What tasks are typically handled in the Application stage? Why must these run on the CPU
rather than the GPU?
11. Describe the sequence of coordinate spaces a vertex passes through in the Geometry stage,
and the transformation applied at each step.
12. Compare perspective and orthographic projection: when would you use each, and what is the
shape of each projection's view volume?
13. What is frustum culling and why is it performed before rasterisation?
14. What is double buffering and what visual problem does it solve?
15. What does a fragment shader compute, and at which pipeline stage does it run?

Section 2.3 — Hidden Surface Removal


16. What problem does hidden-surface elimination solve? Give a concrete example.
17. Describe the Z-buffer algorithm in plain English. What two data structures does it use and how
are they initialised?
18. Why is the Z-buffer order-independent? Explain with reference to the comparison step.
19. What is Z-fighting? What causes it and how can it be mitigated?
20. Name three alternative hidden-surface algorithms and briefly state how each works.

Page 20

You might also like