0% found this document useful (0 votes)
6 views

Computer Graphics and Animation

The document provides an overview of computer graphics and animation, detailing its history, applications, and fundamental concepts. It discusses the evolution of computer graphics from the early 1960s to the present, highlighting key developments in hardware and software. Additionally, it emphasizes the significance of computer graphics in various fields such as medical imaging, scientific visualization, and entertainment.

Uploaded by

collinsjr46
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Computer Graphics and Animation

The document provides an overview of computer graphics and animation, detailing its history, applications, and fundamental concepts. It discusses the evolution of computer graphics from the early 1960s to the present, highlighting key developments in hardware and software. Additionally, it emphasizes the significance of computer graphics in various fields such as medical imaging, scientific visualization, and entertainment.

Uploaded by

collinsjr46
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

COMPUTER GRAPHICS ANIMATION

2024
Lecturer: ACHOH S. TIMAH

The term "Computer Animation" suggests that computers bring


something new to the traditional way of animating. Traditional
animation is defined as a technique in which the illusion of
movement is created by photographing a series of individual
drawings on successive frames of film.

Yaoundé International Business School


www.yibs.org
+237 670828872
[email protected]
Chapter One:

Module 1: Definition and Concepts of Computer Graphics

 Unit 1: Computer Graphics and Applications


 Unit 2: Hardware, Software and Display Devices
 Unit 3: Graphics Data Structure
 Unit 4: Colour Theory
 Unit 5: Image Representation
INTRODUCTION
Computer graphics is concerned with producing images and animations (or sequences of
images) using a computer. This includes the hardware and software systems used to make
these images. The task of producing photo-realistic images is an extremely complex one, but
this is a field that is in great demand because of the nearly limitless variety of applications.
The field of computer graphics has grown enormously over the past 10–20 years, and many
software systems have been developed for generating computer graphics of various sorts.
This can include systems for producing 3-dimensional models of the scene to be drawn, the
rendering software for drawing the images, and the associated userinterface software and
hardware.
The field of computer graphics dates back to the early 1960’s with Ivan Sutherland, one of
the pioneers of the field. This began with the development of the (by current standards)
very simple software for performing the necessary mathematical transformations to
produce simple line-drawings of 2- and 3-dimensional scenes.

As time went on, and the capacity and speed of computer technology improved, successively
greater degrees of realism were achievable. Today it is possible to produce images that are
practically indistinguishable from photographic images.
Unit 1: COMPUTER GRAPHICS AND APPLICATIONS
1.0 Introduction
2.0 Objectives
3.0 Main Content
3.1 Definition of Computer Graphics
3.2 History
3.3 Application of Computer Graphics
3.4 What is Interactive Computer Graphics?
3.5 What do we need in Computer Graphics?
3.6 The Graphics Rendering Pipeline
4.0 Conclusion
5.0 Summary
6.0 Tutor Marked Assignment

1.0 Introduction
Given the state of current technology, it would be possible to design an entire university
major to cover everything (important) that is known about computer graphics. In this
introductory course, we will attempt to cover only the merest fundamentals upon which the
field is based. Nonetheless, with these fundamentals, you will have a remarkably good
insight into historical development of Computer graphics, the various application areas and
the graphics rendering pipeline.

2.0 Objectives
Upon successful completion of this unit, students will:
• have an understanding of the history of computer graphics
• have gained an appreciation for the art of computer graphics
• Understand the basic Graphic rendering pipeline.
3.1 Definition of Computer Graphics.
Computer graphics generally means creation, storage and manipulation of models and
images. Such models come from diverse and expanding set of fields including physical,
mathematical, artistic, biological, and even conceptual (abstract) structures.
“Perhaps the best way to define computer graphics is to find out what it is not. It is not a
machine. It is not a computer, nor a group of computer programs. It is not the know-how of
a graphic designer, a programmer, a writer, a motion picture specialist, or a reproduction
specialist.
Computer graphics is all these –a consciously managed and documented technology
directed toward communicating information accurately and descriptively.

3.2 History
3.1.1 The Age of Sutherland
In the early 1960's IBM, Sperry-Rand, Burroughs and a few other computer companies
existed. The computers of the day had a few kilobytes of memory, no operating systems to
speak of and no graphical display monitors. The peripherals were Hollerith punch cards, line
printers, and roll-paper plotters. The only programming languages supported were
assembler, FORTRAN, and Algol. Function graphs and “Snoopy'' calendars were about the
only graphics done.
In 1963 Ivan Sutherland presented his paper Sketchpad at the Summer Joint Computer
Conference. Sketchpad allowed interactive design on a vector graphics display monitor with
a light pen input device. Most people mark this event as the origins of computer graphics.

3.1.2 The Middle to Late '60's


Software and Algorithms
Jack Bresenham taught us how to draw lines on a raster device. He later extended this to
circles. Anti-aliased lines and curve drawing is a major topic in computer graphics. Larry
Roberts pointed out the usefulness of homogeneous coordinates, matrices and hidden line
detection algorithms. Steve Coons introduced parametric surfaces and developed 17 early
computer aided geometric design concepts. The earlier work of Pierre Bézier on parametric
curves and surfaces also became public. Author Appel at IBM developed hidden surface and
shadow algorithms that were pre-cursors to ray tracing. The fast Fourier transform was
discovered by Cooley and Tukey. This algorithm allows us to better understand signals and is
fundamental for developing antialiasing techniques. It is also a precursor to wavelets.

Hardware and Technology


Doug Englebart invented the mouse at Xerox PARC. The Evans & Sutherland Corporation and
General Electric started building flight simulators with real-time raster graphics. The floppy
disk was invented at IBM and the microprocessor was invented at Intel. The concept of a
research network, the ARPANET, was developed.

3.1.3 The Early '70's


The state of the art in computing was an IBM 360 computer with about 64 KB of memory, a
Tektronix 4014 storage tube, or a vector display with a light pen (but these were very
expensive).

Software and Algorithms


Rendering (shading) were discovered by Gouraud and Phong at the University of Utah.
Phong also introduced a reflection model that included specular highlights. Keyframe based
animation for 3-D graphics was demonstrated. Xerox PARC developed a ``paint'' program. Ed
Catmull introduced parametric patch rendering, the z-buffer algorithm, and texture
mapping. BASIC, C, and Unix were developed at Dartmouth and Bell Labs.

Hardware and Technology


An Evans & Sutherland Picture System was the high-end graphics computer. It was a vector
display with hardware support for clipping and perspective. Xerox PARC introduced the Altos
personal computer, and an 8 bit computer was invented at Intel.
3.1.4 The Middle to Late '70's
Software and Algorithms
Turned Whitted developed recursive ray tracing and it became the standard for
photorealism, living in a pristine world. Pascal was the programming language everyone
learned.

Hardware and Technology


The Apple I and II computers became the first commercial successes for personal computing.
The DEC VAX computer was the mainframe (mini) computer of choice. Arcade games such as
Pong and Pac Mac became popular. Laser printers were invented at Xerox PARC.

3.1.5 The Early '80's


Hardware and Technology The IBM PC was marketed in 1981 The Apple MacIntosh started
production in 1984, and microprocessors began to take off, with the Intel x86 chipset, but
these were still toys. Computers with a mouse, bitmapped (raster) display, and Ethernet
became the standard in academic and science and engineering settings.

3.1.6 The Middle to Late '80's


