Game Development Community

not-quite-a-bug: SSAO not honoring the "ambient" in its name

by Manoel Neto · in Torque 3D Professional · 06/22/2009 (12:05 pm) · 15 replies

I know the SSAO will get a facelift, mostly due to being much more resource-intensive than it should be, but there's something else that bothers me.

Right now, the SSAO is applied *after* the diffuse and specular lighting are computed, when it should be applied *before* and affect only the ambient contribution. That why it looks out of place when its made too strong: because its darkening all lighting, which is incorrect.

I'm sure at least some of the devs are aware of this, but it wasn't anywhere in the forum, so here it is.

#1
06/22/2009 (12:28 pm)
You are totally spot on, Manoel, and the proper place to integrate this is in the vector-light shader where it will properly "occlude the ambient". I think this is on the ToDo list. Thanks!
#3
06/22/2009 (1:42 pm)
Let's try walking before we run, shall we? And while looking interesting, that technique furthers pronounces the limitations of the image-space: it makes it even more obvious that occluded surfaces have no effect in the lighting whatsoever.
#4
06/22/2009 (3:26 pm)
I have read that paper. It is a good research paper, but I don't feel like it is right for Torque.

I am interested to see what Crytek is presenting at SIGGRAPH. I suspect that they are using some kind of realtime ambient probes, and that (personally) is how I would implement this functionality.

Basically, this 'single-bounce' simulation is a subset of functionality that I would like to have in Torque anyway, notably the probe functionality. I would use the same method to do some dynamic reflection optimizations, as well as some experiments with lit particle systems.

If this kind of thing tickles your fancy, I suggest the paper on Imperfect Shadow Maps. I absolutely adore this technique, and I really wish that there was some more work done with non-triangle-based scene representation.
#5
06/22/2009 (10:15 pm)
First i do plan on reimplementing SSAO during the beta 4 phase.

I'll look at making it output to a half resolution stratch texture which we can sample from the light render passes.

Quote:That why it looks out of place when its made too strong: because its darkening all lighting, which is incorrect.
Well i think the biggest issue is that it darkens things to black.

I've been thinking that it would be fine to apply SSAO after lighting if it was lerping towards the scene ambient color in occluded areas.

Feel free to tell me i'm stupid on this one. :)

Quote:It is a good research paper, but I don't feel like it is right for Torque.

I agree... it looks more complex than it needs to be for the limitations it has.

I want to test out ArKano22's SSGI as it looks fairly simple and perfectly suited to our light prepass implementation.

Quote:I am interested to see what Crytek is presenting at SIGGRAPH
I'm planning to be there to see it first hand. I really hope its not static probes and requires a bunch of precalculations or artist placed sample points.
#6
06/23/2009 (8:02 am)
Quote:Well i think the biggest issue is that it darkens things to black.

I've been thinking that it would be fine to apply SSAO after lighting if it was lerping towards the scene ambient color in occluded areas.

Feel free to tell me i'm stupid on this one. :)
Well, if you insist...

*ahem*

That would make it even worse, because then it affect only the direct lighting. Might as well modify it into a dirt shader ;)

#7
06/23/2009 (1:27 pm)
I brought this up and made this point back when all of this was implemented. that you should never see ambient occlusion in areas lit by direct light. if you take the directly light and "not sure what the term in programming is but in compositing we call it screen" the two together and the use the result you will get a more physically accurate result.

Quote:I'll look at making it output to a half resolution stratch texture which we can sample from the light render passes.

please don't if it is going to make it look any more pixelated and fluttery than it already does.
#8
06/23/2009 (1:53 pm)
@ stephan ,

yeah that totally gets my vote. I think something similar to this is used is crysis warhead.
#9
06/23/2009 (2:17 pm)
@Manoel - I guess i see SSAO differently. I don't see SSAO as a physically accurate effect. So trying to use it to block just the ambient color of the scene, which is already a non-physical shortcut, as not the importaint bit of it.

To me the importaint bit of SSAO is that it removes the flat looking lighting and you can cheat a ton in lighting without the eye noticing.

Still as i said above... i plan on doing as Pat and others have suggested and sampling it from the vector light pass.

@James - My plan is to make it look as pixelated and fluttery as technically possible.
#10
06/23/2009 (2:20 pm)
@Tom
Super sweet!
#11
06/23/2009 (2:37 pm)
@Tom: I equate applying AO on top of all lighting (aka: the "beauty" pass) something as offending as watching stretched 4:3 content in 16:8, or the other way around. Or using Photoshop flares.
And I'm not alone.

Quote:@James - My plan is to make it look as pixelated and fluttery as technically possible.
The way it should be. You're redeemed.
#12
06/23/2009 (2:39 pm)
Heh. Some good discussion in this thread. The Imperfect Shadow Maps is an interesting read.

Since realtime SSAO is noise with blur, it's inevitably going to be inaccurate. Game rendering is about getting similar output with significantly less work. Though I agree if the order can be changed to increase the quality without much cost it's worth it.

I look forward to the PostFX improvements in the upcoming beta builds.

#13
06/23/2009 (2:56 pm)
@Manoel - Thanks for that link... i read it like 8 months ago and needed the refresher. ;)
#14
06/23/2009 (3:17 pm)
However the author of that article commits a fatal mistake: too much JPEG compression!
#15
06/23/2009 (4:40 pm)
I love it when i see artists putting normal maps in JPEG files. :)