H331: Computer Graphics
This resource explores the fundamental concepts of color and perception as they relate to computer graphics. Chapter 12 discusses shading techniques, emphasizing the importance of RGB color channels for output devices. Key topics include how colors are described in numerical terms, the range of colors displayable on devices, and the mechanics of human vision involving rods and cones. Readers are introduced to the trichromatic visual system and how metamers can create the same visual sensation under varying light conditions, ultimately applying color algebra for accurate color matching.
H331: Computer Graphics
E N D
Presentation Transcript
H331: Computer Graphics http://www.cs.kuleuven.ac.be/~graphics/H331/Philip Dutré Department of Computer Science Wednesday, April 30
Today • Color & Perception • Chapter 12
Shading … 5 10 27 n = 3 200 0.1 0.25 ks = 0.5 (by David Kurlander, Columbia University)
Shading • Repeat shading formula for each color channel red, green, blue • R,G,B “works”, because most output devices use R,G,B phosphors
Color in CG • How are colors described in numerical terms? • How do the numbers correspond to daily descriptions of colors? • How are colors compared? • What range of colors can we display on an output device? • …
Color in CG • How can a color be reproduced on a TV screen, using only 3 phosphors? R,G,B ? (PCG-Cornell University)
Color in CG • How can a color be reproduced on a printer, using only 3 inks? CMY ? (PCG-Cornell University)
What is color? • Light = electro-magnetic waves • Visible spectrum • 400 nm (violet) 700 nm (red) wavelength
Power Power 400 Wavelength (nm) 700 400 Wavelength (nm) 700 D55: typical sunlight D65: typical average daylight D75: typical ‘north-sky’ light Power distributions of light sources Test lamp CIE standard (PCG-Cornell University)
Reflectance distributions (PCG-Cornell University)
Reflected spectrum Source Spectrum Product Reflectance Spectrum ? X (PCG-Cornell University)
Fovea gaze Optical center Blind Spot Human eye (PCG-Cornell University)
Human eye: retina Light passes through blood vessels & retinal layers before reaching rods & cones (PCG-Cornell University)
Human eye: rods and cones Rods,Cones in Foveola (PCG-Cornell University)
Human eye: rods and cones • Cones: color-sensitive cells • 3 types, respond to particular ‘color’ • ~6M cones in human eye • Rods • Sensitive to low levels of light • (colors disappear when it’s dark)
Cone responses • S,M,L cones • Each type of cone is sensitive to a specific spectrum of light • Trichromatic visual system (PCG-Cornell University)
P l 400 700 Trichromacy X This is what we ‘see’ S,M,L
P l 400 700 Color metamers • Metamers produce the same visual sensation S1,M1,L1 X = P S2,M2,L2 X l 400 700
Advantage of metamers: • Color on a monitor produces the same visual sensation as the ‘real’ color (PCG-Cornell University)
How to describe colors? • Basic idea: describe a specific power spectrum P(l) that produces the visual sensation of the desired color
Color Matching • Experiment: match a sample light with 3 test lights C(l) B(l) sample lamp S(l) A(l) observer
Color Matching • Adjust intensity of 3 test lights, such that we have metamers: S(l) = aA(l) + bB(l) + cC(l) (read as: ‘are metamers’)
Color Algebra • If (S(l) = P(l)) then (S(l)+N(l) = P(l)+N(l)) • If (S(l) = P(l)) then (aS(l) = aP(l))
Color Matching • Color perception is 3-dimensional • S,M,L responses • 3 test lights R(l), G(l), B(l) • Think “red, “green, “blue” • Chosen because of cone responses • Any color C(l): C(l) = rR(l) + gG(l) + bB(l)
700 nm 546 nm Pure spectral Light (single wavelength) 438 nm observer Color Matching mono(l) = r(700 nm) + g(546 nm) + b(438 nm)
700 nm 546 nm Orange (600 nm) 438 nm observer Color Matching (600 nm) = 0.37(700 nm) + 0.08(546 nm) + 0.0(438 nm)
Color Matching mono(l) = r(700 nm) + g(546 nm) + b(438 nm) Or … mono(l) = r (l) (700 nm) + g (l) (546 nm) + b (l) (438 nm) Color matching functions Normalization:
Color Matching functions (PCG-Cornell University)
Color Matching functions • Negative values? spectral light 700 nm 546 nm 438 nm observer
Summary so far • We have 3 test lights: • 3 because color perception is 3-D (S,M,L) • Chosen in red, green, blue wavelengths • Every pure spectral color (power = 1): Color matching functions, can be negative
So … • Any color with spectrum C(l):
C l 400 700 So… r,g,b X
Problems • Negative values! • Which R,G,B to choose? • Different R,G,B produce different color matching functions • Answer: CIE XYZ standardized color system
XYZ color matching functions • 3 matching functions are chosen: • All positive • Computational convenience • standardized (PCG-Cornell University)
C l 400 700 XYZ color matching functions x,y,z X
XYZ color matching functions • X, Y, Z are NOT physical lights, they are defined only by their color matching functions • There is no color with x=1, y=0, z=0
“Real” colors in RGB and XYZ (PCG-Cornell University)
Chromaticity Diagram (PCG-Cornell University)
I J K Chromaticity Diagram
Monitor • Monitors have 3 types of phospors 0.012 Typical CRT 0.01 0.008 0.006 “B” Spectral Power (watts/m2) “G” 0.004 “R” “R” 0.002 0 350 400 450 500 550 600 650 700 750 λ(wavelength in nm) (PCG-Cornell University)
Monitor color gamut • Not all colors are possible on a CRT • Chromaticity coordinates for each phosphor are different for each monitor
Monitor • If you want to work correctly … • Compute everything in spectral space • Convert spectrum to XYZ • Convert XYZ to RGB (display device dependent) • Display RGB on device
XYZ RGB? • Find the XYZ coordinates of the primaries R, G, B: • Xr, Yr, Zr • Xg, Yg, Zg • Xb, Yb, Zb • Write color as linear combination in XYZ space • Same linear combination applies in RGB space
Interpolation in color space • for anti-aliasing • for Gouraud shading • for blending two images (fade-in, fade-out) • RGB, CIE: (affine transformation)straight lines straight linessame interpolation results