Phong versus Screen-Space Ambient Occlusion (with source code)

Started by
18 comments, last by taby 8 years, 4 months ago
Here's an orange version of the SSAO.

This answer is weird because the generated texture from the SSAO is black and white because it's the occlusion value between 2 near geometries.

Advertisement


Which do you like better?

I prefer apples to oranges.


We have to say it's not physically correct to multiply them because it's an ambient value but it's the common trick to multiply after the lighting.
That will result to have the ambient occlusion visible even if the zone is lighted but it's an artistic value.

Yeah but nothing about SSAO is physically correct, it's an aesthetic hack. What we want is hemispherical occlusion applied to a GI light contribution, but here in the real world...

Do you have any URLs that demonstrate hemispherical occlusion?

Do you have any URLs that demonstrate hemispherical occlusion?

This is exactly what SSAO (screen-space ambient occlusion) does, I suggest you read or read again the chapter about it.


We have to say it's not physically correct to multiply them because it's an ambient value but it's the common trick to multiply after the lighting.
That will result to have the ambient occlusion visible even if the zone is lighted but it's an artistic value.

Yeah but nothing about SSAO is physically correct, it's an aesthetic hack. What we want is hemispherical occlusion applied to a GI light contribution, but here in the real world...

Do you have any URLs that demonstrate hemispherical occlusion?

You probably already understand it from implementing SSAO. Take a point on a plane - this point has a clear unobstructed view of "outside" from any direction on the hemisphere centered around the geometry normal. Now fold the plane at a 90 degree angle (so it defines a quarter space now) and take a point along the fold line. This point only has half of the available directions visible from outside and half occluded, so our hemispherical occlusion is 0.5. In the microfacet BRDF world, we describe this using the geometric occlusion term G. That's on a "micro" scale, whereas hemispherical occlusion is on a "macro" scale. Once you know how much visibility any point on the object has to infinity integrated across the hemisphere, you just multiply that by your GI term (or ambient, in the naive case) and there you go, real ambient occlusion.

In practice, real-time gives us neither the occlusion term nor a true GI term and so we use SSAO to come up with a cheap visually similar look. I believe you'll see a transition to true ambient occlusion in the next couple years, especially considering this seems to be in Unreal now:

https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/DistanceFieldAmbientOcclusion/index.html

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

Do you have any URLs that demonstrate hemispherical occlusion?


This is exactly what SSAO (screen-space ambient occlusion) does, I suggest you read or read again the chapter about it.

I'm pretty sure that we were talking about algorithms other than SSAO.

You can have a look at a visual representation of the SSAO algorithm (normal oriented) here :

fig4.jpg

It's an hemispherical test, you send multiple ray in a radius and then you normalize the result.

We have to say it's not physically correct to multiply them because it's an ambient value but it's the common trick to multiply after the lighting.
That will result to have the ambient occlusion visible even if the zone is lighted but it's an artistic value.

Yeah but nothing about SSAO is physically correct, it's an aesthetic hack. What we want is hemispherical occlusion applied to a GI light contribution, but here in the real world...

Do you have any URLs that demonstrate hemispherical occlusion?
You probably already understand it from implementing SSAO. Take a point on a plane - this point has a clear unobstructed view of "outside" from any direction on the hemisphere centered around the geometry normal. Now fold the plane at a 90 degree angle (so it defines a quarter space now) and take a point along the fold line. This point only has half of the available directions visible from outside and half occluded, so our hemispherical occlusion is 0.5. In the microfacet BRDF world, we describe this using the geometric occlusion term G. That's on a "micro" scale, whereas hemispherical occlusion is on a "macro" scale. Once you know how much visibility any point on the object has to infinity integrated across the hemisphere, you just multiply that by your GI term (or ambient, in the naive case) and there you go, real ambient occlusion.

In practice, real-time gives us neither the occlusion term nor a true GI term and so we use SSAO to come up with a cheap visually similar look. I believe you'll see a transition to true ambient occlusion in the next couple years, especially considering this seems to be in Unreal now:
https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/DistanceFieldAmbientOcclusion/index.html

Thanks for the info!

It's important to mention that the SSAO code doesn't run on Mac OS X... The code uses OpenGL 4.3 and Mac only supports OpenGL 4.1. Who cannot love SSAO???

Attached is the source code and sample files for the SSAO and Phong apps.

This topic is closed to new replies.

Advertisement