Survey in Computer GraphicsComputer Graphics and Visualization
Fall 2010
Pedher JohanssonDepartment of Computer Science
2
Example of a Marble Ball
I Where did this image come from?
I What hardware/software/algorithms did we need toproduce it?
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
3
A Basic Graphics System
I Input devicesI Image formed in FBI Output device
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
4
History of Computer Graphics1200-2008
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
5
HISTORY
Before 1960
1200 Chinese Abacus1450 Gutenberg1826 Photography (Niepce)1842 FAX (Alexander Bain)1885 CRT1888 Record Motion pic. on vax cylinder (Edison,
Dickson)1926 First television (J.L. Baird)1946 ENIAC Computer1954 Fortran1958 Integrated circuit (IC, or Chip)
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
6
HISTORY
Alexander Bain’s Fax Machine
Bain’s fax machine used a detector toscan an image. As the detector passedover the page it emitted an electricalsignal which registered at one strengthas it passed through the image’s blackpoints and at a different strength as itpassed over white points. The twodistinct signals were transmitted overtelegraph wires to a receiver whichapplied them to chemically treated paperto reproduce the image.
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
7
HISTORY
CRT
Can be used asI line-drawing device (calligraphic) or toI display contents of frame buffer (raster mode).
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
8
HISTORY
1960-1969
1961 Spacewars, 1st Videogame1963 DEC-1 First comersial CAD system1963-1969 Hidden line, Warnock, Watkins alg.,
lineclippng1969 UNIX developed1969 GUI developed by Xerox (Alan Kay)
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
9
HISTORY
Spacewars
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
10
HISTORY
1960-1969
I Wireframe graphicsI Draw only linesI Display ProcessorsI Storage tube
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
11
HISTORY
Display Processor
I Rather than have the host computer try to refreshdisplay use a special purpose computer called adisplay processor (DPU)
I Graphics stored in display list (display file) on displayprocessor
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
12
HISTORY
1970-1979
1972 Atari founded1973,1975 z-buffer, phong
shading1975 Microsoft founded1976 Apple founded1977 Death Star simula-
tion for Star Wars
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
13
HISTORY
1970-1979
I Raster GraphicsI Beginning of graphics standardsI Workstations and PCs
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
14
HISTORY
Raster Graphics
I Image produced as an array(the raster) of pictureelements (pixels) in the framebuffer
I Allows us to go from linesand wire frame images tofilled polygons
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
15
HISTORY
1980-1989
1980 Donkey Kong introduced by Nintendo1980 Hanna-Barbera, comp. automation of
anim. process1982 Silicon Graphics Inc, Sun microsystems,
Adobe1984 Macintosh1985 Pixar Image Computer goes to market1986-1987 TIFF, GIF1987 VGA1988 Willow (Lucasfilm) morphing,
Who Framed Roger Rabbit1989 Photoshop
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
16
HISTORY
1980-1989
I Realism comes to computer graphics
Smooth Shading EnvironmentMapping
Bump Mapping
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
17
HISTORY
1991-1999
1991 World Wide Web(CERN)
1991 Terminator 21991 JPEG/MPEG1992 OpenGL1993 Doom, Myst1994 Linux 1.01995 Toy Story1995 Java1996 Quake1998 MPEG-4
1991: February (premiere)issue of DV magazine advises
"[to be able to do digital video,get] the most souped upsystem you can get your handson. A fast processor (68040 onAmiga or Mac, 80486 on PC)and lots of RAM (8-64 MB) arein order. So is a large harddrive (200 MB - 1 GB) if youwant to take on seriousproduction."
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
18
HISTORY
1991-1999
I OpenGL APII Completely computer-generated feature-length
movies (Toy Story) are successfulI New hardware capabilities
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
19
HISTORY
2000-
I PhotorealismI Graphics cards for PCs dominate market Nvidia, ATII Game boxes and game players determine direction
of marketI Computer graphics routine in movie industry: Maya,
LightwaveI Programmable pipelinesI 3-D reenters animations
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
20
Image Formation
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
21
IMAGE FORMATION
Image Formation
I In computer graphics, we form images which aregenerally two dimensional using a processanalogous to how images are formed by physicalimaging systems
– Cameras– Microscopes– Telescopes– Human visual system
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
22
IMAGE FORMATION
Elements of Image Formation
I ObjectsI ViewerI Light source(s)
I Attributes that govern how light interacts with thematerials in the scene
I Note the independence of the objects, the viewer,and the light source(s)
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
23
IMAGE FORMATION
Light
I Light is the part of the electromagnetic spectrum thatcauses a reaction in our visual systems
I Generally these are wavelengths in the range ofabout 350-750 nm (nanometers)
I Long wavelengths appear as reds and shortwavelengths as blues
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
24
IMAGE FORMATION
Luminance and Color Images
I Luminance Image– Monochromatic– Values are gray levels– Analogous to working with black and white film or
television
I Color Image– Has perceptional attributes of hue, saturation, and
lightness– Do we have to match every frequency in visible
spectrum? No!
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
25
IMAGE FORMATION
Three-Color Theory
I Human visual system has two types of sensorsRods: Monochromatic, night vision
Cones: Color sensitiveI Three types of conesI Only three values (the tristimulus values) are sent to
the brainI Need only three primary colors
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
26
IMAGE FORMATION
Additive and Subtractive Color
Additive color Form a color by adding amounts ofthree primaries
I LCDs, projection systems, positivefilm
I Primaries are Red (R), Green (G),Blue (B)
Subtractive color Form a color by filtering white light withcCyan (C), Magenta (M), and Yellow(Y) filters
I Light-material interactionsI PrintingI Negative film
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
27
IMAGE FORMATION
Synthetic Camera Model
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
28
IMAGE FORMATION
Pinhole Camera
I Use trigonometry to find projection of point at(x ,y ,z)
xp =− xy/d yp =− y
x/d z = d
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
29
IMAGE FORMATION
Advantages
I Separation of objects, viewer, light sourcesI Two-dimensional graphics is a special case of
three-dimensional graphicsI Leads to simple software API
– Specify objects, lights, camera, attributes– Let implementation determine image
I Leads to fast hardware implementation
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
30
IMAGE FORMATION
Global vs Local Lighting
I In Local Lighting we compute color or shade of eachobject independently
I But!– Some objects are blocked from light.– Light can reflect from object to object.– Some objects might be translucent.
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
31
IMAGE FORMATION
Pipeline Architecture
I Process objects one at a time in the order they aregenerated by the application
I All steps can be implemented in hardware on thegraphics card
Vertices Vertex Processor
Rasterizer Fragment Processor
PixelsClipper andPrimitive Assambler
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
32
IMAGE FORMATION
Vertex Processing
I Much of the work in the pipeline is in convertingobject representations from one coordinate systemto another
– Object coordinates– Camera (eye) coordinates– Screen coordinates
I Every change of coordinates is equivalent to amatrix transformation
I Vertex processor also computes vertex colors
Vertices Vertex Processor
Rasterizer Fragment Processor
PixelsClipper andPrimitive Assambler
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
33
IMAGE FORMATION
Clipping and Primitive Assembly
I Vertices must becollected into geometricobjects before clippingand rasterization cantake place
I Objects that are notwithin this volume areclipped out of the scene
Vertices Vertex Processor
Rasterizer Fragment Processor
PixelsClipper andPrimitive Assambler
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
34
IMAGE FORMATION
Rasterization
I If an object is not clipped out, the appropriate pixelsin the frame buffer must be assigned colors
I Rasterizer produces a set of fragments for eachobject
I Fragments are ”potential pixel”– Have a location in frame buffer– Color and depth attributes
I Vertex attributes are interpolated over objects by therasterizer
Vertices Vertex Processor
Rasterizer Fragment Processor
PixelsClipper andPrimitive Assambler
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
35
IMAGE FORMATION
Fragment Processing
I Fragments are processed to determine the color ofthe corresponding pixel in the frame buffer
I Colors can be determined by texture mapping orinterpolation of vertex colors
I Fragments may be blocked by other fragmentscloser to the camera (Hidden-surface removal)
Vertices Vertex Processor
Rasterizer Fragment Processor
PixelsClipper andPrimitive Assambler
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science
36
IMAGE FORMATION
The Programmer’s Interface
I Objects– Points (0D)– Line segments (1D)– Polygons (2D)– Some curves and
surfaces– All are defined
through locations inspace or vertices
I Viewer (Camera)
I Light Source(s)– Point sources vs
distributed sources– Spot lights– Near and far
sources– Color properties
I Materials– Color properties– Diffuse or specular
Survey in Computer Graphics Pedher JohanssonComputer Graphics and Visualization Department of Computer Science