lec3b theory in computer graphics.ppt - faculty of …jamalt/sme4513/lec3b theory in computer... ·...

28
Lecture 3 Lecture 3 Principles of Computer Graphics Lecture 3 1

Upload: hanhu

Post on 26-Jun-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Lecture 3Lecture 3

Principles of Computer Graphics

Lecture 3 1

Page 2: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Why we learn computer graphics?

Appreciate what we see The knowledge can applied when we want The knowledge can applied when we want to develop specific engineering program that requires computer graphicsq p g pSome of theories computer graphics has engineering applicationsTrend: Engineering Computer Graphic Group under Faculty of ME in UT, Austin

Lecture 3 2

Page 3: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Definition of Computer Graphics

R f t t d i Refers to any computer device or program that makes a computer capable of displaying and capable of displaying and manipulating pictures. (Webopedia)Computer graphics generally means Computer graphics generally means creation, storage and manipulation of models and images models and images

Lecture 3 3

Page 4: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Computer Graphics

i. Interactiveii. Clippingiii. Projectioniv. Hidden line or surface removalv. Surface detail and texturev. Surface detail and texture

Lecture 3 4

Page 5: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

i. Interactive Computer Graphics

First interactive graphics system, Sketchpad, by Ivan Sutherland

Note: using CRT monitor, light pen and function-key panel

Lecture 3 5

Page 6: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Interactive Computer Graphics

Touch Screen on PDA

HP I-PaqTM Wii by Nintendo

Virtual Sphere

Lecture 3 6

Page 7: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Desktop

Semi ImmersiveSe e s e

Fully Immersivee.G CAVE

Lecture 3 7

Page 8: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Menu and Icon: Interactive

Microsoft word with all the menu

Lecture 3 8

Page 9: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

UI FactC t d i h h d ’tComputer speed increases however human doesn’t.

Human Computer Interface Research Center

•Human Interface Technology Lab (University of Washington)u a te ace ec o ogy ab (U e s ty o as gto )•Group for User Interface Research (UC Berkeley)•Human Computer Interaction Institute (Carnegie Mellon)•Graphics, Visualization, and Usability Center (Georgia Tech)

Lecture 3 9

Page 10: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Cool fact on UI

90/10 rule10% of the features using 90% of the time consumedconsumed

Xerox-First developed mouse-First developed personnel workstationFi t d l d l i lti i d-First developed overlapping multiwindows

1985, famous lawsuit, Apple vs. Microsoft over Windows use of icons, pointers, etc., p ,

Microsoft Windows is considered as a Mac imitation with minimal improvements

Apple lost all claims

Lecture 3 10

Apple lost all claims

Page 11: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Computer Graphics

T t li i i li ti To create realism in visualization. i. Interactive ii. Clippingiii. Projectioniv. Hidden line or surface removalv. Surface detail and texturev. Surface detail and texture

Lecture 3 11

Page 12: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

ii. Clipping

Lecture 3 12

Page 13: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Clipping con’t

Example: G l th d i i Example: Google earth, rendering is carried out when we view on certain areaarea

Why? Save memory allocation when only viewport is rendered or displayedo y e po t s e de ed o d sp ayed

Problem: display actual shape and display shapep y p

Technique: display the visible part and discard the invisible part

Lecture 3 13

p

Page 14: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Clipping Technique

F t h i C h d S h l dFamous technique: Cohen and Sutherland

Principle: Edges of the screen is extended to form nine regions. The central region will be the entities to be displayed.p y

Polygon: extra line is createdCurves: breaking the curves into segments of straight lines

Lecture 3 14

Page 15: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

2D CLIPPING

Th d ill i th ti f

2D CLIPPING

010100011001

The procedure will examine the vertices of the lines using four bits code

b3 b2 b1 b0

0100

DC

If TRUE bits = 1

b3 = ( x < xmin) vertex to the left of ADDisplay0000

01001000

A B

b2 = ( x > xmax) vertex to the right of BC

b1 = (y < ymin) vertex below AB

b0 = (y > ymax) vertex above CD

01100010

1010A B

(y y )

Lecture 3 15

Page 16: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

3D ClippingFront plane Center plane Rear plane

010000010001

011010011001

010010

011000

Front plane

000000000001

001010001001

000010

001000

Center plane

100000100001

101010101001

100010

101000

Rear plane

