I found out my issue; I prefer not telling you what it was in order to have some remaining credibility
Hehe no issues, I suspect people can find many bugs and stupid oversights in my code on the Gems 3 CD for instance
- if I don't use the second (negative) bound, what effect might appear (to see if I actually need it)
You can get similar artifacts to those of Exponential Shadow Maps. In particular, you may get blockiness (extra light) on the edges of objects onto which shadows fall. In the general case, complicated geometry over big filter sizes may cause significant aliasing.
That probably doesn't make a lot of sense, so here's an example:
Using just the positive warp/estimator (with c around 40) yields the following... notice the artifacts where the shadow gets near to the edge of the building roof:
Now using both warps/estimators (with c around 40 for each), the artifacts can be fully removed:
Basically the bigger that "c" gets on the positive warp, and the larger filter regions you have, the worse the artifact can be. The negative warp can help a lot with this (as seen above)... it's not perfect of course, but it eliminates many of the artifacts of the positive exponential warp (or ESM) and costs very little other than additional storage (4-component vs 2). Still, if you're using say 16-bit float textures and a small c (around 10) the artifacts may not be bad enough to warrant using the negative warp.
For reference,
here's what ESM degrades to the in the case of very complicated occluder distributions (compared to PCF and VSM). Note that EVSM (not shown) does a fair bit better but naturally still has artifacts. In these situations, opacity shadow maps or convolution shadow maps actually do the best job, as they model the visibility function directly (rather than the occluder distribution) and interpolate that smoothly rather than necessarily trying to reconstruct all of the discontinuities. Hence why I say that CSM is more interesting as a shadow method for volumes, hair, foliage or other complicated distributions than standard opaque occluders.
- concerning the log filtering, from what Mintmaster says, the shadow gradient might look less smooth (or less linear) when large kernels are used. In my case, I generate mipmaps, which means, if I understand correctly, that very large kernel might be used. Would it make sense to try to implement the log filtering ?
Not quite true... what Mintmaster is saying is that using *linear* (hardware) filter to interpolate values in a *logarithmically-stored* (i.e. storing c*x rather than exp(c*x)) shadow map will produce non-linear shadow edges. However, he notes that if most of your filter support is computed in log-space (correctly), the error of simply using hardware bilinear filtering isn't that large. However for *small* filters (3x3 blurs say), the error will be more noticeable.
This is actually even more true for hardware anisotropic filtering, which I totally love when using with shadow maps (it makes them look so good!). However if this is used with a log-space shadow map he error can be quite noticeable, producing shadows that are much darker than they should be and indeed reintroducing aliasing at highly-anisotropic angles. I don't have any handy screen-shots/vids of this in action right now so you'll have to take my word for it
In simpler terms, with log-space shadow maps you are doing the filtering yourself... you generate your mipmaps in log space (manually), you blur in log space and you do your trilinear interpolation in log space. What Marco (nAo) is saying is that if you use the hardware to incorrectly do the trilinear lookup in linear space, the error isn't that bad, particularly for large blurs. Whether or not that's true is up to you to decide... I personally don't like how much it messed up aniso filtering, but honestly if you're going for a really soft shadow look, it's probably not an issue. In any case it's easy enough to implement a manual bilinear/trilinear filter in log space and compare it to just flicking the hardware switch to see whether the latter is acceptable quality for you.
sorry if my questions sound stupid... I am not mathematician but try to have a working implementation
Not at all - I now have a masters in math and still have to think this stuff through and play with it a lot. Your questions are not stupid; you just happen to be speaking with three of the people who have worked on this stuff extensively!