Difference between revisions of "CISC440 F2019 HW2"
(→Required elements) |
(→Required elements) |
||
(One intermediate revision by the same user not shown) | |||
Line 22: | Line 22: | ||
===Required elements=== | ===Required elements=== | ||
− | Your job is to add code to the '''fragment shader''' (and possibly main.cpp) to implement the following features. Switch effects within your shader by choosing the "draw mode" keys indicated below. | + | Your job is to add code to the '''fragment shader''' (and possibly main.cpp and the vertex shader if it helps) to implement the following features. Switch effects within your shader by choosing the "draw mode" keys indicated below. |
* ''Modulate'' the color texture with diffuse lighting from a single point source representing the sun. The sun should be appropriately positioned to best demonstrate the effect. You may use OpenGL to define the light position and color and the material properties of the sphere, or just set them directly in your shaders. See [http://www.opengl-tutorial.org/beginners-tutorials/tutorial-8-basic-shading/ OpenGL tutorial #8] for how to do this. This effect should be '''draw mode 7''' [4 pts] | * ''Modulate'' the color texture with diffuse lighting from a single point source representing the sun. The sun should be appropriately positioned to best demonstrate the effect. You may use OpenGL to define the light position and color and the material properties of the sphere, or just set them directly in your shaders. See [http://www.opengl-tutorial.org/beginners-tutorials/tutorial-8-basic-shading/ OpenGL tutorial #8] for how to do this. This effect should be '''draw mode 7''' [4 pts] | ||
Line 34: | Line 34: | ||
===Graduate requirements=== | ===Graduate requirements=== | ||
− | Using the elevation texture, implement bump mapping ('''toggle with the b key while in draw mode 8 from above'''). This section is worth [ | + | Using the elevation texture, implement bump mapping ('''toggle with the b key while in draw mode 8 from above'''). This section is worth [4 pts] |
When in this mode, the entire surface of the earth should be specular -- not just the water. | When in this mode, the entire surface of the earth should be specular -- not just the water. | ||
You may use any method, but make sure to explain what you did in your README file. | You may use any method, but make sure to explain what you did in your README file. |
Latest revision as of 20:14, 2 October 2019
CISC 440/640 -- Computer Graphics
Homework #2
Due: Thursday, October 3
Description
In this assignment you will experiment with GLSL fragment shader code to obtain different lighting and texturing effects. Starter code for the portion of the assignment which must be completed by both undergraduates and graduate students is called multiearth. This program shows a rotatable, texture-mapped sphere representing the planet Earth as seen from space. By pressing keys 1-5, the user can switch between "draw modes" to show five different textures on the sphere:
- Land elevation (brighter = taller)
- Water
- Night
- Clouds
- Color (no clouds, water is one color)
Pressing key '0' will show the sphere as all red, with no texture. Pressing key '6' will demonstrate simple multi-texturing by combining the color and cloud textures. 'a'/'s'/'d'/'w' cause the sphere to rotate, and ESC ends the program.
In the basic program above there is no lighting--the sphere's appearance is completely determined by the current texture map.
Required elements
Your job is to add code to the fragment shader (and possibly main.cpp and the vertex shader if it helps) to implement the following features. Switch effects within your shader by choosing the "draw mode" keys indicated below.
- Modulate the color texture with diffuse lighting from a single point source representing the sun. The sun should be appropriately positioned to best demonstrate the effect. You may use OpenGL to define the light position and color and the material properties of the sphere, or just set them directly in your shaders. See OpenGL tutorial #8 for how to do this. This effect should be draw mode 7 [4 pts]
- Implement specular lighting with Phong shading (i.e., show per-pixel highlights due to the Sun) ONLY where there is water (draw mode 8) [4 pts]
- Show the night texture on the dark side and the color texture on the lit side of the Earth relative to the light position. Instead of having the Earth rotate, animate the light going around the Earth. Try to have a smooth transition at the border between the dark and light regions. You do not have to do diffuse or specular lighting in this mode (draw mode 9) [4 pts]
Please make use of functions for modularity to keep your shader code readable.
Include a README to explain your approach to each of these draw modes, and any difficulties or observations you had.
Graduate requirements
Using the elevation texture, implement bump mapping (toggle with the b key while in draw mode 8 from above). This section is worth [4 pts]
When in this mode, the entire surface of the earth should be specular -- not just the water.
You may use any method, but make sure to explain what you did in your README file.