Software and Algorithms
Jim Blinn introduces blobby models and texture mapping concepts. Binary space partitioning
(BSP) trees were introduced as a data structure, but not many realized how useful they
would become. Loren Carpenter starting exploring fractals in computer graphics. Postscript
was developed by John Warnock and Adobe was formed. Steve Cook introduced stochastic
sampling to ray tracing. Paul Heckbert taught us to ray trace Jello (this is a joke;) Character
animation became the goal for animators. Radiosity was introduced by the Greenberg and
folks at Cornell. Photoshop was marketed by Adobe. Video arcade games took off, many
people/organizations started publishing on the desktop. Unix and X windows were the
platforms of choice with programming in C and C++, but MS-DOS was starting to rise.
Hardware and Technology
Sun workstations, with the Motorola 680x0 chipset became popular as advanced
workstation a in the mid 80's. The Video Graphics Array (VGA) card was invented at IBM.
Silicon Graphics (SGI) workstations that supported real-time raster line drawing and later
polygons became the computer graphicists desired. The data glove, a precursor to virtual
reality, was invented at NASA. VLSI for special purpose graphics processors and parallel
processing became hot research areas.

3.1.7 The Early '90's


The computer to have now was an SGI workstation with at least 16 MB of memory, at 24-bit
raster display with hardware support for Gouraud shading and z-buffering for hidden surface
removal. Laser printers and single frame video recorders were standard. Unix, X and Silicon
Graphics GL were the operating systems, window system and application programming
interface (API) that graphicist used. Shaded raster graphics were starting to be introduced in
motion pictures. PCs started to get decent, but still they could not support 3-D graphics, so
most programmer's wrote software for scan conversion (rasterization) used the painter's
algorithm for hidden surface removal, and developed “tricks”' for real-time animation.

Software and Algorithms


Mosaic, the first graphical Internet browser was written by xxx at the University of Illinois,
National Center for Scientific Applications (NCSA). MPEG standards for compressed video
began to be promulgated. Dynamical systems (physically based modeling) that allowed
animation with collisions, gravity, friction, and cause and effects were introduced. In 1992
OpenGL became the standard for graphics APIs In 1993, the World Wide Web took off.
Surface subdivision algorithms were rediscovered. Wavelets begin to be used in computer
graphics.
Hardware and Technology
Hand-held computers were invented at Hewlett-Packard about 1991. Zip drives were
invented at Iomega. The Intel 486 chipset allowed PC to get reasonable floating point
performance. In 1994, Silicon Graphics produced the Reality Engine: It had hardware for
real-time texture mapping. The Ninetendo 64 game console hit the market providing Reality
Engine-like graphics for the masses of games players. Scanners were introduced.

3.1.8 The Middle to Late '90's


The PC market erupts and supercomputers begin to wane. Microsoft grows, Apple collapses,
but begins to come back, SGI collapses, and lots of new startups enter the graphics field.

Software and Algorithms


Image based rendering became the area for research in photo-realistic graphics. Linux and
open source software become popular.

Hardware and Technology


PC graphics cards, for example 3dfx and Nvidia, were introduced. Laptops were introduced
to the market. The Pentium chipset makes PCs almost as powerful as workstations. Motion
capture, begun with the data glove, becomes a primary method for generating animation
sequences. 3-D video games become very popular: DOOM (which uses BSP trees), Quake,
Mario Brothers, etc. Graphics effects in movies becomes pervasive: Terminator 2, Jurassic
Park, Toy Story, Titanic, Star Wars I. Virtual reality and the Virtual Reality Meta (Markup)
Language (VRML) become hot areas for research. PDA's, the Palm Pilot, and flat panel
displays hit the market.

3.1.9 The '00's


Today most graphicist want an Intel PC with at least 256 MB of memory and a 10 GB hard
drive. Their display should have graphics board that supports real-time texture mapping. A
flatbed scanner, color laser printer, digital video camera, DVD, and MPEG encoder/decoder
are the peripherals one wants. The environment for program development is most likely
Windows and Linux, with Direct 3D and OpenGL, but Java 3D might become more important.
Programs would typically be written in C++ or Java.
What will happen in the near future -- difficult to say, but high definition TV (HDTV) is poised
to take off (after years of hype). Ubiquitous, untethered, wireless computing should become
widespread, and audio and gestural input devices should replace some of the functionality
of the keyboard and mouse.
You should expect 3-D modeling and video editing for the masses, computer vision for
robotic devices and capture facial expressions, and realistic rendering of difficult things like a
human face, hair, and water. With any luck C++ will fall out of favor.

3.1.10 Ethical Issues


Graphics has had a tremendous effect on society. Things that affect society often lead to
ethical and legal issues. For example, graphics are used in battles and their simulation,
medical diagnosis, crime reenactment, cartoons and films. The ethical role played by a
computer graphic is in the use of graphics programs that may be used for these and other
purposes is discussed and analyzed in the notes on Ethics.

3.3 Application of Computer Graphics


3.2.1 Medical Imaging
There are few endeavors more noble than the preservation of life. Today, it can honestly be
said that computer graphics plays a significant role in saving lives. The range of application
spans from tools for teaching and diagnosis, all the way to treatment. Computer graphics is
tool in medical applications rather than a mere artifact. No cheating or tricks allowed.

3.2.2 Scientific Visualization


Computer graphics makes vast quantities of data accessible. Numerical simulations
frequently produce millions of data values. Similarly, satellite-based sensors amass data at
rates beyond our abilities to interpret them by any other means than visually.
Mathematicians use computer graphics to explore abstract and high-dimensional functions
and spaces. Physicists can use computer graphics to transcend the limits of scale. With it
they can explore both microscopic and macroscopic world.

3.2.3 Computer Aided Design


Computer graphics has had a dramatic impact on the design process. Today, most
mechanical and electronic designs are executed entirely on computer. Increasingly,
architectural and product designs are also migrating to the computer. Automated tools are
also available that verify tolerances and design constraints directly from CAD designs. CAD
designs also play a key role in a wide range of processes from the design of tooling fixtures
to manufacturing.

3.2.4 Graphical User Interfaces (GUIs)


Computer graphics is an integral part of everyday computing. Nowhere is this fact more
evident than the modern computer interface design. Graphical elements such as windows,
cursors, menus, and icons are so common place it is difficult to imagine computing without
them. Once graphics programming was considered a speciality. Today, nearly all professional
programmers must have an understanding of graphics in order to accept input and present
output to users.

3.2.5 Games
Games are an important driving force in computer graphics. In this class we are going to talk
about games. We'll discuss on how they work. We'll also question how they get so much
done with so little to work with.

3.2.6 Entertainment
If you can imagine it, it can be done with computer graphics. Obviously, Hollywood has
caught on to this. Each summer, we are amazed by stateof-the-art special effects. Computer
graphics is now as much a part of the entertainment industry as stunt men and makeup. The
entertainment industry plays many other important roles in the field of computer graphics.

3.4 What is Interactive Computer Graphics?


