Goal
◆Implement 3 types of light sources: ◆ Directional light
◆ Position light (Point light)
◆ Spot light
◆Interact and modify the light source in runtime.
◆Finish the code in main.cpp, vertex shader and fragment shader
2
Assignment 2
◆Announce date: 2020/05/04 ◆Deadline: 2020/05/25 23:59(UTC+8) ◆Late work will be penalized by 20/week. ◆Copy & paste others’code will get 0.
◆Hand in your homework to ILMS in the following format(-10 for penalty)
◆ studentID_HW2.zip
◆ studentID_HW2_Report.pdf
3
In studentID_HW2.zip
◆ Depend on your device
◆ -10 for those upload “Normal Models”
For Mac
4
In studentID_HW2.zip
◆ Depend on your device
◆ -10 for those upload “x64” or “Normal Models”
Don’t upload!!!
For Windows Make Sure exe can run
5
Lighting Attribute Reference
◆ Directional light: ◆Position: (1, 1, 1)
◆Direction: always pointing at (0,0,0) ◆ Position(point) light
◆Position: (0, 2, 1)
◆ Spot light ◆Position: (0, 0, 2) ◆Direction: (0, 0, -1) ◆Exponent: 50 ◆Cutoff: 30 degree
6
Lighting Attribute Reference
◆ Diffuse intensity: (1, 1, 1)
◆ Ambient intensity: (0.15, 0.15, 0.15)
◆ Shininess: 64
◆ Attenuation:
◆Point light:
◆ Constant: 0.01 ◆ Linear: 0.8
◆ Quadratic: 0.1
◆Spot light:
◆ Constant: 0.05 ◆ Linear: 0.3
◆ Quadratic: 0.6
7
Key Mapping
- ◆ Please follow the spec bellow, or you would not get the score of item.
- ◆ You must make sure your key mapping is exactly same to ours.
- ◆ Z/X: switch the model
- ◆ T: switch to translation mode
- ◆ S: switch to scale mode
- ◆ R: switch to rotation mode
8
Key Mapping
◆ L: switch between directional/point/spot light
◆ K: switch to light editing mode
◆ J: switch to shininess editing mode
9
Key Mapping
◆If you switch mode by T, S, R
◆Apply change on Z axis when scroll the
wheel
◆Apply change on X axis when mouse drag
horizontally
◆Apply change on Y axis when mouse drag vertically
◆Only rotation should apply X axis when mouse drag vertically, and Y axis when mouse drag horizontally
10
Key Mapping
◆If you switch mode by K
◆Apply change on X axis of light’s position
when mouse drag horizontally
◆Apply change on Y axis of light’s position
when mouse drag vertically
◆Apply change on diffuse intensity for directional or point light, cutoff angle for spot light when scroll the wheel
11
Key Mapping
◆If you switch mode by J
◆Apply change on shininess when scroll the
wheel
◆The shininess is applied to all models.
12
Report
◆Some screen shot
◆Description of your program control
instructions
◆Other special things you have done
13



