Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 445: Introduction to Computer Graphics David Luebke University of Virginia Display Technologies, Mathematical Fundamentals.

Similar presentations


Presentation on theme: "CS 445: Introduction to Computer Graphics David Luebke University of Virginia Display Technologies, Mathematical Fundamentals."— Presentation transcript:

1 CS 445: Introduction to Computer Graphics David Luebke University of Virginia Display Technologies, Mathematical Fundamentals

2 Admin l Call roll l Introductions: Sam Guarnieri –Office hours: n M – 11-12 am n W 10-11 am l Assignment 1 out

3 Demo l Soap-bubble bunny

4 Mathematical Foundations l A very brief review of some mathematical tools we’ll employ –Geometry (2D, 3D) –Trigonometry –Vector and affine spaces n Points, vectors, and coordinates –Dot and cross products –Linear transforms and matrices

5 3D Geometry l To model, animate, and render 3D scenes, we must specify: –Location –Displacement from arbitrary locations –Orientation l We’ll look at two types of spaces: –Vector spaces –Affine spaces l We will often be sloppy about the distinction

6 Vector Spaces l 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

7 Vectors And Points l We commonly use vectors to represent: –Direction (i.e., orientation) –Points in space (i.e., location) –Displacements from point to point l 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

8 Affine Spaces l To be more rigorous, we need an explicit notion of position l Affine spaces add a third element to vector spaces: points (P, Q, R, …) l Points support these operations –Point-point subtraction: Q - P = v n Result is a vector pointing from P to Q –Vector-point addition: P + v = Q n Result is a new point n P + 0 = P –Note that the addition of two points is not defined P Q v

9 Affine Spaces l 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 l Thus the common practice of representing points as vectors with coordinates l Be careful to avoid nonsensical operations –Point + point –Scalar * point

10 Affine Lines: An Aside l Parametric representation of a line with a direction vector d and a point P 1 on the line: P(  ) = P origin +  d Restricting 0   produces a ray Setting d to P - Q and restricting 0    1 produces a line segment between P and Q

11 Dot Product l The dot product or, more generally, inner product of two vectors is a scalar: v 1 v 2 = x 1 x 2 + y 1 y 2 + z 1 z 2 (in 3D) l 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 θ u v

12 Cross Product l The cross product or vector product of two vectors is a vector: l Cross product of two vectors is orthogonal to both l Right-hand rule dictates direction of cross product l Cross product is handy for finding surface orientation –Lighting –Visibility

13 Linear Transformations l A linear transformation: –Maps one vector to another –Preserves linear combinations l Thus behavior of linear transformation is completely determined by what it does to a basis l Turns out any linear transform can be represented by a matrix

14 Matrices l By convention, matrix element M rc is located at row r and column c: l By (OpenGL) convention, vectors are columns:

15 Matrices l Matrix-vector multiplication applies a linear transformation to a vector: l Recall how to do matrix multiplication

16 Matrix Transformations l 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! l The identity matrix I has no effect in multiplication l Some (not all) matrices have an inverse:

17 3D Scene Representation l Scene is usually approximated by 3D primitives –Point –Line segment –Polygon –Polyhedron –Curved surface –Solid object –etc.

18 3D Point l Specifies a location Origin

19 3D Point l Specifies a location –Represented by three coordinates –Infinitely small typedef struct { Coordinate x; Coordinate y; Coordinate z; } Point; typedef struct { Coordinate x; Coordinate y; Coordinate z; } Point; (x,y,z) Origin

20 3D Vector l Specifies a direction and a magnitude

21 3D Vector l Specifies a direction and a magnitude –Represented by three coordinates –Magnitude ||V|| = sqrt(dx dx + dy dy + dz dz) –Has no location typedef struct { Coordinate dx; Coordinate dy; Coordinate dz; } Vector; typedef struct { Coordinate dx; Coordinate dy; Coordinate dz; } Vector; (dx,dy,dz)

22 3D Vector l Specifies a direction and a magnitude –Represented by three coordinates –Magnitude ||V|| = sqrt(dx dx + dy dy + dz dz) –Has no location l Dot product of two 3D vectors –V 1 ·V 2 = dx 1 dx 2 + dy 1 dy 2 + dz 1 dz 2 –V 1 ·V 2 = ||V 1 || || V 2 || cos(  ) typedef struct { Coordinate dx; Coordinate dy; Coordinate dz; } Vector; typedef struct { Coordinate dx; Coordinate dy; Coordinate dz; } Vector; (dx 1,dy 1,dz 1 ) (dx 2,dy 2,dz 2 ) 

23 3D Line Segment l Linear path between two points Origin

24 3D Line Segment l Use a linear combination of two points –Parametric representation: n P = P 1 + t (P 2 - P 1 ), (0  t  1) typedef struct { Point P1; Point P2; } Segment; typedef struct { Point P1; Point P2; } Segment; P1P1 P2P2 Origin

25 3D Ray l Line segment with one endpoint at infinity –Parametric representation: n P = P 1 + t V, (0 <= t <  ) typedef struct { Point P1; Vector V; } Ray; typedef struct { Point P1; Vector V; } Ray; P1P1 V Origin

26 3D Line l Line segment with both endpoints at infinity –Parametric representation: n P = P 1 + t V, (-  < t <  ) P1P1 typedef struct { Point P1; Vector V; } Line; typedef struct { Point P1; Vector V; } Line; V Origin

