Computer Graphics
Computer Graphics
Topics:
Chapter 1 of Angel.
1
Applications of computer graphics
Computer Graphics: all aspects of producing pictures or images using a
computer.
1. Display
2
2. Design (interaction important)
3. Simulation
4. User interfaces
3
A Graphics System
1. Processor
2. Memory
3. Frame buffer
4. Output devices
5. Input devices
Processor Frame
buffer
Memory
4
Pixels and the Frame Buffer
5
Output devices
• interlaced: odd and even rows are refreshed alternately, used in tele-
vision. For example, at 60 Hz, the screen is redrawn only 30 times per
sec.
y deflect
Focus
6
What is an image?
7
Ray tracing
Trace rays from each light source and see whether they reach the viewer.
Those rays that do form the image. We could do ray tracing in computer
graphics but it is computationally extremely expensive. In practice we
avoid ray-tracing by simplifying our models, for example by assuming all
objects are equally bright (i.e. there are light sources everywhere). Then
each object (e.g. triangle) looks like a light emitter. It is possible to add
light sources and material properties and still avoid ray-tracing.
B
F
C
E
D
8
The pinhole camera:
(x, y, z)
z
(xp, yp, zp )
a box with a small hole in the centre of one side with the film placed at
the other end. It is easy to model geometrically. Orient the camera along
the z axis with the pinhole at the origin. Suppose the camera has length d.
Assuming the pinhole allows only one ray of light from any point (x, y, z),
the ray is clearly projected to the point (xp , yp , −d), with coordinates
−dx −dy
xp = , yp = .
z z
9
The field or angle of view of the pinhole camera is the angle of the largest
object that is fully visible on the film plane. If h is the height of the camera
and θ the angle of view then
h
θ = 2 tan−1 .
2d
h z
The pinhole camera has an infinite depth of field: every point in the
field of view is in focus.
The pinhole camera has two disadvantages: (1) too little light gets in,
and (2) the angle of view cannot be adjusted.
More sophisticated cameras replace the pinhole with a lens. The lens
allows more light to enter and different lenses give different angles of view
(c.f. a ‘wide angle lens’). Lenses, however, do not have an infinite depth of
field; not all distances are in focus.
Like the pinhole camera, computer graphics produces images in which
all objects are in focus.
10
The synthetic camera model
In computer graphics we use a synthetic camera model to mimic the
behaviour of a real camera. The image in a pinhole camera is inverted. The
film plane is behind the lens.
y y
Camera (y, z ) (y, z)
(yp, d )
Object
z z
(yp, -d)
(a) (b)
11
The clipping rectangle or clipping window determines the size of
the image.
(a) (b)
h z
12
Application Programmer’s Interface (API)
We need to specify:
1. Objects
2. Viewer
3. Lights
4. Material properties
13
The Modelling-Rendering Paradigm
Modelling is very interactive but user does not need to see all the detail.
Pixar’s Renderman provides an interface (i.e. file format) between the two
tasks.
Interface file
Modeler Renderer
14
The Geometric Pipeline
1. Transformation
2. Clipping
3. Projection
4. Rasterization
15