Lecture 3 Principles of Computer Graphics Lecture 3 1
Why we learn computer graphics? Appreciate what we see The knowledge can applied when we want to develop specific engineering program that requires computer graphics 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 Refers to any computer device 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 3
Computer Graphics i. Interactive ii. Clipping iii. Projection iv. Hidden line or surface removal v. Surface detail and texture Lecture 3 4
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
Interactive Computer Graphics Touch Screen on PDA HP I-Paq TM Wii by Nintendo Virtual Sphere Lecture 3 6
Desktop Semi Immersive e Fully Immersive e.g CAVE Lecture 3 7
Menu and Icon: Interactive Microsoft word with all the menu Lecture 3 8
UI Fact Computer speed increases however human doesn t. Human Computer Interface Research Center Human Interface Technology ogy Lab (University of Washington) Group for User Interface Research (UC Berkeley) Human Computer Interaction Institute (Carnegie Mellon) Graphics, Visualization, and Usability Center (Georgia Tech) Lecture 3 9
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 developed d overlapping multiwindows i 1985, famous lawsuit, Apple vs. Microsoft over Windows use of icons,,p pointers, etc. Microsoft Windows is considered as a Mac imitation with minimal improvements Apple lost all claims Lecture 3 10
Computer Graphics To create realism in visualization. i. Interactive ii. Clipping iii. Projection iv. Hidden line or surface removal v. Surface detail and texture Lecture 3 11
ii. Clipping Lecture 3 12
Clipping con t Example: Google earth, rendering is carried out when we view on certain area Why? Save memory allocation when only viewport is rendered ed or displayed Problem: display actual shape and display shape Technique: display the visible part and discard the invisible part Lecture 3 13
Clipping Technique Famous 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. Polygon: extra line is created Curves: breaking the curves into segments of straight lines Lecture 3 14
2D CLIPPING The procedure will examine the vertices of the lines using four bits code b3 b2 b1 b0 1001 0001 0101 If TRUE bits = 1 D C b3 = ( x < xmin) vertex to the left of AD b2 = ( x > xmax) vertex to the right of BC b1 = (y < ymin) vertex below AB 1000 Display 0000 0100 b0 = (y > ymax) vertex above CD 1010 A 0010 B 0110 Lecture 3 15
3D Clipping Front plane Center plane Rear plane 011001 011000 011010 001001 001000 001010 101001 101000 101010 010001 010000 010010 000001 000000 000010 100001 100000 100010 010101 010100 010110 000101 000100 000110 100101 100100 100110 27 Regions 6 bit outcode records results of four bounds tests: First bit: outside back plane, behind back plane Second bit: outside front plane, in front of front plane 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 Sixth bit: outside left plane, to left of left plane Lecture 3 16
Computer Graphics To create realism in visualization. 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 l Projection: Perspective Projection: Used by engineer for measurement 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 realism in visualization. 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-depth sorting all the faces (polygons) in the scene according to the largest z coordinate value of each. Lecture 3 22
iii. Hidden line & Surface Removalcont Ray Tracing Method Eq of the circle f(x, y) = 0 2 x + y 2 R 2 = 0 Let s say eye point P = (-3,1) with Vector direction of (0.8, -0.6) f ( Q) = 0 Therefore 2 t 6t + 9 = 0 Q = P+ td Q = ( 31) 3,1) + t (.8, 6) = ( 3 +.8 t,1.6 t ) Then, solve the quadratic equations. imaginary answer: no intersection One answer: tangent to the circle, visible point Two answer: two points, one visible, ibl one hidden Lecture 3 23
Computer Graphics To create realism in visualization. i. Interactive ii. Clipping iii. Projection iv. Hidden line or surface removal v. Surface detail and texture Lecture 3 24
v. Surface detail and texture Type of light Point light source: provide shine on surface Ambient light: a light with uniform brightness Lecture 3 25
Illumination Surfaces comprises of small flat faces called polygon, each patch has its own normal and center point. The basic principle of illumination is light rays will strike on each patch and the light will be absorbed, b reflected 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 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. Lecture 3 27
Texture mapping 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 gprocess. Visual affect or illusion is used to create realism such sense of depth. iclone Lecture 3 28