010000010001 010010

010110010100010101

000000000001 000010

000110000100000101

100000100001 100010

100110100100100101

27 R i27 Regions

6 bit outcode records results of four bounds tests: First bit: outside back plane, behind back planeS d bit t id f t l i f t f f t l Second bit: outside front plane, in front of front plane Third bit: outside top plane, above top planeFourth bit: outside bottom plane, below bottom planeFifth bit: outside right plane, to right of right planeSi th bit t id l ft l t l ft f l ft l

Lecture 3 16

Sixth bit: outside left plane, to left of left plane

Page 17: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Computer Graphics

T t li i i li ti To create realism in visualization. i. Interactive ii. Clippingiii. Projectioniv. Hidden line or surface removalv. Surface detail and texturev. Surface detail and texture

Lecture 3 17

Page 18: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

iii. Type of projectionP ll l P j ti P ti P j tiParallel Projection:Used by engineer for measurement

Perspective Projection:Imitates eyes or camera to look more natural

SCREEN

SCREEN

Lecture 3 18

Page 19: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Projection in games

Isometric projection has been used Isometric projection has been used in games since it first used in 1982

Lecture 3 19

Page 20: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Computer Graphics

T t li i i li ti To create realism in visualization. i. Interactive ii. Clippingiii. Projectioniv. Hidden line or surface removalv. Surface detail and texturev. Surface detail and texture

Lecture 3 20

Page 21: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

iv. Hidden line & Surface RemovalBack-Face Removal: faces that are facing camera are visibleBack-Face Removal: faces that are facing camera are visible

invisibleback face

invisibleback face

visible

visible

Lecture 3 21

Page 22: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

iii. Hidden line & Surface Removal-cont

Z d thZ-depthsorting all the faces (polygons) in the

di t th l t scene according to the largest z coordinate value of each.

Lecture 3 22

Page 23: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

iii. Hidden line & Surface Removal-cont

Ray Tracing MethodRay Tracing Method

0Ryx0y)f(x,

222 =−+

=Eq of the circle

0Ryx +

)6183()68()13( tttQtdPQ

+=+=+=

Let’s say eye point P = (-3,1) with Vector direction of (0.8, -0.6)

)6.1,8.3()6,8(.)1,3( tttQ −+−=−+−=

Therefore 0960)(

2 =+−

=

ttQf

Then, solve the quadratic equations.Then, solve the quadratic equations.imaginary answer: no intersectionOne answer: tangent to the circle, visible pointTwo answer: two points,

i ibl hidd

Lecture 3 23

one visible, one hidden

Page 24: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Computer Graphics

T t li i i li ti To create realism in visualization. i. Interactive ii. Clippingiii. Projectioniv. Hidden line or surface removalv. Surface detail and texturev. Surface detail and texture

Lecture 3 24

Page 25: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

v. Surface detail and texture

Type of lightType of lightPoint light source: provide shine on surfaceAmbient light: a light with uniform g gbrightness

Lecture 3 25

Page 26: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

IlluminationSurfaces comprises of small flat Surfaces comprises of small flat faces called polygon, each patch has its own normal and center point. pThe basic principle of illumination is light rays will strike on each patch and the li h ill b b b d fl d

specular

light will be absorbed, reflected or scattered. Realism can be achieved by the combination of spot light and

diffuse

ambientcombination of spot light and ambient light

Lecture 3 26

Page 27: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Shading

Basic principle: each vertex on the polygon has its own color. The color p ygwill be interpolated as they move toward center of the polygon

Flat shading: same color across the polygonGourand shading: lights are computed at its vertices and interpolation across the polygon is carried outinterpolation across the polygon is carried outPhong lighting model: linearly interpolate a normal vector N across the polygon on from the normal on each vertex and it is done for each pixel in the polygon. Then color the pixel accordingly

Lecture 3 27

accordingly.

Page 28: Lec3b Theory in Computer Graphics.ppt - Faculty of …jamalt/sme4513/Lec3b Theory in Computer... · 2009-07-02 · Some of theories computer graphics has engineering applications

Texture mappingA texture map is applied (mapped) to polygon 2D A texture map is applied (mapped) to polygon. 2D mapping is similar to process of applying patterned paper to the object. 3D texture mapping is analogous to craving process. g pVisual affect or illusion is used to create realism such sense of depth.

iClone

Lecture 3 28