The following 3 tasks should be implemented in OpenGL and presented. They can be implemented as 3 different programs or all in one. For more help and a project to start from see the Theory page.
Deadline is March 31st. Extensions can be given to students who has got at least one of the tasks approved before that date.
Task 1
Implement a pair of vertex/fragment shaders that shades a model by calculating the Diffuse part of the Phong reflection model using Phong shading.
Task 2
Draw a cube with a texture applied to each side. Use the same source texture for all sides but change the appearance of the texture depending on the normal direction for the cubes side or by sending different attribute values for each sides.
On one side of the cube:
- Convert the textures color value into greyscale.
- Implement a Gaussian blur of the texture.
- Invert the color. (White – color) = inverted color.
- Use the texture coordinates as red and green colors instead of sampling a value from the texture.
- Draw the texture at twice the frequency. So the image will show up 4 times on the side instead of once. It’s simply a multiplication of the texture coordinates with 2.0 and using repeat as texture parameter.
- Only render odd or even pixels from the texture. Use black color on the other pixels or skip rendering it totally.
Task 3
Implement a shader pair that can render several instances of an objects at different locations. Use matrices as uniform inputs for the vertex shader to define position and orientation of the objects. Use a special matrix called viewmatrix to specify the location of a camera.
Render at least 2 instances of the object (cube?) that are visible on the screen.