User controls contents, structure, and appearance of objects and their displayed images
through rapid visual feedback.
Basic components of an interactive graphics system input (e.g., mouse, tablet and stylus,
force feedback device, scanner, live video streams…), processing (and storage),
display/output (e.g., screen, paper-based printer, video recorder, non-linear editor.

3.5 What do we need in computer graphics?


In computer graphics we work with points and vectors defined in terms of some coordinate
frame (a positioned coordinate system). We also need to change coordinate representation
of points and vectors, hence to transform between different coordinate frames. Hence a
mathematical background of geometry and algebra is very essential and also a knowledge of
basic programming in C language.

3.6 The Graphics Rendering Pipeline


Rendering is the conversion of a scene into an image:

The scene composed of models in three space. Models, composed of primitives, supported
by the rendering system. Models entered by hand or created by a program.
For our purposes today, models already generated. The image drawn on monitor, printed on
laser printer, or written to a raster in memory or a file. These different possibilities require
us to consider device independence.
Classically, “model” to “scene”' to “image” conversion broken into finer steps, called the
graphics pipeline. Commonly implemented in graphics hardware to get interactive speeds.
At a high level, the graphics pipeline usually looks like

Each stage refines the scene, converting primitives in modelling space to primitives in device
space, where they are converted to pixels (rasterized).
A number of coordinate systems are used:

MCS: Modeling Coordinate System.


WCS: World Coordinate System.
VCS: Viewer Coordinate System.
NDCS: Normalized Device Coordinate System.
DCS or SCS: Device Coordinate System or equivalently the Screen Coordinate System.
Keeping these straight is the key to understanding a rendering system. Transformation
between two coordinate systems represented with matrix. Derived information may be
added (lighting and shading) and primitives may be removed (hidden surface removal) or
modified (clipping).

4.0 Conclusion
Computer graphics (CG) is the field of visual computing, where one utilizes computers both
to generate visual images synthetically and to integrate or alter visual and spatial
information sampled from the real world.

5.0 Summary
In this unit, we have learnt
i. the evolution of computer graphics from the early days to the recent times, the
technological innovations
ii. The various application areas of computer graphics
iii. What is needed in computer graphics
iv. Graphics rendering pipeline.

6.0 Tutor Assignment


1a. What is Computer Graphics all about?
b. Write on the history of Computer graphics under the following:
i) the age of Sutherland
ii) the Early ‘70’s
iii) the ‘00’s
2a. What are the application areas of computer graphics?
b. Briefly describe the basic graphics rendering pipeline.
Unit 2: HARDWARE SOFTWARE DISPLAY DEVICES

1.0 Introduction
2.0 Objectives
3.0 Main Content
3.1 Types of input devices
3.2 Graphics Software
3.3 OpenGL
3.4 Hardwar
3.5 Display Hardware
4.0 Conclusion
5.0 Summary
6.0 Tutor-Marked Assignment

1.0 Introduction
Computer graphics don’t work in isolation. They require Hardware- the physical component
that houses the software. The software tools to create graphics applications are also needed
and display devices for effective output are not left. These and their functionalities, we shall
discuss in this unit.

2.0 Objectives
At the completion of this unit, the students are expected to get acquainted with the
following:

· Basics of graphics hardware and software


· Graphics display devices · Hard copy technologies
· Display technologies
· Raster and random scan display systems
3.0 Main Content
Types of Input Devices

Devices can be described either by


- Physical properties
· Mouse
· Keyboard
· Trackball
- Logical Properties
· What is returned to program via API
A position
An object identifier
Input Devices are also categorized as follows
String: produces string of characters. (e.g keyboard)
Valuator: generates real number between 0 and 1.0 (e.g.knob)
Locator: User points to position on display (e.g. mouse)
Pick: User selects location on screen (e.g. touch screen in restaurant, ATM)

3.1 Graphics Software


Graphics software (that is, the software tool needed to create graphics applications) has
taken the form of subprogram libraries. The libraries contain functions to do things like:
draw points, lines, polygons apply transformations fill areas with color handle user
interactions. An important goal has been the development of standard
hardwareindependent libraries such as:
CORE GKS (Graphical Kernel Standard)
PHIGS (Programmer’s Hierarchical Interactive Graphics System)
X Windows OpenGL
Hardware vendors may implement some of the OpenGL primitives in hardware for speed.
3.2 OpenGL:
gl: basic graphics operations
glu: utility package containing some higher-level modeling capabilities (curves, splines)
glut: toolkit. adds platform-independent functions for window management, mouse and
keyboard interaction, pull-down menus glui: adds support for GUI tools like buttons, sliders,
etc.
Open Inventor. An object-oriented API built on top of OpenGL.
VRML. Virtual Reality Modeling Language. Allows creation of a model which can then be
rendered by a browser plug-in. Java3d. Has hierarchical modeling features similar to VRML.
POVray. A ray-tracing renderer.

3.3 Hardware
“Vector graphics” Early graphic devices were line-oriented. For example, a “pen plotter”
from H-P. Primitive operation is line drawing. “Raster graphics” Today’s standard. A raster is
a 2-dimensional grid of pixels (picture elements). Each pixel may be addressed and
illuminated independently. So the primitive operation is to draw a point; that is, assign a
color to a pixel. Everything else is built upon that. There are a variety of raster devices, both
hardcopy and display.

Hardcopy:
Laserprinter
Ink-jet printer
Film recorder
Electrostatic printer
Pen plotte

3.4 Display Hardware


An important component is the “refresh buffer” or “frame buffer” which is a random-access
memory containing one or more values per pixel, used to drive the display. The video
controller translates the contents of the frame buffer into signals used by the CRT to
illuminate the screen. It works as follows:

1. The display screen is coated with “phospors” which emit light when excited by an
electron beam. (There are three types of phospor, emitting red, green, and blue light.) They
are arranged in rows, with three phospor dots (R, G, and B) for each pixel.
2. The energy exciting the phosphors dissipates quickly, so the entire screen must be
refreshed 60 times per second.
3. An electron gun scans the screen, line by line, mapping out a scan pattern. On each
scan of the screen, each pixel is passed over once. Using the contents of the frame buffer,
the controller controls the intensity of the beam hitting each pixel, producing a certain color.

3.4.1 Cathode Ray Tube (CRT)

Electron gun sends beam aimed (deflected) at a particular point on the screen, Traces out a
path on the screen, hitting each pixel once per cycle. “scan lines” · Phosphors emit light
(phosphoresence); output decays rapidly (exponentially - 10 to 60 microseconds) · As a
result of this decay, the entire screen must be redrawn (refreshed) at least 60 times per
second. This is called the refresh rate. If the refresh rate is too slow, we will see a noticeable
flicker on the screen. CFF (Critical Fusion Frequency) is the minimum refresh rate needed to
avoid flicker. This depends to some degree on the human observer. Also depends on the
persistence of the phosphors; that is, how long it takes for their output to decay. · The
horizontal scan rate is defined as the number of scan lines traced out per second. · The most
common form of CRT is the shadow-mask CRT. Each pixel consists of a group of three
phosphor dots (one each for red, green, and blue), arranged in a triangular form called a
triad. The shadow mask is a layer with one hole per pixel. To excite one pixel, the electron
gun (actually three guns, one for each of red, green, and blue) fires its electron stream
through the hole in the mask to hit that pixel. · The dot pitch is the distance between the
centers of two triads. It is used to measure the resolution of the screen.

(Note: On a vector display, a scan is in the form of a list of lines to be drawn, so the time to
refresh is dependent on the length of the display list.)

3.4.2 Liquid Crystal Display (LCD)

A liquid crystal display consists of 6 layers, arranged in the following order (back-to-front):

A reflective layer which acts as a mirror


A horizontal polarizer, which acts as a filter, allowing only the horizontal component of light
to pass through
A layer of horizontal grid wires used to address individual pixels
The liquid crystal layer
A layer of vertical grid wires used to address individual pixels
A vertical polarizer, which acts as a filter, allowing only the vertical component of light to
pass through

