You are on page 1of 28

Lecture 3

Principles of Computer Graphics

Lecture 3

Why we learn computer graphics?


Appreciate what we see The knowledge can applied when we want to develop specific engineering program that requires q computer p g graphics p Some of theories computer graphics has engineering applications Trend: Engineering Computer Graphic Group under Faculty of ME in UT, Austin
Lecture 3 2

Definition of Computer Graphics


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

Lecture 3

Computer Graphics
i. ii. iii. iv. v. Interactive Clipping Projection Hidden line or surface removal Surface detail and texture

Lecture 3

i. Interactive Computer Graphics


First interactive graphics system, Sketchpad, by Ivan Sutherland Note: using CRT monitor, light pen and function-key panel

Lecture 3

Interactive Computer Graphics


Touch Screen on PDA

HP I-PaqTM

Wii by Nintendo

Virtual Sphere

Lecture 3

Desktop Semi Immersive Se e s e

Fully Immersive e.G CAVE

Lecture 3

Menu and Icon: Interactive


Microsoft word with all the menu

Lecture 3

UI Fact
C Computer t speed d increases i however h human h doesnt. d t

Human Computer Interface Research Center


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

Lecture 3

Cool fact on UI
90/10 rule 10% of the features using 90% of the time consumed Xerox -First developed mouse -First developed personnel workstation -First Fi t developed d l d overlapping l i multiwindows lti i d 1985, famous lawsuit, Apple vs. Microsoft over Windows use of icons, , pointers, p , etc. Microsoft Windows is considered as a Mac imitation with minimal improvements Apple lost all claims
Lecture 3 10

Computer Graphics
To T i. ii. iii. iv. v. create t realism li i in visualization. i li ti Interactive Clipping Projection Hidden line or surface removal Surface detail and texture

Lecture 3

11

ii. Clipping

Lecture 3

12

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

Why? Save memory allocation when Problem: display actual shape and
p y shape p display

only o y viewport e po t is s rendered e de ed or o displayed d sp ayed

Technique: display the visible part


part and discard the invisible p
Lecture 3 13

Clipping Technique
Famous F technique: t h i Principle:
C h Cohen and d Sutherland S h l d

Edges of the screen is extended to form nine regions. The central region will be the entities p y to be displayed. Polygon: extra line is created Curves: breaking the curves into segments of straight lines
Lecture 3 14

2D CLIPPING
The procedure Th d will ill examine i the th vertices ti of f the lines using four bits code b3 b2 b1 b0 If TRUE bits = 1 b3 = ( x < xmin) vertex to the left of AD b2 = ( x > xmax) vertex to the right of BC b1 = (y < ymin) vertex below AB
A
1010 0010 1000 Display 0000 1001 0001 0101

0100

y ) vertex above CD b0 = (y > ymax)

B
0110

Lecture 3

15

3D Clipping
Front plane
011001 011000 011010

Center plane
001001 001000 001010

Rear plane
101001 101000 101010

010001 010000

010010 000001 000000

000010 100001 100000

100010

010101 010100

010110 000101 000100

000110 100101 100100

100110

27 Regions R i 6 bit outcode records results of four bounds tests: First bit: outside back plane, behind back plane S Second d bit: outside t id front f t plane, l in i front f t of f front f t plane l Third bit: outside top plane, above top plane Fourth bit: outside bottom plane, below bottom plane Fifth bit: outside right plane, to right of right plane Si th bit: Sixth outside t id left l ft plane, l to t left l ft of f left l ft plane l
Lecture 3 16

Computer Graphics
To create T t realism li i in visualization. i li ti i. Interactive ii. Clipping iii. Projection iv. Hidden line or surface removal v. Surface detail and texture

Lecture 3

17

iii. Type of projection


Parallel P ll l P Projection: j ti Used by engineer for measurement Perspective P ti P Projection: j ti Imitates eyes or camera to look more natural
SCREEN

SCREEN

Lecture 3

18

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

Lecture 3

19

Computer Graphics
To create T t realism li i in visualization. i li ti i. Interactive ii. Clipping iii. Projection iv. Hidden line or surface removal v. Surface detail and texture

Lecture 3

20

iv. Hidden line & Surface Removal


Back-Face Removal: faces that are facing camera are visible

invisible back face

visible

invisible back face

visible

Lecture 3

21

iii. Hidden line & Surface Removalcont


Z Z-depth d th sorting all the faces (polygons) in the scene according di t to th the largest l tz coordinate value of each.

Lecture 3

22

iii. Hidden line & Surface Removalcont


Ray Tracing Method
Eq of the circle

f(x, y) = 0 x 2 + y2 R 2 = 0

Lets say eye point P = (-3,1) with Vector direction of (0.8, -0.6) Q = P + td

f (Q) = 0
Therefore

Q = (3,1) + t(. ( 8,6) = (3 + .8t,1 .6t )

t 2 6t + 9 = 0

Then, solve the quadratic equations. imaginary answer: no intersection One answer: tangent to the circle, visible point Two answer: two points, one visible, i ibl one hidd hidden
Lecture 3 23

Computer Graphics
To T i. ii. iii. iv. v. create t realism li i in visualization. i li ti Interactive Clipping Projection Hidden line or surface removal Surface detail and texture

Lecture 3

24

v. Surface detail and texture


Type of light Point light source: provide shine on surface Ambient light: g a light g with uniform brightness

Lecture 3

25

Illumination
Surfaces comprises of small flat faces called polygon, each patch has its own normal and center p point. The basic principle of illumination is light rays will strike on each patch and the li h will light ill b be absorbed, b b d reflected fl d or scattered. Realism can be achieved by the combination of spot light and ambient light

specular diffuse

ambient

Lecture 3

26

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

Flat shading: same color across the polygon Gourand shading: lights are computed at its vertices and interpolation across the polygon is carried out Phong 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 accordingly.
Lecture 3 27

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

iClone
Lecture 3 28

You might also like