Fundamentals of Computer Graphics
Fundamentals of Computer Graphics
Part 1
Fundamentals of Computer Graphics 2
Graphics Systems
Five major elements - processor, memory,
frame buffer, output devices, input devices
Fundamentals of Computer Graphics 3
Pixels and Frame Buffer
Most graphics systems are pixel based need of rasterization or
scan conversion; pixel = picture element
8 bits deep frame 256 colors; 24 or 32 bits for RGB colors
picture detail
Fundamentals of Computer Graphics 4
Output Devices
The cathode-ray tube CRT
Fundamentals of Computer Graphics 5
Output Devices
RGB shadow mask
Fundamentals of Computer Graphics 6
Output Devices
Refresh rate: 50 85 Hz, for stereovision 120Hz (2 x60 Hz)
Mode: interlaced versus non-interlaced
Masks: DELTA versus INLINE
LCD Displays raster based
Raster devices
sequential access - plotters etc.
direct access displays etc.
mixed inkjet printers printed sequentially, accessed directly
Fundamentals of Computer Graphics 7
Fundamentals of Computer Graphics
Images Physical versus Synthetic
Computer graphics generates pictures with the aim of:
to create realistic images
to create images very close to traditional imaging methods such
as cameras and the human visual system.
Computer generated images are synthetic or artificial.
Fundamentals of Computer Graphics 8
Objects and Viewers
Two basic entities (one object seen from two different positions) :
object(s) exists in space independent of any image-formation process
or viewer
viewer(s)
Fundamentals of Computer Graphics 9
Objects, Viewers & Camera
Camera system
object and viewer exist in 3D
world.
image is formed
in the Human Visual system
(HSV) on the retina
In the film plane if a camera
is used
Object(s) & Viewer(s) in 3D
Pictures in 2D
Transformation from 3D to 2D
projection
Fundamentals of Computer Graphics 10
Lights & Images
Others attributes:
light sources
position
monochromatic / color
if not used scene would be
very dark and flat
shadows and reflections - very
important for realistic
perception
geometric optics used for light
modeling
Fundamentals of Computer Graphics 11
Colours
Light is a form of
electromagnetic radiation
Visible spectrum 350 780 nm
Fundamentals of Computer Graphics 12
Ray Tracing
Ray tracing
building an imaging model by
following light from a source
a ray is a semi-infinite line
that emanates from a point
and travels to infinity in a
particular direction
portion of these infinite rays
contributes to the image on
the film plane of the camera
surfaces:
diffusing
reflecting
refracting
Fundamentals of Computer Graphics 13
Ray Tracing
A different approach must be used:
for each pixel intensity must be
computed
all contributions must be taken
into account
a ray is followed in the
opposite direction, when
intersect a surface it is split into
two rays
contribution from light sources
and reflection from other
resources are counted
Fundamentals of Computer Graphics 14
Human Visual System - HVS
rods and cones - excited by electromagnetic energy in the range
350-780 nm
sizes of rods and cones , combined with optical properties of the
lens and cornea - determines the resolution of HVS our visual
acuity
the sensors in the human eye do not react uniformly to the light
energy at different wavelengths
Fundamentals of Computer Graphics 15
Human Visual System - HVS
Courtesy of http://www.webvision.med.utah.edu/into.html
Fundamentals of Computer Graphics 16
Human Visual System
different HVS response for single
frequency light red/green/blue
relative brightness response at
different frequencies
this curve is known as
Commision Internationale de
LEclairage (CIE) standard
observer curve
the curve matches the sensitivity
of the monochromatic sensors used in
black&white films and video camera
most sensitive to GREEN colors
Fundamentals of Computer Graphics 17
Human Visual System
three different cones in HVS
blue, green & yellow often
reported as red for compatibility
with camera & film
Fundamentals of Computer Graphics 18
Pinhole Camera
Box with a small hole
film plane z = - d
d
z
y
y
p
=
d
z
x
x
p
=
!!!yp,-d
Fundamentals of Computer Graphics 19
Pinhole Camera
point (x
p
,y
p
,-d)
projection of the
point (x,y,z)
angle of view or field
of the camera
angle O
ideal camera
infinite depth of
field
d
h
2
arctan 2 = u
Fundamentals of Computer Graphics 20
Synthetic Camera Model
Computer-generated image based
on an optical system
Synthetic Camera Model
Viewer behind the camera can
move the back of the camera
change of the distance d
i.e. additional flexibility
objects and viewer specifications
are independent different
functions within a graphics
library
Imaging system
Fundamentals of Computer Graphics 21
Synthetic Camera Model
a situation with a camera ( Image of the object is flipped)
b mathematical model image plane moved in front of the camera
center of projection center of the lens
projection plane film plane
Fundamentals of Computer Graphics 22
Synthetic Camera Model
Imaging with the Synthetic Camera Model
The image of a point on the object, is
found on the virtual image plane, by
drawing a line, called a projector ( from
the point to the centre of lens or the
Centre of Projection (COP))
Projectors are light emanating from
COP
film plane position in a camera
projected scene to the projection plane(
the virtual image plane in front of lens)
Fundamentals of Computer Graphics 23
Synthetic Camera Model
Not all objects can be seen
limit due to viewing angle
Solution:
Clipping rectangle or clipping
window ( in projection plane)
placed in front of the camera
( a) & (b) shows the case when the
clipping rectangle is shifted aside
only part of the the scene is
projected
Given the locn of COP, the locn &
orientation of the projection plane,
and the size of the clipping
rectangle can determine which
objects appear in the image.
Fundamentals of Computer Graphics 24
Programmers Interface
Numerous ways for user
interaction with a graphics
system using input devices -
pads, mouse, keyboards etc.
E.g: CAD community, Painting
program
The interface between an
application program and the
graphics system
- is specified through a set of
functions that resides in a
graphics library. These are
called application
programmers interface (API)
different orientation of
coordinate systems
canvas versus OpenGL etc.
Fundamentals of Computer Graphics 25
Application Programmers Interface
Fig shows the application
programmers model of the
system.
API functionality should match
the conceptual model
Synthetic Camera Model used
for APIs like
OpenGL, PHIGS, Direct 3D,
Java3D, VRML etc.
Functionality needed in the
API to specify:
Objects
Viewers
Light sources
Material properties
Fundamentals of Computer Graphics 26
Pen Plotter Model
Two basic functions for drawing:
moveto(x , y) pen up
lineto(x , y) pen down
moveto (0,0);
lineto(1,0);lineto(1,1);lineto(0,1);lineto(0,0);
{ draws a rectangle }
moveto(0,1);
lineto(0.5,1.866); lineto(1.5,1.866);
lineto(1.5,0.866);
lineto(1,0);moveto(0,0);
lineto(1.5,1.866);
{ draws a cube using oblique projection }
Typical example of sequential
access
Fundamentals of Computer Graphics 27
Pen Plotter Model
This approach is used for printing industry
PostScript page description
HPGL language
control of printers, typesetters etc.
restriction to 2D world only. BUT our interest is 3D API
drawing area (pad) infinite 2D area correspond to z = 0
a point p = (x,y) the plane is represented as p = (x,y,0) in
3D
often term vertex is used instead of point
a vertex is a location in the space
(
(
(
=
z
y
x
p
Fundamentals of Computer Graphics 28
Application Programmers Interface
Objects are defined by
points or vertices, line
segments, polygons etc. to
represent complex objects
API primitives are
displayed rapidly on the
hardware
usual API primitives:
points
line segments
polygons
text
Fundamentals of Computer Graphics 29
Application Programmers Interface
OpenGL defines primitives through list of vertices triangular
polygon is drawn by:
glBegin(GL_POLYGON);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(0.0, 1.0, 0.0);
glVertex3f(0.0, 0.0, 1.0);
glEnd( );
attribute GL_POLYGON actually defines the primitive to be
drawn others
GL_LINE_STRIP - draws a strip
n+1 points define n triangles
GL_POINTS draws only points
Fundamentals of Computer Graphics 30
Application Programmers Interface
Some APIs :
work with frame buffer read/write pixel level
provides curves & surfaces / approximated by a
series of simpler primitives
OpenGL provides access to frame buffer, curves and
surfaces
Fundamentals of Computer Graphics 31
Application Programmers Interface
Camera specification in APIs:
position usually center of lens
(COP)
orientation camera coordinate
system with its origin at center of lens
(COP) . camera can rotated around
those three axes
focal length of lens determines the size
of the image on the film
actually viewing angle
film plane the back of the camera has
a height and a width
In some APIs, the orientation of the
back of the camera can be adjusted
independently of the orientation of the
lens.
Fundamentals of Computer Graphics 32
Application Programmers Interface
Two coordinate systems are used:
world coordinates, where the object is defined
camera coordinates, where the image is to be produced
Transformation for conversion between coordinate systems or
gluLookAt(cam_x, cam_y,cam_z, look_at_x, look_at_y, look_at_z,)
glPerspective( field_of_view)
Lights sources defined by location, strength, color, directionality. APIs
provide a set of functions to specify these parameters
Material properties - are attributes of objects and are specified through a
series of function calls at the time of defining the objects.
Observed visual properties of objects are given by material and light properties
Fundamentals of Computer Graphics 33
Modeling - Rendering Paradigm
In many applications the modeling is separated from production of an image
rendering (CAD systems, animations etc.)
In this case the modeling SW/HW might be different from the renderer
the connection between both parts can be simple or highly complex using
distributed environments
Popular method for generating computer games and images over Internet
Models ( including the geometric objects, lights, cameras and material
properties) , are placed in a data structure called a scene graph that is passed
to a renderer or a game engine.
Fundamentals of Computer Graphics 34
Graphics Architectures
Early graphics systems CRT had just basic capability to
generate line segments connecting two points
vector based with refreshing length of line segments limited
light pen often used for manipulation
systems with memory CRT the whole picture redrawn if
changed
Fundamentals of Computer Graphics 35
Graphics Architectures
Display processors
standard architecture with capabilities to display primitives
composition made at the host
memory display list contains primitives to be displayed.
Fundamentals of Computer Graphics 36
Pipeline Architectures
VLSI circuits enabled major advances in graphics architectures
- simple arithmetic pipeline a + b * c
- when addition of (b * c) and a is performing new b * c is
computed in parallel pipelining enabled significant speed up
- similar approach can be used for processing of geometric
primitives as well
Fundamentals of Computer Graphics 37
Pipeline Architectures
There are 4 major steps in the geometric pipeline:
transformations like scaling, rotations, translation, mirroring,
sheering etc.
clipping removal of those parts that are out of the viewing
field
projection
rasterization
homogeneous coordinates and matrix operations geometric
transformations are used
Fundamentals of Computer Graphics 38
Clipping, Projection & Rasterization
Clipping is used to remove those parts of the world that cannot
be seen.
Objects representation is kept in 3D as long as possible.
After transformation and clipping must be projected to 2D
somehow
projected objects or their parts must be displayed and
therefore rasterized.
All those steps are performed on your graphics cards in haerware
nowadays.
Fundamentals of Computer Graphics 39
Consider a standard camera with 36x24 mm film and having a
zoom 26 140mm. How the viewing angle or viewing field is
defined.
what is the difference in viewing between cases a) and b)?
answer question from Chapter 1
Conclusion