Top Banner
IAT 355 1 Computer Graphics Overview Color Displays Drawing Pipeline
27

Computer Graphics Overview

Feb 07, 2016

Download

Documents

magar

Computer Graphics Overview. Color Displays Drawing Pipeline. Color. Light in range 400-780 nm Tristimulus theory allows color to be reproduced by 3 color components Subtractive: Cyan, Magenta, Yellow CMY - Used in printing Additive: Red, Green, Blue -- RGB. Perception. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Computer Graphics Overview

IAT 355 1

Computer Graphics OverviewColor

Displays

Drawing Pipeline

Page 2: Computer Graphics Overview

IAT 355 2May 26, 2014

Color

• Light in range 400-780 nm• Tristimulus theory allows color to be

reproduced by 3 color components• Subtractive: Cyan, Magenta, Yellow

CMY - Used in printing• Additive: Red, Green, Blue -- RGB

Page 3: Computer Graphics Overview

IAT 355 3May 26, 2014

Perception

• Eye has light sensitive cells on the retina:

• Cones - 3 Types – “Red”, “Green”, and Blue

• Spectral Response Curves

• Rods - “monochrome”

Page 4: Computer Graphics Overview

IAT 355 4May 26, 2014

Color Perception

Page 5: Computer Graphics Overview

IAT 355 5May 26, 2014

Additive Color

• Additive: Red, Green, Blue -- RGB• Red + Blue + Green light added

together = White• Basis of Color LCD

Page 6: Computer Graphics Overview

IAT 355 6May 26, 2014

Displays• Color LCD contains rectangular array of

colored dots - Pixels– RGB Triads– R, G, and B controlled separately per pixel– 8 bits for each R, G and B

Page 7: Computer Graphics Overview

IAT 355 7May 26, 2014

Frame Buffer

• Stores image to be refreshed on Display

• Dual port: Refresh port + Random-access

port• Video RAM• Random-Access port used to load

frame buffer with images

Page 8: Computer Graphics Overview

IAT 355 8May 26, 2014

How do we turn on pixels?

• We use the Standard Graphics Pipeline• We start with geometric items to draw• Each item is passed down the pipeline

to the frame buffer.– Start with polygons– End with filled pixels

Page 9: Computer Graphics Overview

IAT 355 9May 26, 2014

Programmer’s Model

• Data Application Graphics Library Hardware Screen – Data: Info you want to draw– Application: (Rockets + Asteroids)– Graphics Library: (Processing, OpenGL)– Hardware: GPU (ATI / nVidia)– Screen: GPU’s frame buffer memory

Page 10: Computer Graphics Overview

IAT 355 10May 26, 2014

Drawing Pipeline

• Standard drawing process uses a pipeline of computations

• Starts with: Collection of polygons• Ends with: Image stored in frame buffer

(Desired result)

Page 11: Computer Graphics Overview

IAT 355 11May 26, 2014

Pipeline

Input device -> Model traversal -> Model transform -> Viewing transform -> Clipping -> Project & Map to Viewport -> Lighting -> Shading -> Rasterization -> Display

Page 12: Computer Graphics Overview

IAT 355 12May 26, 2014

Pipeline:Model Traversal

• Data structure of Polygons• Each polygon in own coordinate system• List:

0

1

2

3

Page 13: Computer Graphics Overview

IAT 355 13May 26, 2014

Pipeline: Modeling Transform

• Move each polygon to its desired location

• Operations: Translate, Scale, Rotate

0

1

2

3x

y

Page 14: Computer Graphics Overview

IAT 355 14May 26, 2014

Pipeline: Viewing Transform

• Transform the geometry of the scene into the coordinate space of the camera– The model truck going up a hill– the

camera pans out

x

y

Page 15: Computer Graphics Overview

IAT 355 15May 26, 2014

Clipping• Viewport is area of Frame Buffer where

new image is to appear• Clipping eliminates geometry outside

the viewport

Viewport

Clipping

Resulting

Polygon

Page 16: Computer Graphics Overview

IAT 355 16May 26, 2014

Rasterization• Find which pixels are covered by polygon:

• Plane Sweep: For each polygon– go line-by-line from min to max

• go from left boundary to right boundary pixel by pixel– Fill each pixel

• 2D Process

Page 17: Computer Graphics Overview

IAT 355 17May 26, 2014

Data Representation

• 2D Objects: (x, y) a 2D Vector• 3D Objects: (x, y, z) a 3D Vector• 2D Scale: (Sx, Sy) a 2x2 Matrix

• 2D Rotate (R theta)• 2D Translate (Tx, Ty)

Sx 0 2 0 x 4 = 8

0 Sy 0 3 5 15( () ) ( () )

Page 18: Computer Graphics Overview

IAT 355 18

Matrix• A Matrix is a rectangular array of

numbers• A single Matrix can be labelled by a

single variable• Geometric operations can be

represented by a matrix:– Multiply the matrix times vector to get

new vector:• Vnew = M x Vold May 26, 2014

Page 19: Computer Graphics Overview

IAT 355 19May 26, 2014

Scale

Sx 0 2 0 x 4 = 2 x 4 + 0 x 5 = 8

0 Sy 0 3 5 0 x 4 + 3 x 5 = 15( () ) ( () )( )

Page 20: Computer Graphics Overview

IAT 355 20May 26, 2014

2D Rotation

cos θ -sin θ 0 -1 x 3 = -4

sin θ cos θ 1 0 4 3( ) ( () )

x x

θ

Page 21: Computer Graphics Overview

IAT 355 21May 26, 2014

Homogeneous coordinates

• Translate(Tx, Ty, Tz)– X’ = X + Tx– Y’ = Y + Ty– Z’ = Z + Tz

x

y

x

y

x' = x + 3

y' = y + 2

Page 22: Computer Graphics Overview

IAT 355 22May 26, 2014

Homogeneous Coordinates

• Add a 4th value to a 3D vector• (x/w, y/w, z/w) <-> (x, y, z, w)

1 0 0 Tx X X+Tx

0 1 0 Ty * Y = Y+Tz

0 0 1 Tz Z Z+Tz

0 0 0 1 1 1

Page 23: Computer Graphics Overview

IAT 355 23May 26, 2014

3D Graphics

Page 24: Computer Graphics Overview

IAT 355 24May 26, 2014

Project & Map to Viewport

• Viewport is area of Frame Buffer where new image is to appear

• Projection takes 3D data and flattens it to 2D

Eye

Projection Plane

(Screen)

Page 25: Computer Graphics Overview

IAT 355 25May 26, 2014

Lighting

• Simulate effects of light on surface of objects

• Each polygon gets some light independent of other objects

SpecularDiffuse (Lambertian)

Page 26: Computer Graphics Overview

IAT 355 26May 26, 2014

Shading

• Lighting could be calculated for each pixel, but that’s expensive

• Shading is an approximation:– Gouraud shading: Light each vertex– Interpolate color across pixels

Page 27: Computer Graphics Overview

IAT 355 27May 26, 2014

Rendering Pipeline

Input device -> Model traversal -> Model transform -> Viewing transform -> Clipping -> Project & Map to Viewport -> Lighting -> Shading -> Rasterization -> Display