# CS 184: COMPUTER GRAPHICS

## Working with the Lighting/Shading equations.

### Calculate the diffusely reflected components:

I'd   = (  Ia + Id*cos(inc.angle) ) * kd * (r,g,b):
I'dR = (  0.2   +  1 * 0.5   )    *   0.2    *  (0.2)  = 0.028
*1012 photons / s / mm2.
I'dG = (  0.2
+  1 * 0.5   )    *   0.2    *  (1.0)  = 0.14    *1012 photons / s / mm2.
I'dB = (  0.0   +  1 * 0.5   )    *   0.2    *  (0.7)  = 0.07    *1012 photons / s / mm2.

### Calculate the speculalrly reflected component:

I's   = Id  * ks * (Phong.Factor) * (adjusted color):
I'sR = 1  * 0.8  *       (1.0)          * (0.6*0.2 + 0.4*1.0)  = 0.416  *1012 photons / s / mm2.
I'sG = 1  * 0.8  *       (1.0)          * (0.6*1.0 + 0.4*1.0)  = 0.8      *1012 photons / s / mm2.
I'sB = 1  * 0.8  *       (1.0)          * (0.6*0.7 + 0.4*1.0)  = 0.656  *1012 photons / s / mm2.

### Sum up the components:

I'totalR  = 0.444  *1012 photons / s / mm2.
I'totalG  = 0.94    *1012 photons / s / mm2.
I'totalB  = 0.663  *1012 photons / s / mm2.

This kind of computation has to be done by your raytracer every time it hits a surface !

Page Editor: Carlo H. Séquin