Title: CS 445: Introduction to Computer Graphics
1Display Technologies, Mathematical Fundamentals
- CS 445 Introduction to Computer Graphics
- David Luebke
- University of Virginia
2Admin
- Call roll
- Introductions Sam Guarnieri
- Office hours
- M 11-12 am
- W 10-11 am
- Assignment 1 out
3Demo
4Mathematical Foundations
- A very brief review of some mathematical tools
well employ - Geometry (2D, 3D)
- Trigonometry
- Vector and affine spaces
- Points, vectors, and coordinates
- Dot and cross products
- Linear transforms and matrices
53D Geometry
- To model, animate, and render 3D scenes, we must
specify - Location
- Displacement from arbitrary locations
- Orientation
- Well look at two types of spaces
- Vector spaces
- Affine spaces
- We will often be sloppy about the distinction
6Vector Spaces
- Given a basis for a vector space
- Each vector in the space is a unique linear
combination of the basis vectors - The coordinates of a vector are the scalars from
this linear combination - Best-known example Cartesian coordinates
- Note that a given vector will have different
coordinates for different bases
7Vectors And Points
- We commonly use vectors to represent
- Direction (i.e., orientation)
- Points in space (i.e., location)
- Displacements from point to point
- But we want points and directions to behave
differently - Ex To translate something means to move it
without changing its orientation - Translation of a point different point
- Translation of a direction same direction
8Affine Spaces
- To be more rigorous, we need an explicit notion
of position - Affine spaces add a third element to vector
spaces points (P, Q, R, ) - Points support these operations
- Point-point subtraction Q - P v
- Result is a vector pointing from P to Q
- Vector-point addition P v Q
- Result is a new point
- P 0 P
- Note that the addition of two points is not
defined
Q
v
P
9Affine Spaces
- Points, like vectors, can be expressed in
coordinates - The definition uses an affine combination
- Net effect is same expressing a point in terms
of a basis - Thus the common practice of representing points
as vectors with coordinates - Be careful to avoid nonsensical operations
- Point point
- Scalar point
10Affine Lines An Aside
- Parametric representation of a line with a
direction vector d and a point P1 on the line - P(a) Porigin ad
- Restricting 0 ? a produces a ray
- Setting d to P - Q and restricting 0 ? a ? 1
produces a line segment between P and Q
11Dot Product
- The dot product or, more generally, inner product
of two vectors is a scalar - v1 v2 x1x2 y1y2 z1z2 (in 3D)
- Useful for many purposes
- Computing the length of a vector length(v)
sqrt(v v) - Normalizing a vector, making it unit-length
- Computing the angle between two vectors
- u v u v cos(?)
- Checking two vectors for orthogonality
- Projecting one vector onto another
12Cross Product
- The cross product or vector product of two
vectors is a vector - Cross product of two vectors is orthogonal to
both - Right-hand rule dictates direction of cross
product - Cross product is handy for finding surface
orientation - Lighting
- Visibility
13Linear Transformations
- A linear transformation
- Maps one vector to another
- Preserves linear combinations
- Thus behavior of linear transformation is
completely determined by what it does to a basis - Turns out any linear transform can be represented
by a matrix
14Matrices
- By convention, matrix element Mrc is located at
row r and column c - By (OpenGL) convention, vectors are columns
15Matrices
- Matrix-vector multiplication applies a linear
transformation to a vector - Recall how to do matrix multiplication
16Matrix Transformations
- A sequence or composition of linear
transformations corresponds to the product of the
corresponding matrices - Note the matrices to the right affect vector
first - Note order of matrices matters!
- The identity matrix I has no effect in
multiplication - Some (not all) matrices have an inverse
173D Scene Representation
- Scene is usually approximated by 3D primitives
- Point
- Line segment
- Polygon
- Polyhedron
- Curved surface
- Solid object
- etc.
183D Point
193D Point
- Specifies a location
- Represented by three coordinates
- Infinitely small
typedef struct Coordinate x Coordinate
y Coordinate z Point
(x,y,z)
203D Vector
- Specifies a direction and a magnitude
213D Vector
- Specifies a direction and a magnitude
- Represented by three coordinates
- Magnitude V sqrt(dx dx dy dy dz dz)
- Has no location
(dx,dy,dz)
typedef struct Coordinate dx Coordinate
dy Coordinate dz Vector
223D Vector
- Specifies a direction and a magnitude
- Represented by three coordinates
- Magnitude V sqrt(dx dx dy dy dz dz)
- Has no location
- Dot product of two 3D vectors
- V1V2 dx1dx2 dy1dy2 dz1dz2
- V1V2 V1 V2 cos(Q)
(dx1,dy1,dz1)
typedef struct Coordinate dx Coordinate
dy Coordinate dz Vector
(dx2,dy2 ,dz2)
Q
233D Line Segment
- Linear path between two points
243D Line Segment
- Use a linear combination of two points
- Parametric representation
- P P1 t (P2 - P1), (0 ? t ? 1)
typedef struct Point P1 Point P2 Segment
P2
P1
253D Ray
- Line segment with one endpoint at infinity
- Parametric representation
- P P1 t V, (0 lt t lt ?)
typedef struct Point P1 Vector V Ray
V
P1
263D Line
- Line segment with both endpoints at infinity
- Parametric representation
- P P1 t V, (-? lt t lt ?)
typedef struct Point P1 Vector V Line
V
P1
273D Plane
- A linear combination of three points
P3
P2
P1
283D Plane
- A linear combination of three points
- Implicit representation
- PN d 0, or
- ax by cz d 0
- N is the plane normal
- Unit-length vector
- Perpendicular to plane
N (a,b,c)
typedef struct Vector N Distance d Plane
P3
P2
P1
d
293D Polygon
- Area inside a sequence of coplanar points
- Triangle
- Quadrilateral
- Convex
- Star-shaped
- Concave
- Self-intersecting
- Holes (use gt 1 polygon struct)
typedef struct Point points int npoints
Polygon
Points are in counter-clockwise order
303D Sphere
- All points at distance r from point (cx, cy,
cz) - Implicit representation
- (x - cx)2 (y - cy)2 (z - cz)2 r 2
- Parametric representation
- x r cos(?) cos(?) cx
- y r cos(?) sin(?) cy
- z r sin(?) cz
typedef struct Point center Distance
radius Sphere
31Display Technologies
- Cathode Ray Tubes (CRTs)
- Most common display device today
- Evacuated glass bottle (lastof the vacuum tubes)
- Heating element (filament)
- Electrons pulled towards anode focusing cylinder
- Vertical and horizontal deflection plates
- Beam strikes phosphor coating on front of tube
32Display Technologies CRTs
- Vector Displays
- My childhood Battlezone, Tempest
33Display Technologies CRTs
- Vector displays
- Early computer displays basically an
oscilloscope - Control X,Y with vertical/horizontal plate
voltage - Often used intensity as Z
- Show http//graphics.lcs.mit.edu/classes/6.837/F9
8/Lecture1/Slide11.html - Name two disadvantages
- Just does wireframe
- Complex scenes ? visible flicker
34Display Technologies CRTs
- Black and white television an oscilloscope with
a fixed scan pattern left to right, top to
bottom - Paint entire screen 30 times/sec
- Actually, TVs paint top-to-bottom 60 times/sec,
alternating between even and odd scanlines - This is called interlacing. Its a hack. Why do
it? - To paint the screen, computer needs to
synchronize with the scanning pattern of raster - Solution special memory to buffer image with
scan-out synchronous to the raster. We call this
the framebuffer.
35Display Technologies CRTs
- Raster Displays
- Raster A rectangular array of points or dots
- Pixel One dot or picture element of the raster
- Scanline A row of pixels
- Rasterize find the set of pixels corresponding
to a 2D shape (line, circle, polygon)
36Display Technologies CRTs
- Raster Displays
- Frame must be refreshed to draw new images
- As new pixels are struck by electron beam, others
are decaying - Electron beam must hit all pixels frequently to
eliminate flicker - Critical fusion frequency
- Typically 60 times/sec
- Varies with intensity, individuals, phosphor
persistence, lighting...
37Display Technology Color CRTs
- Color CRTs are much more complicated
- Requires manufacturing very precise geometry
- Uses a pattern of color phosphors on the screen
- Why red, green, and blue phosphors?
Delta electron gun arrangement
In-line electron gun arrangement
38Display Technology Color CRTs
- Color CRTs have
- Three electron guns
- A metal shadow mask to differentiate the beams
39Display Technology Raster CRTs
- Raster CRT pros
- Allows solids, not just wireframes
- Leverages low-cost CRT technology (i.e., TVs)
- Bright! Display emits light
- Cons
- Requires screen-size memory array
- Discreet sampling (pixels)
- Practical limit on size (call it 40 inches)
- Bulky
- Finicky (convergence, warp, etc)
40CRTs Overview
- CRT technology hasnt changed much in 50 years
- Early television technology
- high resolution
- requires synchronization between video signal and
electron beam vertical sync pulse - Early computer displays
- avoided synchronization using vector algorithm
- flicker and refresh were problematic
41CRTs Overview
- Raster Displays (early 70s)
- like television, scan all pixels in regular
pattern - use frame buffer (video RAM) to eliminate sync
problems - RAM
- ¼ MB (256 KB) cost 2 million in 1971
- Do some math
- 1280 x 1024 screen resolution 1,310,720 pixels
- Monochrome color (binary) requires 160 KB
- High resolution color requires 5.2 MB
42Display Technology LCDs
- Liquid Crystal Displays (LCDs)
- LCDs organic molecules, naturally in crystalline
state, that liquefy when excited by heat or E
field - Crystalline state twists polarized light 90º.
43Display Technology LCDs
- Liquid Crystal Displays (LCDs)
- LCDs organic molecules, naturally in crystalline
state, that liquefy when excited by heat or E
field - Crystalline state twists polarized light 90º
44Display Technology LCDs
- Transmissive reflective LCDs
- LCDs act as light valves, not light emitters, and
thus rely on an external light source. - Laptop screen backlit, transmissive display
- Palm Pilot/Game Boy reflective display
45Display Technology Plasma
- Plasma display panels
- Similar in principle to fluorescent light tubes
- Small gas-filled capsules are excited by
electric field,emits UV light - UV excites phosphor
- Phosphor relaxes, emits some other color
46Display Technology
- Plasma Display Panel Pros
- Large viewing angle
- Good for large-format displays
- Fairly bright
- Cons
- Expensive
- Large pixels (1 mm versus 0.2 mm)
- Phosphors gradually deplete
- Less bright than CRTs, using more power
47Display Technology DMDs
- Digital Micromirror Devices (projectors)
- Microelectromechanical (MEM) devices, fabricated
with VLSI techniques
48Display Technology DMDs
- DMDs are truly digital pixels
- Vary grey levels by modulating pulse length
- Color multiple chips, or color-wheel
- Great resolution
- Very bright
- Flicker problems
49Display Technologies Organic LED Arrays
- Organic Light-Emitting Diode (OLED) Arrays
- The display of the future? Many think so.
- OLEDs function like regular semiconductor LEDs
- But with thin-film polymer construction
- Thin-film deposition of organic, light-emitting
molecules through vapor sublimation in a vacuum. - Dope emissive layers with fluorescent molecules
to create color. - Not grown like a crystal, no high-temperature
doping - Thus, easier to create large-area OLEDs
50Display Technologies Organic LED Arrays
- OLED pros
- Transparent
- Flexible
- Light-emitting, and quite bright (daylight
visible) - Large viewing angle
- Fast (lt 1 microsecond off-on-off)
- Can be made large or small
51Display Technologies Organic LED Arrays
- OLED cons
- Not quite there yet (96x64 displays) except niche
markets - Cell phones (especially back display)
- Car stereos
- Not very robust, display lifetime a key issue
- Currently only passive matrix displays
- Passive matrix Pixels are illuminated in
scanline order (like a raster display), but the
lack of phosphorescence causes flicker - Active matrix A polysilicate layer provides thin
film transistors at each pixel, allowing direct
pixel access and constant illumination - See http//www.howstuffworks.com/lcd4.htm for
more info - Hard to compete with LCDs, a moving target
52Framebuffers
- So far weve talked about the physical display
device - How does the interface between the device and the
computers notion of an image look? - Framebuffer A memory array in which the computer
stores an image - On most computers, separate memory bank from main
memory (why?) - Many different variations, motivated by cost of
memory