Quote:Original post by B_old
Are you saying that offseting the dotproduct by a fixed amount should have the same effect as offseting the occluded point depending on its distance from the eye? Or should the offset also be relative? Currently I have no access to my development-stuff during weekends, but I will give this a try tomorrow.
If you subtract an amount from the dot result, it has the same effect as what you´re doing, yes. Take a look at the new version i posted, the bias is implemented that way. Tinker around with it and you´ll see how it works.
Quote:Original post by B_old
So 360 / samples is correct?
No, for it to be correct it would be needed to calculate the angle of a fixed-length circular arc, and based on that length, change the rotation angle. That would make the samples evenly spaced.
Quote:Original post by ArKano22
Actually I have another question about this, because don't really understand whats going on. Most SSAO-shaders I've seen shoot rays in a sphere around the occluded point, reversing the sign for rays that point away from the occluded normal. So in the end you have hemi-sphere of rays. But you seem to be shooting rays all around. Why does it work?.
All the info you need to calculate occlusion is in the buffers. Sampling around a sphere works when you think more in 3D, but ssao is just an advanced edge enhancing effect, a 2D filter. You need to know relative position and normals of pixels. If a pixel is near other and they´re facing each other, they are occluding each other, else they´re not. My method works by just sampling around and deciding how much each sample occludes the current pixel. Since i´m using position and normals instead of only depth, i have more information available so i don´t need to sample in 3D and project or stuff like that.
When implementing the blur in the new version i realized it´s not different from a bilateral filter in the sense that you are taking samples around and using their normal/position difference to calculate something: in the case of bilateral blur, it is blur weight, in my case, it is occlusion.
Because of this and the existence of pseudo-separable bilateral filters, i still hope that my ssao can be made separable as well. No luck yet :D.
EDIT: I´ve made a pair of diagrams to try to explain it better. I´m not very good at drawing but maybe they will clarify things a bit:
Traditional occlusion traces rays in a hemisphere, projects to screen and compares depths:
My ssao (point-disk now...i don´t know how to call it anymore) uses the
distance between the occluder and the current pixel (d) and the angle between the normal (N) of the current pixel and the
vector from the pixel to the occluder (V) to calculate an occlusion value:
In this image you can see that, if you move the occludee in the direction of the normal, the angle between V and N increases. That is the same as substracting the "bias" value from the dot product, which is what i do. In the old version i used the occluder´s normal too, but it is not really necessary.
[Edited by - ArKano22 on March 14, 2010 9:36:29 AM]