It seems to be working... but only apparently. Why are all the surfaces which have the normal perpendicular the viewer line-of-sight (that is, surfaces that are NOT facing the the viewer) darked ??
I noticed this thing to be present in many implementations.
The problems is less noticeable here, but still present:
This addresses the problem nicely:
Obviously, in Crysis the problem is totaly absent (you can check it out on youtube)
2 ---- Sampling details -----
As far as I noticed, a problem in some implementations is the one showed in this picture:
F is the current fragment
S is the point to sample
Problem is that zbuffer(F) = zbuffer(S) + D
=> z(F) > z(S)
If one evaluate the occlusion contribute as the difference between z(F) and z(S), the more the plane is inclined, the more self-occlusion he will get.
To resolve this, just use z(A) instead of z(F)
Another interesting thing is this: the normals contribute.
Why to use it to modulate the occlusion value ?
3 ---- Filtering -----
People tend to use a standard gaussian blurring. But it will lead to wrong results. Take a look at this picture:
With a gauss blur, the right side would become smoothed. The white area is gonna become gray, and the gray area will become brighter => bleeding.
The answer is to use a bilateral filter.
Do you think a BF is too slow ?
How is your implementation?
Does someone have any suggestion ?
4 ---- Boundaries -----
For fragments near the border of the frame buffer, some samples can go beyond the boundary.
How do you address this ?