Soft Shadow Mapping

Travis Dean
CSC 572 - Graduate Computer Graphics
Spring 2010
California Polytechnic State University San Luis Obispo

Description

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. Diagram of umbra, penumbra, and antumbra. Image from wikipedia.

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.

Algorithm

The general algorithm for shadowing is to run three passes as follows:

  1. Render the scene from the point of view of the light and store a depth map.
  2. Render the scene from the point of view of the camera and color everything as though it were shadowed.
  3. Render the scene from the point of view of the camera and color everything according to the depth map if it is in the light's line of sight.

Implementation

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.

Keyboard Controls

'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.

Problems

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.

Conclusion/Results

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.

Images

Image produced with algorithm.
Image display with soft shadows using our algorithm.

Image produced without the depth map from the first pass.
Image display without the first pass (not generating the depth map)

Image produced without the shaded regions from the second pass.
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 produced without the lighted regions from the third pass.
Image display without the third pass (Shows 2nd pass: displaying everything from the camera point of view, but shadowed).

Downloads

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.

Resources

  1. Soft shadow mapping
  2. OpenGL Geometry Shader Marching Cubes
  3. Packet-Based Hierarchical Soft Shadow Mapping
  4. Paul's Projects Shadow Mapping
  5. Soft Shadows with VSM
  6. Shader Series
  7. Robust Soft Shadow Mapping with Backprojection and Depth Peeling