From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

GSoC 2013 BGE Shadow Improvements

For the Google Summer of Code two new shadow techniques were worked on, as well as some minor improvements to existing shadow options. These changes have been committed and pushed to a Blender Git clone on Github [1]. These changes still need some work and testing to ensure they are of high enough quality to be included in Blender's Trunk.

Point Light Shadows

Support for shadows cast by point light shadows has been implemented. This implementation uses a technique called virtual depth shadow cube texture (VDSCT) and indirection cube maps. VDSCT allows the simple shadows to continue using depth textures instead of color textures to help maintain performance. The point light shadows also work for variance shadow maps, however they do not work with blurring variance shadow maps use to achieve soft shadows, and therefore the blurring step is skipped when using variance shadow maps with point light shadows. This feature is mostly complete, though some working on sharing indirection maps and memory management may still need to be done.

Cascaded Shadow Maps

Cascaded shadow maps is a shadowing technique in which the viewing frustum is split into multiple parts. The sun's shadow frustum is then fit to each of these parts and renders out a shadow map for each frustum part. When doing shadow testing the correct shadow map is read based on the fragment's distance from the viewer (which split it fell in). This techniques help shadows cover large areas with fewer artifacts.

The implementation of this technique for Blender's sun shadows is still incomplete. The splitting of the view frustum, the multiple shadow render passes to a texture atlas, and the fitting of the sun's frustum to the frustum part are all working. However, the shadows still cause some problems in the viewport. The shadows can completely disappear based on the current selection, and don't work well unless the user is viewing the scene from a camera. Furthermore, there appears to be some slight miscalculations as the multiple shadow maps don't line up as well as they should (produces a bit of a wobble in straight shadows).

New Light Options

A few new options have been added to allow more user control of shadows.

  • Front Face Culling can help reduce artifacts by not rendering front faces during the shadow pass. However, with this option enabled, if a part of an object is only front facing (such as a plane) that part of the object will fail to cast shadows.
  • Soft Shadows have already been available on variance shadow maps. This option simply gives the user the flexibility to disable the blurring step used to create the soft shadows to improve performance.
  • Low Percision makes the variance shadow maps render into a lower precision image format (RG16 instead of RG32F). This can improve the performance of variance shadow maps, but causes some artifacts. These artifacts become significantly less noticeable by increasing the bias value.