Lect 3
Lect 3
Lect 3
(Lecture 3)
4) Raster Images
Such an image is a 2-dimensional array of pixels.
Such images are sometimes called pixel maps.
For gray-scale (or monochrome) raster images, each pixel is
represented by assigning it a numerical value over some range (e.g.,
from 0(black) to 255(white).
4) Raster Images
Graphics Display Systems
Vector display Raster scan display
Ideal Vector
Drawing Drawing Outline Filled
Graphics Display Systems
Vector display Raster scan display
Graphics
System/
Application Graphics GPU
Application
Library
Model / database program
Graphics Library
Examples: OpenGL™, DirectX™, Windows Presentation
Foundation™ (WPF) accessed via XAML, RenderMan™,
HTML5 + WebGL™
Primitives (characters, lines, polygons, meshes,…)
Attributes
Color, line style, material properties for 3D
Lights
Transformations
Immediate mode vs. retained mode
Graphics Library
immediate mode: no stored
representation, package holds
only attribute state, and
application must completely
draw each frame
Visualization of a
mathematical pixel grid LCD display
3D scene
A color value is measured at every grid point and used to color corresponding
grid square 0 = white, 5 = gray, 10 = black
Head
Shaft
Point
composition decomposition
Hierarchical (Tree) Diagram of Nail
Tree diagram provides visual method of expressing “composed of”
relationships of model
+Y +Y
Polygons
+Z +Z +X
+X
3D Object Definition
Convex and concave polygons:
Convex: Line between any two points is inside polygon
Concave: At least one line between two points crosses outside polygon
convex concave
3D Object Definition
Special Polygons:
Circles: (x, y)
(0, y)
Set of all points equidistant r
from one point called the center
(0, 0) (x, 0)
The distance from the center
is the radius r
3D Object Definition
A circle can be approximated by a polygon with many sides.
0 0
1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10
Scaled by a factor of 2 in the x direction (the width of circle) and not scaled in the y
direction. Width changes from 2.5 to 5.
Representing Shapes
We specify objects as a set of vertices and associated attributes. This
information can be stored in tables, of which there are two types:
geometric tables and attribute tables.
The geometry tables can be stored as three tables:
A vertex table: each entry in the vertex table is a list of coordinates
defining that point (v1: x1, y1, z1).
An edge table: each entry in the edge table consists of a pointer to each
endpoint of that edge (E1: v1, v2).
A polygon table: the entries in the polygon table define a polygon by
providing pointers to the edges that make up the polygon (S1: E1, E2, and
E3).
Representing Shapes
We can eliminate the edge table by letting the polygon table reference
the vertices directly, but we can run into problems, such as:
Drawing some edges twice, because we don't realize that we have visited the
same set of points before, in a different polygon.
Waste space because the same points appear in the polygon table several
times.
Using all three tables allows for certain kinds of error checking:
We can confirm that each polygon is closed
Each point in the vertex table is used in the edge table
Each edge is used in the polygon table.
Representing Shapes
Tables also allow us to store additional information:
Each entry in the edge table could have a pointer back to the polygons that
make use of it. This would allow for quick look-up of those edges which are
shared between polygons.
We could also store the slope of each edge or the bounding box for each
polygon (values which are repeatedly used in rendering)
Representing Shapes
Representing Shapes
Representing Shapes