Graphics for Games CPI 411
2/18/2021
Solution of Assignment 1
• Section A (20)
• Section B (10)
• Section C (70)
– ShaderImplementation
– MultipleKeysinMonoGame – Tipsfordebug
2/18/2021
Variables
2/18/2021
Shader Data
2/18/2021
Gourand VertexShader
2/18/2021
Gourand Pixel Shader
2/18/2021
Phong Vertex Shader
• Other per-fragment shaders share this vertex function.
2/18/2021
Phong, Phong-Blinn, Schlick use the same vertex shader
Phong Pixel Shader
2/18/2021
Blinn Pixel Shader
2/18/2021
Schlick Shader
2/18/2021
Toon Shader
2/18/2021
Half Life Shader
2/18/2021
Half-Life Shader modifies the Diffuse!
Techniques
2/18/2021
2/18/2021
GAME PROGRAM
Variables (3D Basics)
2/18/2021
Variables (Controls)
2/18/2021
LoadContent()
2/18/2021
Update(): Easy Keycontrols
Game Coding: Simplify the code visually
2/18/2021
Update(): Hard Keycontrols
• Multiple Key Pressed Solution (+ Shift)
• One click condition
Game Coding: Simplify the code visually
2/18/2021
Update() Mouse Controls
2/18/2021
Update() : Camera & Light
2/18/2021 Vector3. Transform (point , Rx * Ry) ➔ Rotate a point in XY axis
Draw():
• Reset the Depth Stencil
• Set the BlendState to display 2D text
2/18/2021
Private Display Methods
Game Coding: Use (i++) to display lines to avoid editing the other parts
2/18/2021
Private Method for Debugging
2/18/2021
Game Coding:
Use only two digits on displaying the value
variable.ToString(“0.00”)