

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Due date: November 18th, 11.59.59 pm
Delivery: Source code and screenshots to [email protected]
Problem: Using the template provided on the course webpage, implement a shadow mapping algorithm for one shadow casting object – the tiger and one or more shadow receiving objects – walls, floor, etc.
Shadow Mapping: Shadow mapping is a shadow generation technique we covered in class. The provided template contains a sample solution for projected shadows and its main purpose is to demonstrate usage of OpenGL framebuffer objects and multi-pass rendering. You will have to modify this template (including c++ code and shaders).
In order to complete this assignment, you need to implement a 2-pass shadow mapping algorithm as described in course notes.
Recommended steps:
Review the code in detail. This is the first time you’ll be using framebuffer objects and multiple rendering passes in this class. Make sure you understand the design and implementation of the FBO class and how it’s used. Analyze the shader code and understand it.
Make sure you understand the shadow mapping algorithm. You’ll have serious difficulties implementing it if you don’t understand every single details of it. Decide whether you want to implement the eye-space or the clip-space version of the algorithm.
Start the implementation by setting up your environment and lights. One light is enough to see the effects, but you need to set up the geometry properly in order too see it. I suggest you use a spot light for this, or at least a point light with a direction vector. Next, I would suggest that you create a wall behind the tiger model and a floor below it. This step is again very important, because otherwise you might have a correct implementation of shadow mapping, but you will not see anything because of inappropriate geometry setup. Before you move on to the next step make sure you can render your scene with some simple shading, see everything and have an idea of where the shadow should appear.
Implement the first rendering pass, i.e. shadow map generation. You will do this by projecting the tiger model using light’s position and direction in the vertex shader and by outputting eye-space or clip-space depth values in the fragment shader. When you’re done, make sure you verify that you’re getting the correct output. You can do this by saving the generated texture to a file, using the CTexture::SavePPM method. PPM files are viewable in any standard viewer, e.g. IrfanView.
Implement the second rendering pass. You don’t need to worry about self-shadowing, i.e. the tiger casting shadow on itself. Only render the tiger’s shadow on surrounding geometry you set up in step 3, i.e. walls, floor, etc. Make sure you understand clip-space to texture-space transformation in this step. Don’t forget about z-bias.
BONUS : Bonus (25%) will be awarded for implementation of percentage-closer filtering (PCF). In contrast with the traditional technique described above, this technique blurs shadow edges by sampling the shadow map at multiple locations and averaging their contributions by taking depth discontinuities into account. A great overview of this technique can be found in GPU Gems 1.