SSAO using line integrals

Started by
15 comments, last by PixelSmasher 11 years, 9 months ago
Hello everyone !

I am currently implementing the SSAO technique used in Toy Story III in my rendering pipeline.
This technique is thoroughly described in the slides from Siggraph 2010.

I had no problem implementing it, until I met an annoying banding issue, due to a high occlusion factor appearing on certain edges of the meshes, mainly on concave shapes.
After several days of eye-bleeding and struggling with black lines, I've come to think this is a natural flaw from this algorithm but would the wisdom of gamedev have any idea about how the guys from Toy Story solved it ?

Thanks in advance.

PS : this capture shows the problem in action : the SSAO quality is quite good (without any filtering) but the arches suffer from banding.
CJQjz.jpg
Advertisement
Apply a depth aware (bilateral) blur over it, and you're sorted :). You have to do that with most SSAO techniques due to the limited amount of samples you can take during occlusion computation.
I intentionally disabled the blurring passes to show the banding artifact.
Even if the filter is applied, the black lines on the curved surfaces remain (blurred of course but still present).
Edit: Incorrect post.
The bands indeed appear specifically on edges between non-coplanar surfaces.

I thought about using the normals to discard edges forming an angle bigger than a given threshold, but I don't want to access the normal buffer to keep good perfs (and the Toy Story guys didn't use it after all !)
Intuitively the bands are suppose to exist there. The problem is how intense they should be.

I'm not quite sure in the specific line integral implementation, but ambient occlusion should be with calculated using projected solid angle (i.e. cos(theta)/ndotl). Is the toy story slide accounting for the projected solid angle? It seems that they use occluded volume / total volume for the AO value.
The line integrals method doesn't rely on the classical "ray-casting(-marching)" inside a sphere.
Here the volume integration is based on the contribution of the heightfield (the depth buffer) to the sphere volume.

Simplified, the formula looks like this

ao = 0
for each Samples
{
Sample.contribution = (Sample.depth - SphereCenter.depth) * Sample.volume
ao += Sample.contribution
}
// + insert fancy code to offset/scale the ao into [0,1]


As you can see, the notion of solid angle (or angle itself!) doesn't exist here.


I'm currently trying to detect surface continuity using cheap normal reconstruction but I'm getting cheap results unsure.png

The line integrals method doesn't rely on the classical "ray-casting(-marching)" inside a sphere.
Here the volume integration is based on the contribution of the heightfield (the depth buffer) to the sphere volume.

Simplified, the formula looks like this

ao = 0
for each Samples
{
Sample.contribution = (Sample.depth - SphereCenter.depth) * Sample.volume
ao += Sample.contribution
}
// + insert fancy code to offset/scale the ao into [0,1]


As you see, the notion of solid angle (or angle itself!) doesn't exist here.


I'm currently trying to detect surface continuity using cheap normal reconstruction but I'm getting cheap results unsure.png

Using projected solid angle makes obstruction near the horizon not matter much. In your case, you're having problems with slightly concave areas, which is essentially obstruction near the horizon. Not saying that projected solid angles will fix the issue, but it at least exaggerates the issue.

Anyways, using projected solid angle is similar to weighting slight obstructions (angle(n, l) approaches pi/2) less than big obstructions (angle(n, l) approaches 0).
Weighting slight obstructions is achieved by the value attributed to Sample.volume (used before in the algorithm)

Sample.volume is the volume of the sphere above and below the area that the sample covers (search for pretty Voronoi pictures in the slides)
The further the sample is from the center, the smaller is the sphere height and so is the sample volume.

Edit : I may have misused these weights. I'm going to explore in that direction.
Imagine the shading point as being on the geometric boundary. As we decrease the angle between the two sides (i.e. fold it like a book), sphere obstruction (analytical) increases linearly. The ambient occlusion doesn't.

This topic is closed to new replies.

Advertisement