1001 shadows (almost)

· by Steve · Read in about 2 min · (415 Words)

I just finished integrating some new texture shadow projection types into Eihort. New this time are Uniform Focused and LiSPSM shadow projections, adapted from LordSteiner’s great patch. Most of the work was done early last week in fact, but I’ve been doing some refinement to make sure it was really ready for wider adoption. I changed the interfaces around a bit and made them a bit more configurable from the outside, and I also attacked some performance issues - I had also found that these two techniques were performing considerably worse than uniform and plane optimal shadows initially, more so than I would have expected. Although there is more work to do in terms of finding intersection volumes etc, I was seeing a frame rate drop from around 370fps to 220fps (40%!) when using either focused or LiSPSM shadows instead of uniform projection, which seemed far too much. The good news is that following a fair bit of effort with the help of the good old VTune, the difference is now narrowed to about 20fps (5%) which is acceptable to me.

Here’s a comparison showing the difference between the various texture shadow projections:

Shadow Types

Clearly uniform gives the least detail and plane optimal gives the best (although it can only be best for a single plane of interest). LiSPSM is generally the best all-rounder though, and if you combine it with Percentage Closest Filtering (I’ll save that for another time), it can look fantastic. Each technique one can be enabled and tweaked (warping factor for LiSPSM for example) either globally for all lights, or individually per light. New techniques can be plugged in very easily through more specialisations to the ShadowCameraSetup class. BTW the Plane Optimal basis and the pluggable shadow camera class approach was developed by one of my students (Hamilton Chong) during the Google Summer of Code. Here are a few full-size pictures:

I’ve used quite simple materials in those shots, I’ll save the swankier material integration for a later post. I still have more work to do on the shadows demo, I’m going to shoehorn in all the shadow material options next, adding depth shadow mapping, PCF and the custom 1-pass shadow shaders. I think Eihort users are going to be spoiled for choice when it comes to shadow options, making Dagon’s previously comparatively generous 4 options (plus material customisations) look quite modest. I’m going to have to rewrite the shadows section of the manual to take into account all the new features.