How it works:
The liquid crystal rotates the polarity of incoming light by 90 degrees. Ambient light is
captured, vertically polarized, rotated to horizontal polarity by the liquid crystal layer, passes
through the horizontal filter, is reflected by the reflective layer, and passes back through all
the layers, giving an appearance of lightness. However, if the liquid crystal molecules are
charged, they become aligned and no longer change the polarity of light passing through
them. If this occurs, no light can pass through the horizontal filter, so the screen appears
dark.

The principle of the display is to apply this charge selectively to points in the liquid crystal
layer, thus lighting or not lighting points on the screen. Crystals can be dyed to provide color.
An LCD may be backlit, so as not to be dependent on ambient light.

TFT (thin film transistor) is most popular LCD technology today. Plasma Display Panels.
 Promising for large format displays
 Basically fluorescent tubes
 High-voltage discharge excites gas mixture (He, Xe)
 Upon relaxation UV light is emitted
 UV light excites phosphors
 Large viewing angle

3.4.3 Vector Displays


Oscilloscopes were some of the 1st computer displays
Used by both analog and digital computers
Computation results used to drive the vertical and horizontal axis (X-Y)
Intensity could also be controlled (Z-axis)
Used mostly for line drawings Called vector, calligraphic or affectionately stroker displays
Display list had to be constantly updated (except for storage tubes)
Vector Architecture

Raster Architecture

Raster display stores bitmap/pixmap in refresh buffer, also known as bitmap, frame buffer;
be in separate hardware (VRAM) or in CPU’s main memory (DRAM) Video controller draws
all scan-lines at Consistent >60 Hz; separates update rate of the frame buffer and refresh
rate of the CRT.

Field Emission Devices (FEDs)


Works like a CRT with multiple electron guns at each pixel uses modest voltages applied to
sharp points to produce strong E fields
Reliable electrodes proven difficult to produce
Limited in size
Thin, and requires a vacuum

Interfacing between the CPU and the Display


A typical video interface card contains a display processor, a frame buffer, and a video
controller. The frame buffer is a random access memory containing some memory (at least
one bit) for each pixel, indicating how the pixel is supposed to be illuminated. The depth of
the frame buffer measures the number of bits per pixel. A video controller then reads from
the frame buffer and sends control signals to the monitor, driving the scan and refresh
process. The display processor processes software instructions to load the frame buffer with
data.

(Note: In early PCs, there was no display processor. The frame buffer was part of the physical
address space addressable by the CPU. The CPU was responsible for all display functions.)
Some Typical Examples of Frame Buffer Structures:

1. For a simple monochrome monitor, just use one bit per pixel.

2. A gray-scale monitor displays only one color, but allows for a range of intensity levels
at each pixel. A typical example would be to use 6-8 bits per pixel, giving 64-256 intensity
levels. For a color monitor, we need a range of intensity levels for each of red, green, and
blue. There are two ways to arrange this.

3. A color monitor may use a color lookup table (LUT). For example, we could have a LUT
with 256 entries. Each entry contains a color represented by red, green, and blue values. We
then could use a frame buffer with depth of 8. For each pixel, the frame buffer contains an
index into the LUT, thus choosing one of the 256 possible colors. This approach saves
memory, but limits the number of colors visible at any one time.
4. A frame buffer with a depth of 24 has 8 bits for each color, thus 256 intensity levels for
each color. 224 colors may be displayed. Any pixel can have any color at any time. For a
1024x1024 monitor we would need 3 megabytes of memory for this type of frame buffer.
The display processor can handle some medium-level functions like scan conversion
(drawing lines, filling polygons), not just turn pixels on and off. Other functions: bit block
transfer, display list storage. Use of the display processor reduces CPU involvement and bus
traffic resulting in a faster processor. Graphics processors have been increasing in power
faster than CPUs, a new generation every 6-9 months. example: 10 3E. NVIDIA GeForce FX.

· 125 million transistors (GeForce4: 63 million)


· 128MB RAM
· 128-bit floating point pipeline
One of the advantages of a hardware-independent API like OpenGL is that it can be used
with a wide range of CPU-display combinations, from software-only to hardware-only. It also
means that a fast video card may run slowly if it does not have a good implementation of
OpenGL.

4.0 Conclusion
Computer graphics ultimately involves creation, storage and manipulation of models and
images. This however is made realistic through effective hardware, software and display
devices.

5.0 Summary
In this module, we have leant that:
i. Input devices are of various types and can further be categorized.
ii. Computer Graphics software are the software require to run computer graphics.
iii. There are different display hardware such as the LCD, CRT, etc. Also learnt about their
architecture and functionality
6.0 Tutor’s Assignment
1. Explain about the display technologies?
2. Explain various display devices?
3. What are the different hardware and software of graphics?
4. List five graphic hard copy devices and for each one, briefly explain
- How it works.
- Its advantages and limitations.
- The circumstances when it would be more useful.
Unit 3: GRAPHICS DATA STRUCTURES

Contents
1.0 Introduction
2.0 Objectives
3.0 Main Content
3.1 Quadtrees
3.2K-d-trees
3.3 BSP Trees
3.4 Bounding Volume Hierarchies
4.0 Conclusion
5.0 Summary
6.0 Tutor Marked Assignment

1.0Introduction
In recent years, methods from computational geometry have been widely adopted by the
computer graphics community. Many solutions draw their elegance and efficiency from the
mutually enriching combination of such geometrical data structures with computer graphics
algorithms. This course imparts a working knowledge of a number of essential geometric
data structures and explains their elegant use in several representatives, diverse, and
current areas of research in computer graphics such as terrain visualization, texture
synthesis, modelling, and tesselation. Our selection of data structures and algorithms
consists of well-known concepts, which are both powerful and easy to implement, ranging
from quadtrees to BSP trees and bounding volume trees.

2.0 Objectives
The major objective of this unit is to present each geometric data structure, familiarize
students with some very versatile and ubiquitous geometric data structures, enable them to
readily recognize geometric problems during their work, modify the algorithms to their
needs, and hopefully make them familiar with the basic principles of graphics data and the
type of problems in the area.

3.0 Main Content


3.1 Quadtrees
A quadtree is a rooted tree so that every internal node has four children. Every node in the
tree corresponds to a square. If a node v has children, their corresponding squares are the
four quadrants, as shown

Quadtrees can store many kinds of data. We will describe the variant that stores a set of
points and suggest a recursive definition. A simple recursive splitting of squares is continued
until there is only one point in a square. Let P be a set of points. The definition of a quadtree
for a set of points in a square Q = [x1Q : x2Q] £ [y1Q : y2Q] is as follows:

• If jPj · 1 then the quadtree is a single leaf where Q and P are stored.
• Otherwise let QNE, QNW, QSW and QSE denote the four quadrants. Let
xmid := (x1Q + x2Q)/2 and
ymid := (y1Q + y2Q)/2, and define
PNE := {p ∈ P : px > xmid ^ py > ymid}
PNW := {p ∈ P : px · xmid ^ py > ymid}
PSW := {p ∈ P : px · xmid ^ py · ymid}
PSE := {p ∈ P : px > xmid ^ py · ymid}
The quadtree consists of a root node v, Q is stored at v. In the following, let Q(v) denote the
square stored at v. Furthermore v has four children: The X-child is the root of the quadtree
of the set PX, where X is an element of the set {NE, NW, SW, SE}.

