I have been working on Source Engine from past few months with a wonderful team at Crowbar Collective on a project called BlackMesa. It is a remake of one of the best games of all time – Half-Life which was originally released in 1988. One of the things I have been working on from past couple of months is cascaded shadow maps.
Shadows are one of the most important aspects of making a virtual scene look realistic and making games more immersive. They provide key details of object placements in the virtual world and can be pretty crucial to gameplay as well.
SourceEngine (at least the version of the engine we have) doesn’t have a high-quality shadows system that works flawlessly on both static and dynamic objects. Even the static shadows from the VRAD aren’t that great unless we use some crazy high resolutions for light maps which greatly increases both the compile times and the map size. And shadows on models just doesn’t work properly since they are all vertex lit. So we needed some sort of dynamic and a very high-quality shadow system, which is something very common nowadays in a real-time rendering application or game.
One of the most popular ways of implementing shadows is through shadow mapping algorithm. CSM or Cascade Shadow Maps is the further extension of the algorithm to generate high-quality shadows avoiding aliasing artifacts and other limitations of vanilla shadow mapping. For more details check this.
Here’s a screenshot of one of the levels from the upcoming content update –
Cascaded Shadow Maps is so far the best solution to tackle Perspective and Projective aliasing in shadows. The basic idea is to use multiple shadow maps (mostly 3 or 4) to cover different areas of view camera frustum. The root cause of these shadow artifacts is lack of one to one mapping between shadow map texels and pixels on the screen (in view space). The Cascaded Shadow mapping provides higher resolution shadow maps to objects closer to the eye solving the root cause of artifacts.
(Screenshot – JustAnotherGameEngine)
Shadows are one of the key features for creating realistic and believable virtual scenes. Whether hard or soft or physically correct, shadows are very crucial in providing important visual cues. Shadows can be an important aspect of gameplay also. For example, it plays an important role in CounterStrike by allowing us to see enemies around corners, coming through doors, etc.
Real-Time Shadows is an active area of research. There’s still no single fool-proof technique of rendering shadows that can handle all the cases. Well, there exists a way to render high quality physically correct shadows through ray-tracing but that’s not fast enough to render in real-time on current hardware. So a better way to say this is that there’s no real-time hack of rendering high quality, flicker/ jaggies free, physically correct, etc shadows yet.