27 3D Plane l A linear combination of three points P1P1 P3P3 P2P2

28 Origin 3D Plane l A linear combination of three points –Implicit representation: n P·N + d = 0, or n ax + by + cz + d = 0 –N is the plane “normal” n Unit-length vector n Perpendicular to plane typedef struct { Vector N; Distance d; } Plane; typedef struct { Vector N; Distance d; } Plane; P1P1 N = (a,b,c) d P3P3 P2P2

29 3D Polygon l Area “inside” a sequence of coplanar points –Triangle –Quadrilateral –Convex –Star-shaped –Concave –Self-intersecting –Holes (use > 1 polygon struct) typedef struct { Point *points; int npoints; } Polygon; typedef struct { Point *points; int npoints; } Polygon; Points are in counter-clockwise order

30 3D Sphere l All points at distance “r” from point “(c x, c y, c z )” –Implicit representation: n (x - c x ) 2 + (y - c y ) 2 + (z - c z ) 2 = r 2 –Parametric representation: n x = r cos(  ) cos(  ) + c x n y = r cos(  ) sin(  ) + c y n z = r sin(  ) + c z typedef struct { Point center; Distance radius; } Sphere; typedef struct { Point center; Distance radius; } Sphere; r Origin

31 Display Technologies l Cathode Ray Tubes (CRTs) –Most common display device today –Evacuated glass bottle (last of 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

32 Display Technologies: CRTs l Vector Displays –My childhood: Battlezone, Tempest

33 Display Technologies: CRTs l 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/F98/Lecture1/Slide11.html http://graphics.lcs.mit.edu/classes/6.837/F98/Lecture1/Slide11.html l Name two disadvantages Just does wireframe Complex scenes  visible flicker

34 Display Technologies: CRTs l Black and white television: an oscilloscope with a fixed scan pattern: left to right, top to bottom –Paint entire screen 30 times/sec n Actually, TVs paint top-to-bottom 60 times/sec, alternating between even and odd scanlines n This is called interlacing. It’s a hack. Why do it? –To paint the screen, computer needs to synchronize with the scanning pattern of raster n Solution: special memory to buffer image with scan-out synchronous to the raster. We call this the framebuffer.

35 Display Technologies: CRTs l 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)

36 Display Technologies: CRTs l 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 n Typically 60 times/sec n Varies with intensity, individuals, phosphor persistence, lighting...

37 Display Technology: Color CRTs l 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 arrangementIn-line electron gun arrangement

38 Display Technology: Color CRTs l Color CRTs have –Three electron guns –A metal shadow mask to differentiate the beams

39 Display Technology: Raster CRTs l Raster CRT pros: –Allows solids, not just wireframes –Leverages low-cost CRT technology (i.e., TVs) –Bright! Display emits light l Cons: –Requires screen-size memory array –Discreet sampling (pixels) –Practical limit on size (call it 40 inches) –Bulky –Finicky (convergence, warp, etc)

40 CRTs – Overview –CRT technology hasn’t changed much in 50 years –Early television technology n high resolution n requires synchronization between video signal and electron beam vertical sync pulse –Early computer displays n avoided synchronization using ‘vector’ algorithm n flicker and refresh were problematic

41 CRTs – Overview –Raster Displays (early 70s) n like television, scan all pixels in regular pattern n use frame buffer (video RAM) to eliminate sync problems –RAM n ¼ MB (256 KB) cost $2 million in 1971 n 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

42 Display Technology: LCDs l 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º.

43 Display Technology: LCDs l 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º

44 Display Technology: LCDs l 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

45 Display Technology: Plasma l 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

46 Display Technology l Plasma Display Panel Pros –Large viewing angle –Good for large-format displays –Fairly bright l Cons –Expensive –Large pixels (~1 mm versus ~0.2 mm) –Phosphors gradually deplete –Less bright than CRTs, using more power

47 Display Technology: DMDs l Digital Micromirror Devices (projectors) –Microelectromechanical (MEM) devices, fabricated with VLSI techniques

48 Display Technology: DMDs l DMDs are truly digital pixels l Vary grey levels by modulating pulse length l Color: multiple chips, or color-wheel l Great resolution l Very bright l Flicker problems

49 Display Technologies: Organic LED Arrays l 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: n Thin-film deposition of organic, light-emitting molecules through vapor sublimation in a vacuum. n Dope emissive layers with fluorescent molecules to create color. n Not grown like a crystal, no high-temperature doping n Thus, easier to create large-area OLEDs

50 Display Technologies: Organic LED Arrays l OLED pros: –Transparent –Flexible –Light-emitting, and quite bright (daylight visible) –Large viewing angle –Fast (< 1 microsecond off-on-off) –Can be made large or small

51 Display Technologies: Organic LED Arrays l OLED cons: –Not quite there yet (96x64 displays) except niche markets n Cell phones (especially back display) n Car stereos –Not very robust, display lifetime a key issue –Currently only passive matrix displays n Passive matrix: Pixels are illuminated in scanline order (like a raster display), but the lack of phosphorescence causes flicker n 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

52 Framebuffers l So far we’ve talked about the physical display device l How does the interface between the device and the computer’s notion of an image look? l 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


Download ppt "CS 445: Introduction to Computer Graphics David Luebke University of Virginia Display Technologies, Mathematical Fundamentals."

Similar presentations


Ads by Google