Utah School of Computing Spring 2013 CS 5600 CS 5600 • Class mailing list: Introduction to Computer Graphics cs5600@list.eng.utah.edu http://www.eng.utah.edu/~cs5600/ • Sign up: Prof: Chuck Hansen https://sympa.eng.utah.edu/sympa/info/cs5600 • Text: OpenGL Programming Guide “Red Book” Goal: have fun and learn graphics! supplemental reading material » DDA – Line Drawing » Ray Tracing Spring 2013 Utah School of Computing 1 Spring 2013 Utah School of Computing 2 CS 5600 CS 5600 • Grading: • What will we do? – Color 70% homework – DDA algorithms (equ. into algs) 25% exams – Scan conversion 5% class participation (ask questions, – Transformations respond to questions) – Projections • Cheating: DON'T share code! DON'T – Polygon rendering grab code off the web! – Texture mapping • Late penalty: -20%/day but 4 one-day – Ray tracing grace periods. Spring 2013 Utah School of Computing 3 Spring 2013 Utah School of Computing 4 Prereqs: Prereqs: • Normalized Vector? • Normalized Vector? • Matrix multiply? • Matrix multiply? • Vector multiply? • Vector multiply? • Dot-product? (what is it?) • Dot-product? (what is it?) Spring 2013 Utah School of Computing 5 Spring 2013 Utah School of Computing 6 Computer Graphics CS5600
Utah School of Computing Spring 2013 Prereqs: Prereqs: • Cross Product? • Cross Product? – Properties? – Properties? – Compute? Spring 2013 Utah School of Computing 7 Spring 2013 Utah School of Computing 8 Cross Product Cross Product V1 = [3, -1, 0] V2 = [4, -3, 1] V1 = [3, -1, 0] V2 = [4, -3, 1] x y z x y z 3 -1 0 3 -1 0 4 -3 1 4 -3 1 Det: Det: -1 - 0 , Spring 2013 Utah School of Computing 9 Spring 2013 Utah School of Computing 10 Cross Product Cross Product V1 = [3, -1, 0] V2 = [4, -3, 1] V1 = [3, -1, 0] V2 = [4, -3, 1] x y z x y z 3 -1 0 3 -1 0 4 -3 1 4 -3 1 X WRONG! Det: -1 , 3 - 0 , Det: -1 , 0 - 3 , Spring 2013 Utah School of Computing 11 Spring 2013 Utah School of Computing 12 Computer Graphics CS5600
Utah School of Computing Spring 2013 Cross Product Cross Product V1 = [3, -1, 0] V2 = [4, -3, 1] V1 = [3, -1, 0] V2 = [4, -3, 1] x y z x y z 3 -1 0 3 -1 0 4 -3 1 4 -3 1 Det: -1, -3, Det: -1, -3, -5 -9 - (-4) Spring 2013 Utah School of Computing 13 Spring 2013 Utah School of Computing 14 Cross Product Sarrus' scheme Cross Product Sarrus' scheme V1 = [3, -1, 0] V2 = [4, -3, 1] V1 = [3, -1, 0] V2 = [4, -3, 1] x y z x y z x y z x y z 3 -1 0 3 -1 0 3 -1 0 3 -1 0 4 -3 1 4 -3 1 4 -3 1 4 -3 1 Det: Det: -1 - 0 , Spring 2013 Utah School of Computing 15 Spring 2013 Utah School of Computing 16 Cross Product Sarrus' scheme Cross Product Sarrus' scheme V1 = [3, -1, 0] V2 = [4, -3, 1] V1 = [3, -1, 0] V2 = [4, -3, 1] x y z x y z x y z x y z 3 -1 0 3 -1 0 3 -1 0 3 -1 0 4 -3 1 4 -3 1 4 -3 1 4 -3 1 Det: -1, 0 - 3 , Det: -1, -3, -9 - (-4) , Spring 2013 Utah School of Computing 17 Spring 2013 Utah School of Computing 18 Computer Graphics CS5600
Utah School of Computing Spring 2013 Cross Product Sarrus' scheme Line Equations • Explicit form: V1 = [3, -1, 0] V2 = [4, -3, 1] y = mx + b x y z x y z • Implicit form: 3 -1 0 3 -1 0 f(x,y) = Ax + By + C = 0 4 -3 1 4 -3 1 • Parametric form: P(x,y) = P 0 + t D Det: -1, -3, -5 Spring 2013 Utah School of Computing 19 Spring 2013 Utah School of Computing 20 Line Equations Line Equations P(x,y) = P 0 + t D For P 1 P 2 : Show: y = mx + b equivalent to P(x,y) = P 0 + t D x = x1 + t (x2 – x1) y = y1 + t (y2 – y1) t = (x – x1) / (x2 – x1) For P 1 P 2 (assume b=0) : y = y1 + [(x – x1) / (x2 – x1)] (y2 – y1) y – y1 = ((y2 – y1)/(x2 – x1)) ( x – x1) y – y1 = (x – x1) [(y2 – y1) / (x2 – x1)] x = ((x2 – x1)/(y2 – y1)) ( y – y1) + x1) x = ((x2 – x1)/(y2 – y1)) ( y – y1) + x1) Spring 2013 Utah School of Computing 21 Spring 2013 Utah School of Computing 22 • Color is complicated! –Highly nonlinear –No single model to explain all CS5600 Computer Graphics Lecture Set 1 Modified from Rich Riesenfeld • Many simplistic models, explanations Spring 2013 • Many myths • Much new knowledge Spring 2013 Utah School of Computing 23 Spring 2013 Utah School of Computing 24 Computer Graphics CS5600
Utah School of Computing Spring 2013 Wavelength Spectrum Wavelength Spectrum ultraviolet infrared light light 700 600 500 400 Wavelength ( nm ) • Seen in physics, physical phenomena (rainbows, prisms, etc) • 1 Dimensional color space Spring 2013 Utah School of Computing 25 Spring 2013 Utah School of Computing 26 Color Spaces Color Space • “Navigating,” moving around in a • Device-derived –convenient for describing display device color space , is tricky levels –RGB, CMY • Many color representations ( spaces ) • Intuitive (transformations) –based in familiar color description terms • Can you get to a nearby color? –HSV, HSI • Perceptually based • Can you predictably adjust a color? –device independent, perceptually uniform –CIELUV, CIELAB, Munsell Spring 2013 Utah School of Computing 27 Spring 2013 Utah School of Computing 28 R-G-B Color Space • Convenient colors (screen phosphors) • Decent coverage of the human color • Not a particularly good basis for human interaction –Non-intuitive –Non-orthogonal (perceptually) Spring 2013 Utah School of Computing 29 Spring 2013 Utah School of Computing 30 Computer Graphics CS5600
Utah School of Computing Spring 2013 Color Cube: ( r,g,b ) is RHS Color Cube cyan blue blue blue cyan cyan (0,1,1) (0,0,1 ) (0,0,1 ) (0,1,1) cyan (0,0,1 ) (0,0,1 ) cyan cyan blue blue blue (0,1,1) (0,1,1) magenta magenta magenta magenta magenta magenta white white white white white white (1,0,1) (1,0,1) (1,0,1) (1,0,1) (1,1,1) (1,1,1) (1,1,1) (1,1,1) gra y green green green green green green black black black (0,1,0) (0,1,0) (0,0,0) (0,0,0) (0,1,0) (0,1,0) red red red (1,0,0) yellow yellow yellow (1,0,0) red red red (1,1,0) (1,1,0) (1,1,0) (1,1,0) (1,0,0) (1,0,0) yellow yellow yellow Spring 2013 Utah School of Computing 31 Spring 2013 Utah School of Computing 32 Complementary Colors Add to Gray Complementary Colors Looking at color cube along major diagonal (0,0,1 ) (0,0,1 ) (0,0,1 ) cyan cyan cyan blue blue blue (0,1,1) (0,1,1) magenta magenta magenta white white white (1,0,1) (1,0,1) (1,1,1) (1,1,1) green green green (0,1,0) (0,1,0) (0,1,0) red red red yellow yellow yellow (1,0,0) (1,0,0) ( 1,1,0 ( 1,1,0 ) ) Spring 2013 Utah School of Computing 33 Spring 2013 Utah School of Computing 34 Additive Primary Colors Additive Primary Colors Additive Primary Colors Additive Primary Colors (1,1,0) yellow yellow yellow (1,1,0) red red red red red red green green green green green green (1,0,0) (1,0,0) (1,0,0) (1,0,0) (0,1,0) (0,1,0) (0,1,0) (0,1,0) white white white (1,1,1) (1,1,1) magenta cyan cyan magenta magenta cyan (1,0,1) (0,1,1) (0,1,1) (1,0,1) yellow yellow yellow (1,1,0) (1,1,0) blue blue blue (0,0,1 ) (0,0,1 ) Spring 2013 Utah School of Computing 35 Spring 2013 Utah School of Computing 36 Computer Graphics CS5600
Utah School of Computing Spring 2013 Additive Primary Colors Additive Primary Colors Additive Primary Colors Additive Primary Colors red red red green green green (1,0,0) (1,0,0) (0,1,0) (0,1,0) magenta magenta magenta cyan cyan cyan (1,0,1) (1,0,1) (0,1,1) (0,1,1) blue blue blue blue blue blue (0,0,1 ) (0,0,1 ) (0,0,1 ) (0,0,1 ) Spring 2013 Utah School of Computing 37 Spring 2013 Utah School of Computing 38 Subtractive Primary Colors Subtractive Primary Colors Subtractive Primary Colors Subtractive Primary Colors red red red (1,0,0) (1,0,0) yellow yellow yellow yellow yellow yellow magenta magenta magenta magenta magenta magenta (1,1,0) (1,1,0) (1,1,0) (1,1,0) (1,1,0) (1,0,1) (1,0,1) (1,0,1) (1,0,1) (1,0,1) black black black (0,0,0) (0,0,0) green green green blue blue blue (0,1,0) (0,1,0) red red red (0,0,1 ) (0,0,1 ) (1,0,0) (1,0,0) (1,0,0) cyan cyan cyan (0,1,1) (0,1,1) Spring 2013 Utah School of Computing 39 Spring 2013 Utah School of Computing 40 Subtractive Primary Colors Subtractive Primary Colors Subtractive Primary Colors Subtractive Primary Colors yellow yellow yellow magenta magenta magenta (1,1,0) (1,1,0) (1,0,1) (1,0,1) green green green blue blue blue (0,1,0) (0,1,0) (0,0,1 ) (0,0,1 ) cyan cyan cyan cyan cyan cyan (0,1,1) (0,1,1) (0,1,1) (0,1,1) Spring 2013 Utah School of Computing 41 Spring 2013 Utah School of Computing 42 Computer Graphics CS5600
Recommend
More recommend