3.1.1 Uses
Quadtrees are used to partition 2-D space, while octrees are for 3-D. The two concepts are
nearly identical, and I think it is unfortunate that they are given different names.
Handling Observer-Object Interactions:

Subdivide the quadtree/octree until each leaf’s region intersects only a small number of
objects.
Each leaf holds a list of pointers to objects that intersect its region.
Find out which leaf the observer is in. We only need to test for interactions with the objects
pointed to by that leaf.
• Inside/Outside Tests for Odd Shapes
The root node represent a square containing the shape.

If a node’s region lies entirely inside or entirely outside the shape, do not subdivide it.
Otherwise, do subdivide (unless a predefined depth limit has been exceeded).
Then the quadtree or octree contains information allowing us to check quickly whether a
given point is inside the shape.
• Sparse Arrays of Spatially-Organized Data
Store array data in the quadtree or octree.
Only subdivide if that region of space contains interesting data.
This is how an octree is used in the BLUIsculpt program.

3.2 K-d-Trees
The k-d-tree is a natural generalization of the one dimensional search tree.
Let D be a set of n points in k. For convenience let k = 2 and let us assume that all X- and
Y- coordinates are different.

First, we search for a split-value s of the X-coordinates. Then we split D by the split-line X = s
into subsets:
D<s={(x, y)}ϵ D; x <s } = D Ո {X < S}
D>s = ,(x, y) D; x > s- = D ∩ ,X > s-.

For both sets we proceed with the Y-coordinate and split-lines Y = t1 and Y = t2. We repeat
the process recursively with the constructed subsets. Thus, we obtain a binary tree, namely
the 2-tree of the point set D, as shown in the Figure above. Each internal node of the tree
corresponds to a split-line.

For every node v of the 2-d-tree we define the rectangle R(v), which is the intersection of
halfplanes corresponding to the path from the root to v. For the root r, R(r) is the plane
itself; for the sons of r, say left and right, we produce to halfplanes R(left) and R(right) and so
on. The set of rectangles {R(l) : l is a leaf}gives a partition of the plane into rectangles. Every
R(l) has exactly one point of D inside.
This structure supports range queries of axis parallel rectangles. For example, if Q is an axis-
parallel rectangle, the set of sites vϵ D with vϵ
Q can be computed efficiently. We simply have to compute all nodes v with:
R(v) ∩ ≠ □
Additionally we have to test whether the points inside the subtree of v are inside Q.

3.3 BSP Trees


BSP trees (short for binary space partitioning trees) can be viewed as a generalization of k-d
trees. Like k-d trees, BSP trees are binary trees, but now the orientation and position of a
splitting plane can be chosen arbitrarily. The figure below depicts the feeling of a BSP tree.

A Binary Space Partition tree (BSP tree) is a very different way to represent a scene, Nodes
hold facets, the structure of the tree encodes spatial information about the scene. It is useful
for HSR and related applications

3.2.1 Characteristics of BSP Tree


A BSP tree is a binary tree.
Nodes can have 0, 1, or two children.
Order of child nodes matters, and if a node has just 1 child, it matters
whether this is its left or right child.
• Each node holds a facet.
This may be only part of a facet from the original scene. When constructing a BSP tree, we
may need to split facets.
• Organization:
Each facet lies in a unique plane. In 2-D, a unique line. For each facet, we choose one
side of its plane to be the “outside”. (The other direction is “inside”.) This can be the side
the normal vector points toward. Rule: For each node,
• Its left descendant subtree holds only facets “inside” it.
• Its right descendant subtree holds only facets “outside” it.

3.2.2 Construction
• To construct a BSP tree, we need: A list of facets (with vertices). An “outside” direction for
each.
• Procedure:
Begin with an empty tree. Iterate through the facets, adding a new node to the tree for
each new facet. The first facet goes in the root node. For each subsequent facet, descend
through the tree, going left or right depending on whether the facet lies inside or outside
the facet stored in the relevant node.
• If a facet lies partially inside & partially outside, split it along the plane *line+ of the
facet.
• The facet becomes two “partial” facets. Each inherits its “outside” direction from
the original facet.
• Continue descending through the tree with each partial facet separately.
Finally, the (partial) facet is added to the current tree as a leaf.

3.2.3 Simple Example


• Suppose we are given the following (2-D) facets and “outside” directions:
• We iterate through the facets in numerical order. Facet 1 becomes the root. Facet 2 is
inside of 1. Thus, after facet 2, we have the following BSP tree:
• Facet 3 is partially inside facet 1 and partially outside. We split facet 3 along the line
containing facet 1. The resulting facets are 3a and 3b. They inherit their “outside” directions
from facet 3.
• We place facets 3a and 3b separately. Facet 3a is inside facet 1 and outside facet 2. Facet
3b is outside facet 1. The final BSP tree looks like this:

3.2.4 Traversing
An important use of BSP trees is to provide a back-to-front (or front-toback) ordering of the
facets in a scene, from the point of view of an observer.

When we say “back-to-front” ordering, we mean that no facet comes before something that
appears directly behind it. This still allows nearby facets to precede those farther away. Key
idea: All the descendants on one side of a facet can come before the facet, which can come
before all descendants on the other side.

• Procedure:
For each facet, determine on which side of it the observer lies. Back-to-front ordering: Do an
in-order traversal of the tree in which the subtree opposite from the observer comes before
the subtree on the same side as the observer.

• Procedure:
For each facet, determine on which side of it the observer lies. Back-to-front ordering: Do an
in-order traversal of the tree in which the subtree opposite from the observer comes before
the subtree on the same side as the observer.
• Our observer is inside 1, outside 2, inside 3a, outside 3b.

• Resulting back-to-front ordering: 3b, 1, 2, 3a.


• Is this really back-to-front?

Uses
• BSP trees are primarily useful when a back-to-front or front-toback ordering is desired: For
HSR. For translucency through blending.
• Since it can take some time to construct a BSP tree, they are useful primarily for: Static
scenes. Some dynamic objects are acceptable.
• BSP-tree techniques are generally a waste of effort for small scenes. We use them on:
Large, complex scenes.
3.4 Bounding Volume Hierarchies
Like the previous hierarchical data structures, bounding volume hierarchies (BVHs) are
mostly used to prevent performing an operation exhaustively on all objects. Like with
previously discussed hierarchical data structures, one can improve a huge range of
applications and queries using BVHs, such as ray shooting, point location queries, nearest
neighbor search, view frustum and occlusion culling, geographical data bases, and collision
detection (the latter will be discussed in more detail below). Often times, bounding volume
(BV) hierarchies are described as the opposite of spatial partitioning schemes, such as
quadtrees or BSP trees: instead of partitioning space, the idea is to partition the set of
objects recursively until some leaf criterion is met. Here, objects can be anything from points
to complete graphical objects. With BV hierarchies, almost all queries, which can be
implemented with space partitioning schemes, can also be answered, too. Example queries
and operations are ray shooting, frustum culling, occlusion culling, point location, nearest
neighbor, collision detection.

3.4.1 Construction of BV Hierarchies Essentially, there are 3 strategies to build BV trees:


• bottom-up,
• top-down,
• insertion
From a theoretical point of view, one could pursue a simple top-down strategy, which just
splits the set of objects into two equally sized parts, where the objects are assigned
randomly to either subset. Asymptotically, this usually yields the same query time as any
other strategy. However, in practice, the query times offered by such a BV hierarchy are by a
large factor worse.

During construction of a BV hierarchy, it is convenient to forget about the graphical objects


