Character shadows
Add comment!November 13th, 2009
The existing Overgrowth shadows worked well for static shadows and ambient occlusion, but didn't have the detail required for character shadows. To achieve high-quality character shadows, we needed a new hybrid system. Here's a picture of the new shadows in action!
Some might complain that this is a waste of time at this point, but I need shadows in order to test out the physics appropriately. Without detailed shadows, it's difficult to tell whether or not objects are in contact with the ground. With shadows, it's much easier. Here's an example -- if you look closely, you might be able to tell if this physics object is touching the ground or not.
I say this is a hybrid system because it works using decals. I've already explained how the decal projection works, so now we just have to make the decal look like a shadow! To do that, we first take a picture of the character from the perspective of the light, and project it onto the ground.
Next, we remove the white so that only the shadow is visible. Despite its simplicity, it is already looking pretty shadow-like.
However, it's still too dark to match the baked shadows, so we have to make it more transparent. The shadow's transparency should equal the brightness of the ambient light.
There's still one small problem -- some areas are getting shadowed twice! To fix this, we can subtract the baked shadows from the decal shadows. Here's the finished composite:
This has the side effect of fixing a common problem with this kind of system -- shadows going through walls. Surfaces on the other side of the wall are always in shadow, so the second projected shadow is removed.
I thought that combining character shadows with our baked lighting would be very complicated, but it actually turned out to be fairly straightforward. We sure dodged a bullet with that one!
There are still some tricky shadow problems left to solve, including casting baked shadows onto characters, and handling multiple dynamic shadows overlapping. However, nobody seemed to notice that they were never solved in big titles like Halo 3 and Gears of War 2, so I think we can save them for later! For now, I can just use them to test out the physics and animation contacts.
These pictures were all taken on Hale's Riverhurst level because it provided a lot of complex spaces to test out different shadow situations. If you guys could make more levels, it would help us test out new features and optimize the engine!