$40
HW3
Goal
1. Draw a sphere and apply Phong shading or Gouraud shading on it.
2. Use keyboard to control the lighting parameters.
*Use GLSL to do this homework, otherwise you’ll get zero points.
Spec
Camera:
Position: (0, 0, 5.6) Center: (0, 0, 0)
Up vector: (0, 1, 0)
Sphere:
Slice: 20
Stack: 10
Radius: 1
Spec
Point light source : (draw a small sphere to represent the light source)
Position : (1.1, 1.0 , 1.3)
The color of the sphere : (0.4, 0.5, 0.0)
The radius of the sphere : 0.05
Keyboard control :
“1” : The parameter “Ks” decreases from 1 to 0 (Ks -= 0.1)
“2” : The parameter “Ks” increases from 0 to 1 (Ks += 0.1)
“3” : The parameter “Kd” decreases from 1 to 0 (Kd -= 0.1)
“4” : The parameter “Kd” increases from 0 to 1 (Kd += 0.1)
Spec
Phong Shading :
Ks = 0 (initial value)
Kd = 0 (initial value) Ka = 0.5 alpha = 3.6 la = (0.2, 0.2, 0.2) ld = (0.5, 0.5, 0.5) ls = (0.8, 0.8, 0.8)
Score
Ø1. Successfully draw a sphere and apply Gouraud shading on it. (70%)
Ø2. Switch to Phong shading (Use keyboard “B”). (10%)
Ø3. Use keyboard to control the Kd and Ks parameters. (10%)
Ø4. Demo (10%)
(We will ask you some questions about this homework)
Ø5. Bonus : (10%)
(1).Change to tone mapping (5%) (Use keyboard “B”)
(Set the threshold to map the color into 4 Intensity levels.)
(2).Add border enhancement (5%)
(Use keyboard “E” to enable and disable the border)
Example video
ØPhong shading ØPhong shadingGouraud shadingTone mapping
ØControl Kd and Ks ØBorder enhancement