or primitives, and instead deal with their BVs and consider those as the atoms. Sometimes,
another simplification is to just approximate each object by its center (baryenter or
bounding box center), and then deal only with sets of points during the construction. Of
course, when the BVs are finally computed for the nodes, then the true extents of the
objects must be considered.

In the following we will describe algorithms for each construction strategy.

3.4.2 Bottom-up
In this class, we will actually describe two algorithms. Let B be the set of BVs on the top-
most level of the BV hierarchy that has been constructed so far. For each bi 2 B find the
nearest neighbor b0i 2 B; let di be the distance between bi and b0i. Sort B with respect to di.
Then, combine the first k nodes in B under a common father; do the same with the next
k elements from B, etc. This yields a new set B0, and the process is repeated. Note that this
strategy does not necessarily produce BVs with a small “dead space”:

the strategy would choose to combine the left pair (distance = 0), while choosing the right
pair would result in much less dead space. The second strategy is less greedy in that it
computes a tiling for each level. We will describe it first in 2D. Again, let B be the set of BVs
on the top-most level so far constructed, with |B| = n.

4.0 Conclusion
Presented in this unit are two data structures for multi-dimensional data: Quadtrees and kd-
Trees . Quadtrees are better in some cases as they have less overhead for keeping track of
split lines, Have faster arithmetic compared to kd-Trees, especially for graphics

5.0 Summary
The idea of the binary space partition is one with good general applicability. Some variation
of it is used in a number of different structures.
BSP trees
• Split along planes containing facets. Quadtrees & octrees
• Split along pre-defined planes. kd-trees
• Split along planes parallel to coordinate axes, so as to split up the objects nicely.
• Quadtrees are used to partition 2-D space, while octrees are for 3- D.
The two concepts are nearly identical.

6.0 Tutor Marked Assignment


1. Why do we want to build a hierarchical data structure such a bounding box hierarchy?
2. Describe a technique for constructing a bounding box hierarchy. What data structure
will you use to store this hierarchy?
3. Describe the main difference between the following two approaches:
(1) construct a bounding volume hierarchy (e.g. bounding boxes or bounding
spheres),
(2) construct a hierarchy of splitting planes (e.g. KD trees or BSP trees).
4. An alternative to the bounding box or bounding sphere hierarchy is to use splitting
planes to divide space. Octrees, KD trees, and BSP trees are all splitting plane algorithms.
Describe the differences between these approaches
Unit 4: COLOR THEORY

Contents
1.0 Introduction
2.0 Objectives
3.0 Main Content
3.1 Color Space
3.2 Light
3.3 The electromagetic spectrum
3.4 The Retina
3.5 Mapping from Reality to Perception
3.6 Colour Matching
3.7 Spectroradiometer
3.8 Complementary Colours
3.9 Dominant Wavelength
3.10 Non-Spectral Colours
3.11 Colour Gamuts
3.12 The RGB Colour Cube
3.13 Colour Printing
3.14 Colour Conversion
3.15 Other Colour Systems
4.0 Conclusion
5.0 Summary
6.0Tutor Assignment
1.0 Introduction:
Our eyes work by focusing light through an elastic lens, onto a patch at the back of our eye
called the retina. The retina contains light sensitive rod and cone cells that are sensitive to
light, and send electrical impulses to our brain that we interpret as a visual stimulus. Given
this biological apparatus, we can simulate the presence of many colours by shining Red,
Green and Blue light into the human eye with carefully chosen intensities. This is the basis
on which all colour display technologies (CRTs, LCDs, TFTs, Plasma, Data projectors) operate.
Inside our machine (TV, Computer, Projector) we represent pixel colours using values for
Red, Green and Blue (RGB triples) and the video hardware uses these values to generate the
appropriate amount of Red, Green and Blue light.

2.0 Objectives:
Upon successful completion of this module students will be able to:
• describe the nature of colour and its numerical description
• Know the basic principles of colour mixing.

3.0 MAIN CONTENT


3.1 Color space
A color model is an abstract mathematical model describing the way colors can be
represented as tuples of numbers, typically as three or four values or color components (e.g.
RGB and CMYK are color models). However, a color model with no associated mapping
function to an absolute color space is a more or less arbitrary color system with little
connection to the requirements of any given application. Adding a certain mapping function
between the color model and a certain reference color space results in a definite "footprint"
within the reference color space. This "footprint" is known as a gamut, and, in combination
with the color model, defines a new color space. For example, Adobe RGB and SRGB are two
different absolute color spaces, both based on the RGB model.
4.1 Light
Light as we perceive it is electromagnetic radiation from a narrow band of the complete
spectrum of electromagnetic radiation called the visible spectrum. The physical nature of
light has elements that are like particle (when we discuss photons) and as a wave. Recall that
wave can be described either in terms of its frequency, measured say in cycles per second,
or the inverse quantity of wavelength. The electro-magnetic spectrum ranges from very low
frequency (high wavelength) radio waves (greater than 10 centimeter in wavelength) to
microwaves, infrared, visible light, ultraviolet and x-rays and high frequency (low
wavelength) gamma rays (less than 0.01 nm in wavelength). Visible light lies in the range of
wavelengths from around 400 to 700 nm, where nm denotes a nanometer, or 10−9 of a
meter. Physically, the light energy that we perceive as color can be described in terms of a
function of wavelength λ, called the spectral distribution function or simply spectral
function, f(λ). As we walk along the wavelength axis (from long to short wavelengths), the
associated colors that we perceive varying along the colors of the rainbow red, orange,
yellow, green, blue, indigo, violet. (Remember the “Roy G. Biv” mnemonic.) Of course, these
color names are human interpretations, and not physical divisions.

4.2 The electromagetic spectrum


4.2.1 ROYGBIV acronym
The following is a potential spectral energy distribution of light reflecting from a green wall.

4.3 The Retina

The retina has both rods and cones, as shown below. It is the cones which are responsible
for colour perception.

There are three types of cones, referred to either as B, G, and R, or equivalently as S, M, and
L, respectively. Their peak sensitivities are located at approximately 430nm, 560nm, and
610nm for the "average" observer. Animals exist with both fewer and more types of cones.
The photopigments in rods and cones are stimulated by absorbed light, yielding a change in
the cell membrane potential. The different types of cells have different spectral sensitivities:

4.4 Mapping from Reality to Perception


• metamers: different spectra that are perceptually identical
• colour perception: stimulation of 3 types of cones
• surround effects, adaptation
Different spectra can be perceptually identical to the eye. Such spectra are called metamers.
Our perception of colour is related only to the stimulation of three types of cones. If two
different spectra stimulate the three cone types in the same way, they will be perceptually
indistinguishable.

4.5 Colour
Matching In order to define the perceptual 3D space in a "standard" way, a set of
experiments can (and have been) carried by having observers try and match colour of a
given wavelength, lambda, by mixing three other pure wavelengths, such as R=700nm,
G=546nm, and B=436nm in the following example. Note that the phosphours of colour TVs
and other CRTs do not emit pure red, green, or blue light of a single wavelength, as is the
case for this experiment.
The above scheme can tell us what mix of R,G,B is needed to reproduce the perceptual
equivalent of any wavelength. A problem exists, however, because sometimes the red light
needs to be added to the target before a match can be achieved. This is shown on the graph
by having its intensity, R, take on a negative value.

