Light Prepass Cascaded Shadow Mapping, continued
Ah... shadow map filtering, I didn't know before that there's a lot of them. (The screenshot were using a 512x512 resolution shadow map to easy compare the various filtering I implemented.) In my older screenshots, I'm using the 5x5 PCF (middle) ( short for Percentage Closer Filtering) which, of course better in smoothing out the shadows but the heaviest of all implementation I did. The 4 Tap PCF (left) is the fastest but the ugliest, not very nice if your shadow map resolution is low. I also tried Gaussian blur and random filters(not in screenshot). I also tried non PCFiltering like Variance Shadow mapping but considering I'm doing Cascaded Shadow Mapping, VSM has a bigger memory appetite considering it needs two channels to store depth and depth*depth. Which brings me to my own implementation.
Similar to what I've been doing in the past, and sometime good at it... I dub or name stuffs. I dubbed my implementation as 8 Tap O-PCF or Occasional-PCF. It may sound funny but thats only half of the point. My real point or reason why I name such is because how it self-optimized itself. Let me explain: (inhaled intensely)
The square first 4 tap of 8 will have enough information to proceed with the other 4 taps. By dissecting the texel into 3x3, the center is literally ignored due to the fact that the size and amount of the texels sampled are enough already. Sampling is basically 1/3 of the texel around the texel and should not go outside the texel. The wonderful thing about this is that I'm only sampling 8 times but only the first 4 if shadow test failed. If you closely examine its inner penumbra of the shadow, you'll notice the smoothness of the penumbra, almost to that point it appears to be using a higher shadow map resolution. Of course the outer penumbra will still be jagged but hey considering the 3 tones I added, and the edge are lightest, with a good Depth of Field, this will even look like 2048x2048 shadows. I like the flexibility of this filtering, much so that it can fake shadow bleeding already, beating the soft PCFs in terms of speed and control. So there you have it 8 Tap O-PCF... sounds like those nifty items in Monkey Island like Mug O'Grog or Spit O'Matic. Just say, 8-Tap-O'Pac-eF.... (windblowin tumble weed) ...nah that was corny. Ha!
I wouldn't say I'm finish with this topic... cause definitely, I'll be revisiting this when the renderer is formalized. Next stop, Dual Paraboloid Shadow Mapping for our indoor and outdoor shadowing daily needs.
Comments
Thanks!!
I'll post a deeper explanation about this eventually.
But the overview explanation is...
Sample the by 1/3 of its size on 8 directions of a texel(North, South, East, West, NW, NE, SW, SE) but not decreasing its sample size.
The O-Tap there is do the diagonal direction first(NW, NE, SW,SE) (or you could use the axis direction N, S, E, W). You do this first for your common shadow test in normal PCF. If PASS, then you do the next 4. If you notice, I ignore the center sample, it is because the the total 8 taps have enough sampling to have the center.
Anyway, I hope to write a short paper on this. Maybe after all of my pending tasks are done.
Cheers!
[0,0][1,0][2,0][3,0][4,0]
[0,1][1,1][2,1][3,1][4,1]
[0,2][1,2][2,2][3,2][4,2]
[0,3][1,3][2,3][3,3][4,3]
[0,4][1,4][2,4][3,4][4,4]
And if I PCF sample exactly at [2,2] I would get only the center pixel's shadow value, but if I sampled at [2.5,2.5] I would get a quarter of [2,2], [3,2], [2,3], and [3,3].
So, if I understand, you are suggesting I first take four PCF samples, at [1.5, 1.5], [2.5, 1.5], [1.5, 1.5], [1.5, 2.5], and finally [2.5, 2.5]??
And then, based on if I find any shadow coverage, I then add four more samples?
Thanks!!
[1.5, 1.5], [2.5, 1.5], [1.5, 2.5], and finally [2.5, 2.5] (I mistakenly listed [1.5, 1.5] twice!)
sorry for the late reply.
Yes, you are correct. The first four offsetted then the 2nd for diagonal to the first.
As you can see, it is self-Optimized. I don't know if you can, but if its possible post your results. I appreciate any feed back on this. Thanks!