Soft shadow maps in real time is computationally intensive and is often not feasible. Many papers have tried to address this issue by simulating soft shadows as realistically as possible and perform these operations in real time. Soft shadows are made up of umbra, penumbra, and antumbra, as shown in the diagram below.
Although I did not manage to complete soft shadows by the deadline, I did manage to create hard shadows using a three pass method described in the Algorithm section.
The general algorithm for shadowing is to run three passes as follows:
This project is written in C++ on Visual Studio 2008 Professional in a Windows XP environment. The project requires a graphics card that supports ARB_depth_texture and ARB_shadow extensions to display properly.
'P' or 'p' - Pause or unpause the timer and movement.
'1' - Skip the first pass (don't store a depth buffer).
'2' - Skip the second pass (draw only what is in the light's point of view).
'3' - Skip the third pass (draw everything in shadow only. Don't use the depth buffer).
'ESC' - Exit the program.
One problem I ran into is some of the computation for running part of the shadow mapping algorithm runs on a graphics card to run quickly, but this requires a graphics card that supports the computation used. My laptop and desktop did not have this, so I could only develop from an on-campus computer.
Another personal issue I had implementing the original program, packet-based hierarchical soft shadow mapping, is that I lacked the advanced graphics knowledge and experience necessary to implement the advanced rendering techniques.
One shortcoming of the above algorithm is that I am not sure how to modify the shadow map to get antumbra and penumbra shadows in soft shadows.
This was a fun and interesting project to perform and learn. I did learn a lot, but unfortunately I didn't I didn't learn enough to fully implement my project as I originally sought out to do. But I believe I should have enough resources to continue looking into soft shadows more.
One thing I learned is in relation to selecting a project in general. At first I was looking at three major different areas, and decided to focus on shadowing. What I didn't look into beyond that were the different types of shadowing methods available. The method I picked, hierarchical packet-based soft shadow mapping, was a very specific, narrow, and advanced solution. It was one that was beyond my ability with my limited knowledge of graphics to handle. What I should have done is looked at the various shading techniques, and selected a technique closer to my skill level. Or alternatively, implemented a simpler shading algorithm, to understand the basics, and then proceed into a more complex shadowing method that builds off of that.
The shadowing technique I learned is a general shadow mapping technique for hard shadows. I have been able to understand some of the high-level concepts of hierarchical packet-based soft shadow mapping, but I don't know nearly enough in OpenGL to implement such a project. I believed I could modify the hard shadow mapping technique to make a variant of soft shadow mapping. To some extent I managed to accomplish softer shadows, but not actual soft shadowing. I also expect the soft shadows implemented this way to not be as efficient as many other soft shadowing methods. However, it still allowed me to learn a significant amount about every GL call used in my program. I took careful care to read up the man pages for each call to understand how, to some extent, the depth-buffer was read, how the textures were applied, and how to define what is actually rendered in each pass.
Image display with soft shadows using our algorithm.
Image display without the first pass (not generating the depth map)
Image displwy without the second pass (Shows 3rd pass: displaying lighted regions, meaning only the regions seen from the point of view of the light source.
Image display without the third pass (Shows 2nd pass: displaying everything from the camera point of view, but shadowed).
The source files can be downloaded here. This includes code for a working hard shadow program with key controls, and a non-fully working attempt at the soft-shadowing approach using shadow mapping.