In order to achieve a representation which uses only positive mixing coefficients, he CIE
("Commission Internationale d'Eclairage") defined three new hypothetical light sources, x, y,
and z, which yield positive matching curves: If we are given a spectrum and wish to find the
corresponding X, Y, and Z quantities, we can do so by integrating the product of the spectral
power and each of the three matching curves over all wavelengths. The weights X,Y,Z form
the three-dimensional CIE XYZ space, as shown below.

Often it is convenient to work in a 2D colour space. This is commonly done by projecting the
3D colour space onto the plane X+Y+Z=1, yielding a CIE chromaticity diagram. The projection
is defined as given below, and produces the following chromaticity diagram:
A few definitions:

4.6 spectroradiometer
A device to measure the spectral energy distribution. It can therefore also provide the CIE
xyz tristimulus values. illuminant C A standard for white light that approximates sunlight. It is
defined by a colour temperature of 6774 K.

4.7 Complementary colours


Colours which can be mixed together to yield white light. For example, colours on segment
CD are complementary to the colours on segment CB.

4.8 Dominant wavelength


The spectral colour which can be mixed with white light in order to reproduce the desired
colour. Colour B in the above figure is the dominant wavelength for colour A.

4.9 non-spectral colours


Colours not having a dominant wavelength. For example, colour E in the above figure.
perceptually uniform colour space.
A colour space in which the distance between two colours is always proportional to the
perceived distance. The CIE XYZ colour space and the CIE chromaticity diagram are not
perceptually uniform, as the following figure illustrates. The CIE LUV colour space is designed
with perceptual uniformity in mind.
4.10 Colour Gamuts
The chromaticity diagram can be used to compare the "gamuts" of various possible output
devices (i.e., monitors and printers). Note that a colour printer cannot reproduce all the
colours visible on a colour monitor.

4.11 The RGB Colour Cube


The additive colour model used for computer graphics is represented by the RGB colour
cube, where R, G, and B represent the colours produced by red, green and blue phosphours,
respectively.
The colour cube sits within the CIE XYZ colour space as follows.

4.12 Colour Printing


Green paper is green because it reflects green and absorbs other wavelengths. The following
table summarizes the properties of the four primary types of printing ink.

To produce blue, one would mix cyan and magenta inks, as they both reflect blue while each
absorbing one of green and red. Unfortunately, inks also interact in non-linear ways. This
makes the process of converting a given monitor colour to an equivalent printer colour a
challenging problem.
Black ink is used to ensure that a high quality black can always be printed, and is often
referred to as to K. Printers thus use a CMYK colour model.
3.13 Colour Conversion
Monitors are not all manufactured with identical phosphours. To convert from one colour
gamut to another is a relatively simple procedure (with the exception of a few complicating
factors!). Each phosphour colour can be represented by a combination of the CIE XYZ
primaries, yielding the following transformation from RGB to CIE XYZ:

The transformation yields the colour on monitor 2 which is equivalent to a given


colour on monitor 1. Quality conversion to-andfrom printer gamuts is difficult. A first
approximation is shown on the left. A fourth colour, K, can be used to replace equal
amounts of CMY, as shown on the right.

4.13 Other Colour Systems


Several other colour models also exist. Models such as HSV (hue, saturation, value) and HLS
(hue, luminosity, saturation) are designed for intuitive understanding. Using these colour
models, the user of a paint program would quickly be able to select a desired colour.

5.0 Conclusion
Colour is one of the most important features in a visual presentation. The perceived colour
of an object is influenced by the colour of the surroundings referred to as colour interaction,
colour induction, or colour assimilation.
6.0 Summary
Color is an immensely complex subject, one that draws on concepts and results from physics,
physiology, psychology, art, and graphic design. Perceived color depends on:
• Object color
• Color of lights illuminating the object
• Color of surrounding objects
• Human visual system
• Object’s absorptive, reflective, emissive, and transmissive properties

6.0 Tutor Assignment


1. Draw the RGB color cube, labeling the corners of the cube and the color axes. Also
show where gray colors appear in the cube.
2. Draw the CMY color cube, labeling the corners of the cube and the color axes. Also
show where gray colors appear in the cube.
3. Draw a sample spectra for Blue Light.
4. Show that if the wavelength of the hue is the same as the strength of the white light,
then the purity is 0.
4. What is the meaning of the pre-multiplied (R, G, B, A) tuple (0.0, 0.25, 0.25, 0.5)?
5. Representing colors as pre-multiplied (R, G, B, A) tuples, what color do we get if we
composite (0.0, 0.25, 0.25, 0.5) OVER (1.0, 0.0, 1.0, 1.0)?
Unit 5: IMAGE REPRESENTATION

Table of Contents
1.0 Introduction
2.0 Objectives
3.0 The Digital Image
3.1 Raster Image Representation
3.2 Hardware Frame Buffers
4.0 Conclusion
5.0 Summary
6.0 Tutor Marked Assignment

1.0 Introduction:
Computer Graphics is principally concerned with the generation of images, with wide
ranging applications from entertainment to scientific visualization. In this unit, we begin our
exploration of Computer Graphics by introducing the fundamental data structures used to
represent images on modern computers. We describe the various formats for storing and
working with image data, and for representing colour on modern machines.

2.0 Objectives:
The main objective is to study how digital images are represented in a computer. This unit
also explores different forms of frame-buffer for storing images, and also different ways of
representing colour and key issues that arise in colour.
3.0 The Digital Image
Virtually all computing devices in use today are digital; data is represented in a discrete form
using patterns of binary digits (bits) that can encode numbers within finite ranges and with
limited precision. By contrast, the images we perceive in our environment are analogue.
They are formed by complex interactions between light and physical objects, resulting in
continuous variations in light wavelength and intensity. Some of this light is reflected in to
the retina of the eye, where cells convert light into nerve impulses that we interpret as a
visual stimulus. Suppose we wish to ‘capture’ an image and represent it on a computer e.g.
with a scanner or camera (the machine equivalent of an eye). Since we do not have infinite
storage (bits), it follows that we must convert that analogue signal into a more limited digital
form. We call this conversion process sampling. Sampling theory is an important part of
Computer Graphics, underpinning the theory behind both image capture and manipulation.

3.1 Raster Image Representation


The Computer Graphics solution to the problem of image representation is to break the
image (picture) up into a regular grid that we call a ‘raster’. Each grid cell is a ‘picture cell’, a
term often contracted to pixel.

Rasters are used to represent digital images. Modern displays use a rectangular raster,
comprised of W × H pixels. The raster illustrated here contains a greyscale image; its contents
are represented in memory by a greyscale frame buffer. The values stored in the frame buffer
record the intensities of the pixels on a discrete scale (0=black, 255=white).

The pixel is the atomic unit of the image; it is coloured uniformly, its single colour represents
a discrete sample of light e.g. from a captured image.

In most implementations, rasters take the form of a rectilinear grid often containing many
thousands of pixels. The raster provides an orthogonal two-dimensional basis with which to
specify pixel coordinates. By convention, pixels coordinates are zero-indexed and so the
origin is located at the top-left of the image. Therefore pixel (W − 1, H − 1) is located at the
bottom-right corner of a raster of width W pixels and height H pixels. As a note, some
Graphics applications make use of hexagonal pixels instead 1, however we will not consider
these on the course.
The number of pixels in an image is referred to as the image’s resolution. Modern desktop
displays are capable of visualizing images with resolutions around 1024 × 768 pixels (i.e. a
million pixels or one mega-pixel). Even inexpensive modern cameras and scanners are now
capable of capturing images at resolutions of several mega-pixels. In general, the greater the
resolution, the greater the level of spatial detail an image can represent.

