1
CS 4 7 3 1 : Com put e r Gr a phics Le ct ur e 1 6 : I llum ina t ion M ode ls Pa r t 2 Em m anuel Agu
Adding Color
- Som etim es light or surfaces are colored
- Treat R,G and B com ponents separately
- I llum ination equation goes from :
I llu m = a m bie nt + diffuse + sp e cu la r = Ka x I + Kd x I x ( N .L) + Ks x I x ( R.V )
- To:
I llu m_ r = Ka _ r x I _ r + Kd_ r x I _ r x ( N .L) + Ks_ r x I _ r x ( R.V ) I llu m_ g = Ka _ g x I _ g + Kd _ g x I _ g x ( N .L) + Ks_ g x I _ g x ( R.V ) I llu m_ b = Ka _ b x I _ b + Kd _ b x I _ b x ( N .L) + Ks_ b x I _ b x ( R.V ) n
Adding Color
8 9 .6 0.773911 0.773911 0.773911 0.2775 0.2775 0.2775 0.23125 0.23125 0.23125 Polished Silver 27.8974 0.992157 0.941176 0.807843 0.780392 0.568627 0.113725 0.329412 0.223529 0.027451 Brass 3 2 0 .5 0 .5 0 .5 0 .0 1 0 .0 1 0 .0 1 0 .0 0 .0 0 .0 Black plastic Exponent, n Specular Ksr, Ksg, ksb Diffuse Kdr, Kdg,kdb Ambient Kar, Kag, kab Material
Figure 8.17, Hill, courtesy of McReynolds and Blythe
Lighting in OpenGL
- Adopt Phong light ing m odel
- Interpolate across surface (Gouraud/smooth shading)
- Use a constant illumination (get it from one of the vertices)
- Setting up OpenGL Lighting: