Difference between revisions of "CISC440 S2023 HW2"
(→Required elements) |
|||
(One intermediate revision by the same user not shown) | |||
Line 26: | Line 26: | ||
* 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 (one orbit per 5-10 seconds). 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 7''') [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 (one orbit per 5-10 seconds). 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 7''') [4 pts] | ||
− | Graduate students must do all 3 elements below, while undergraduates may pick ''2 out of the 3'' | + | Graduate students must do all 3 elements below, while undergraduates may pick '''any 2 out of the 3''' |
* ''Modulate'' the color texture with diffuse lighting from a single point source representing the sun. The light position should move as in the previous section. 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 8''' [4 pts] | * ''Modulate'' the color texture with diffuse lighting from a single point source representing the sun. The light position should move as in the previous section. 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 8''' [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 9'''). Again, the light should be orbiting the earth [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 9'''). Again, the light should be orbiting the earth [4 pts] | ||
− | * Integrate an animated fragment shader of your choice from [https://www.shadertoy.com www.shadertoy.com], [www.glslsandbox.com www.glslsandbox.com], etc. (similar to but not the same as the one in the texture_example program shown in class on 2/24) that works over the ''water surface'' only of the earth while in draw mode 8 (water is still specular). The effect should turn on or off by toggling the 'b' key. This section is worth [4 pts] and will be scored for creativity and complexity. | + | * Integrate an animated fragment shader of your choice from [https://www.shadertoy.com www.shadertoy.com], [http://www.glslsandbox.com www.glslsandbox.com], etc. (similar to but not the same as the one in the texture_example program shown in class on 2/24) that works over the ''water surface'' only of the earth while in draw mode 8 (water is still specular). The effect should turn on or off by toggling the 'b' key. This section is worth [4 pts] and will be scored for creativity and complexity. |
Please make use of functions for modularity to keep your shader code readable. | 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, particularly for the animated fragment shader option. | Include a README to explain your approach to each of these draw modes, and any difficulties or observations you had, particularly for the animated fragment shader option. |
Latest revision as of 08:21, 6 March 2023
CISC 440/640 -- Computer Graphics
Homework #2
Due: Friday, March 17
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 (you will probably need to change the line #include <glfw3.h> to #include <GLFW/glfw3.h>). 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.
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.
Required elements
Both undergraduate and graduate students must do the following:
- 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 (one orbit per 5-10 seconds). 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 7) [4 pts]
Graduate students must do all 3 elements below, while undergraduates may pick any 2 out of the 3
- Modulate the color texture with diffuse lighting from a single point source representing the sun. The light position should move as in the previous section. 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 8 [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 9). Again, the light should be orbiting the earth [4 pts]
- Integrate an animated fragment shader of your choice from www.shadertoy.com, www.glslsandbox.com, etc. (similar to but not the same as the one in the texture_example program shown in class on 2/24) that works over the water surface only of the earth while in draw mode 8 (water is still specular). The effect should turn on or off by toggling the 'b' key. This section is worth [4 pts] and will be scored for creativity and complexity.
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, particularly for the animated fragment shader option.