3.2 Hardware Frame


Buffers We represent an image by storing values for the colour of each pixel in a structured
way. Since the earliest computer Visual Display Units (VDUs) of the 1960s, it has become
common practice to reserve a large, contiguous block of memory specifically to manipulate
the image currently shown on the computer’s display. This piece of memory is referred to as
a frame buffer. By reading or writing to this region of memory, we can read or write the
colour values of pixels at particular positions on the display.

Note that the term ‘frame buffer’ as originally defined, strictly refers to the area of memory
reserved for direct manipulation of the currently displayed image. In the early days of
Graphics, special hardware was needed to store enough data to represent just that single
image. However we may now manipulate hundreds of images in memory simultaneously
and the term ‘frame buffer’ has fallen into informal use to describe any piece of storage that
represents an image.

There are a number of popular formats (i.e. ways of encoding pixels) within a frame buffer.
This is partly because each format has its own advantages, and partly for reasons of
backward compatibility with older systems (especially on the PC). Often video hardware can
be switched between different video modes, each of which encodes the frame bufferin a
different way. We will describe three common frame buffer formats in the subsequent
sections; the greyscale, pseudo-colour, and true-colour formats. If you do Graphics, Vision or
mainstream Windows GUI programming then you will likely encounter all three in your work
at some stage.

3.2.1 Greyscale Frame Buffer


Arguably the simplest form of frame buffer is the greyscale frame buffer; often mistakenly
called ‘black and white’ or ‘monochrome’ frame buffers. Greyscale buffers encodes pixels
using various shades of grey. In common implementations, pixels are encoded as an
unsigned integer using 8 bits (1 byte) and so can represent 28 = 256 different shades of grey.
Usually black is represented by value 0, and white by value 255. A mid-intensity grey pixel
has value 128. Consequently an image of width W pixels and height H pixels requires W ×H
bytes of memory for its frame buffer.

The frame buffer is arranged so that the first byte of memory corresponds to the pixel at
coordinates (0, 0). Recall that this is the topleft corner of the image. Addressing then
proceeds in a left-right, then top-down manner (see Figure). So, the value (grey level) of
pixel (1, 0) is stored in the second byte of memory, pixel (0, 1) is stored in the (W + 1)th byte,
and so on. Pixel (x, y) would be stored at buffer offset A where:
A = x +Wy (2.1) i.e. A bytes from the start of the frame buffer. Sometimes we use the term
scan line to refer to a full row of pixels. A scan-line is therefore W pixels wide. Old machines,
such as the ZX Spectrum, required more CPU time to iterate through each location in the
frame buffer than it took for the video hardware to refresh the screen. In an animation, this
would cause undesirable flicker due to partially drawn frames. To compensate, byte range
*0, (W − 1)+ in the buffer wrote to the first scan-line, as usual. However bytes *2W, (3W −1)+
wrote to a scan-line one third of the way down the display, and *3W, (4W −1)+ to a scan-line
two thirds down. This interleaving did complicate Graphics programming, but prevented
visual artifacts that would otherwise occur due to slow memory access speeds.

3.2.3 Pseudo-colour Frame Buffer


The pseudo-colour frame buffer allows representation of colour images. The storage scheme
is identical to the greyscale frame buffer. However the pixel values do not represent shades
of grey. Instead each possible value (0 − 255) represents a particular colour; more
specifically, an index into a list of 256 different colours maintained by the video hardware.

The colours themselves are stored in a “Colour Lookup Table” (CLUT) which is essentially a
map < colourindex, colour > i.e. a table indexed with an integer key (0−255) storing a value
that represents colour. In alternative terminology the CLUT is sometimes called a palette. As
wewill discuss in greater detail shortly, many common colours can be produced by adding
together (mixing) varying quantities of Red, Green and Blue light.
For example, Red and Green light mix to produce Yellow light. Therefore the value stored in
the CLUT for each colour is a triple (R, G,B) denoting the quantity (intensity) of Red, Green
and Blue light in the mix. Each element of the triple is 8 bit i.e. has range (0 − 255) in
common implementations.

The earliest colour displays employed pseudo-colour frame buffers. This is because memory
was expensive and colour images could be represented at identical cost to grayscale images
(plus a small storage overhead for the CLUT). The obvious disadvantage of a pseudocolour
frame buffer is that only a limited number of colours may be displayed at any one time (i.e.
256 colours). However the colour range (we say gamut) of the display is 28 × 28 × 28 = 224 =
16, 777, 216 colours. Pseudo-colour frame buffers can still be found in many common
platforms e.g. both MS and X Windows (for convenience, backward compatibility etc.) and in
resource constrained computing domains (e.g. low-spec games consoles, mobiles). Some
low-budget (in terms of CPU cycles) animation effects can be produced using pseudo-colour
frame buffers. Consider an image filled with an expanses of colour index 1 (we might set
CLUT < 1,Blue >, to create a blue ocean). We could sprinkle consecutive runs of pixels with
index ‘2,3,4,5’ sporadically throughout the image. The CLUT could be set to increasing,
lighter shades of Blue at those indices. This might give the appearance of waves. The colour
values in the CLUT at indices 2,3,4,5 could be rotated successively, so changing the displayed
colours and causing the waves to animate/ripple (but without the CPU overhead of writing
to multiple locations in the frame buffer). Effects like this were regularly used in many ’80s
and early ’90s computer games, where computational expense prohibited updating the
frame buffer directly for incidental animations.

3.2.5 True-Colour Frame Buffer


The true-colour frame-buffer also represents colour images, but does not use a CLUT. The
RGB colour value for each pixel is stored directly within the frame buffer. So, if we use 8 bits
to represent each Red, Green and Blue component, we will require 24 bits (3 bytes) of
storage per pixel. As with the other types of frame buffer, pixels are stored in left-right, then
top-bottom order. So in our 24 bit colour example, pixel (0, 0) would be stored at buffer
locations 0, 1 and 2.Pixel (1, 0) at 3, 4, and 5; and so on. Pixel (x, y) would be stored at offset
A where:
S = 3W
A = 3x + Sy where S is sometimes referred to as the stride of the display.
The advantages of the true-colour buffer complement the disadvantages of the pseudo-
colour buffer We can represent all 16 million colours atonce in an image (given a large
enough image!), but our image takes 3 times as much storage as the pseudo-colour buffer.
The image would also take longer to update (3 times as many memory writes) which should
be taken under consideration on resource constrained platforms (e.g. if writing a video
codec on a mobile phone).

3.2.6 Alternative forms of true-colour buffer


The true colour buffer, as described, uses 24 bits to represent RGB colour. The usual
convention is to write the R, G, and B values in order for each pixel. Sometime image
formats (e.g. Windows Bitmap) write colours in order B, G, R. This is primarily due to the
little-endian hardware architecture of PCs, which run Windows. These formats are
sometimes referred to as RGB888 or BGR888 respectively.

4.0 Conclusion
Image generation remains an integral part of computer graphics hence how these digital
images are represented in a computer cannot be overemphasized in this subject area.

5.0 Summary
In this unit, we have learnt
v. What digital image is.
vi. The concept of Raster Image Representation
vii. About the three common frame buffer format

6.0 Tutor Marked Assignment


1. Distinguish between hardware frame buffer and Greyscale frame buffer.
2. Describe briefly using relevant diagrams the forms of frame buffers.

You might also like