Home > Graphics > Percentage Closer Filtering Shadows

Percentage Closer Filtering Shadows

In my experience with graphics, the most dramatic change introduced to a game’s look has to be shadows. Shadows change the perception of the viewer and add a lot of depth to the scene (literally, it’s much easier to infer depth!). In Bear Pile, we added shadows partially to fix some game design issues that we had with jet-packing bears. Players would complain about not being able to know when a bear was going to land, or, since the bears flew quite high sometimes, they would also complain about not even knowing there was a flying bear. This issue was mitigated with shadows, and in my opinion it even intensified the action.

Percentage Closer Filtering (PCF) shadows are a variation of shadow maps that involves blurring the samples. PCF is more than just a screen space blur, as the blur respects how far the object is from the viewer, and furthermore PCF can be extended to support more realistic variable umbrae and penumbrae. The basic idea is that when sampling the shadow map, instead of just sampling at one position, many samples can be taken around the same spot and an average can be determined.

Because these extra samples are often taken in a predictable way, noticeable artifacts may arise due to the uniformity. One technique used to mitigate this is to randomize samples taken so that the human eye won’t notice. This is the technique we used in Bear Pile, and it’s used in other popular games like Crysis.

In the below video I show off my implementation of shadow mapping and PCF. It’s hard to tell that I’m adjusting the PCF filter because the video is so compressed and grainy, but while I’m running the demo I change the shadows dynamically from hard to soft shadows.


Categories: Graphics Tags:
  1. No comments yet.
  1. No trackbacks yet.