Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Do you apply SSAO to rendered image or to ambient light term only?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

Poll: SSAO (25 member(s) have cast votes)

Do you apply SSAO to rendered image or to ambient light term only?

  1. Rendered image (4 votes [16.00%])

    Percentage of vote: 16.00%

  2. Ambient light term only (18 votes [72.00%])

    Percentage of vote: 72.00%

  3. Other (3 votes [12.00%])

    Percentage of vote: 12.00%

Vote Guests cannot vote

#1 Prune   Members   -  Reputation: 218

Like
0Likes
Like

Posted 21 February 2014 - 02:15 PM

While it seems to me SSAO shouldn't affect direct lighting, I've seen examples where it's just done as a post-process and multiplied to the final color buffer. I'm guessing one reason is convenience, at least with forward rendering, since if you don't have the depth buffer from a Z-prepass, then you can't sample the SSAO until after rendering. In terms of looks, in scenes mostly lit by direct lighting, I guess the SSAO would have little effect, which is the downside of using the more realistic ordering.


Edited by Prune, 21 February 2014 - 02:16 PM.

"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)

Sponsor:

#2 MJP   Moderators   -  Reputation: 11585

Like
2Likes
Like

Posted 21 February 2014 - 05:23 PM

In terms of looks, in scenes mostly lit by direct lighting, I guess the SSAO would have little effect, which is the downside of using the more realistic ordering.

 

That's not a downside, it means it's being more accurate. Light with strong directionality should only be occluded by blockers found in that direction. SSAO (and other forms of ambient occlusion) will darken areas with high overall occlusion, even if the light can perfectly hit those areas based on the location of the light. A good example would be a crease in the corner of a room: SSAO will make the crease dark, but if you shine a flashlight right on the crease it's actually quite bright. Thus you achieve more "correct" results by only applying ambient occlusion to the ambient term, since typically the ambient term consists of lighting from many directions.

Trust me: you really don't want your game looking like someone outlines your characters with a permanent marker. It's not a good look. tongue.png



#3 Krypt0n   Crossbones+   -  Reputation: 2602

Like
0Likes
Like

Posted 21 February 2014 - 05:49 PM

It probably depends how you interpret the ambient occlusion. it's not a mathematical or logically defined tech, it's rather a cheat to fake lighting effects that are hard to do in real time. while you can make assumptions on what 'would be correct', you should apply it in the way it looks best, 'cause that's what really matters in the end. if your direct lighting is "correctly" not affected bei AO, but looks totally plain, then try to tweak your AO to make it look better.

 

if you look at the original ssao http://en.wikipedia.org/wiki/Screen_space_ambient_occlusion you also see they don't just do darkening of corners, but brightening on edges. while some say this is 'wrong' it gives plain ambient (shadow) areas some kind of "lighting" instead of just one boring ambient color intensity with dirt in the corners. (and they were for sure not just too stupid to make a "saturate(intensity*2)" in shader to remove the brightening effects.)

 

so, do what looks best and if you make a pool for the decision, then show us some screenshots so we could compare what looks nicer to our humble eyes ;)



#4 MJP   Moderators   -  Reputation: 11585

Like
8Likes
Like

Posted 22 February 2014 - 12:45 AM

it's not a mathematical or logically defined tech

 

AO is very clearly defined, mathematically-speaking. Lambertian diffuse is computed by integrating lighting * occlusion * cos(theta) for all directions about the hemisphere, and AO approximates this by integrating the lighting and occlusion factors separately and then combining afterwards. The fact that it's an approximation doesn't mean that we can't reason about when it makes sense to apply it, and what will produce results that best simulate real physical phenomena. 



#5 Krzysztof Narkowicz   Members   -  Reputation: 1202

Like
0Likes
Like

Posted 22 February 2014 - 06:22 AM

Applying SSAO only to ambient is a correct way to go, but it also requires an interesting and strong ambient term. In last game I did something in between those solutions. I just scaled SSAO strength depending on the lighting strength. This way SSAO was stronger in shadows, but less visible when light was shining directly on the surface.


blog | twitter | "Don't have any friends? Still a virgin? Programming is for you!"


#6 kalle_h   Members   -  Reputation: 1474

Like
0Likes
Like

Posted 23 February 2014 - 08:25 AM

How about do you apply SSAO also to ambient specular or just diffuse part?



#7 Krypt0n   Crossbones+   -  Reputation: 2602

Like
0Likes
Like

Posted 23 February 2014 - 11:18 AM

 

it's not a mathematical or logically defined tech

 

AO is very clearly defined, mathematically-speaking. Lambertian diffuse is computed by integrating lighting * occlusion * cos(theta) for all directions about the hemisphere, and AO approximates this by integrating the lighting and occlusion factors separately and then combining afterwards. The fact that it's an approximation doesn't mean that we can't reason about when it makes sense to apply it, and what will produce results that best simulate real physical phenomena. 

 

you define Lambertian lighting, by using occlusion and say occlusion is defined? I think that's not the way definitions work in math.

 

but you are right, AO approximates occlusion, and that was my point also. if you had a specific light source, you could separate lighting from occlusion (in that case it's commonly called shadow or radiosity map) and we'd all follow well defined algorithms.

and if there would be a clear definition of AO, then every tool should generated the same results, but the results of AO baking (and even in interactive rendering) varies a lot.

if you'd just go for the generic occlusion (aka not per light), indoor would be always just black. that's why baking tools usually have some tweaking values to set the range you sample the occlusion and in what way the angle/distance/density will be mapped to 0-1 and depending on how you apply those baked maps, artist will tweak the maps in a different way.

It's even more vague in screen space effects.

 

that's why I'm suggesting to go for the optically most wanted results than for some theoretically most convincing argument that looks inferior. We can somehow define what we want to achieve, but we strive into approximations, into theories and it ends in a pool about what most think would be best in theory. what if the 'best' we vote looks worst in the game he makes?

 

That's why I suggest to vote for the visually nicest results and he should post the 3 versions (probably just a change of 3 lines of shader code).



#8 Krypt0n   Crossbones+   -  Reputation: 2602

Like
0Likes
Like

Posted 05 March 2014 - 05:49 AM

just stumbled across it, interesting real world reference regarding the correctness of AO and SSAO, IMHO, so I thought I'd share it:

http://nothings.org/gamedev/ssao/



#9 Prune   Members   -  Reputation: 218

Like
0Likes
Like

Posted 05 March 2014 - 01:47 PM

just stumbled across it, interesting real world reference regarding the correctness of AO and SSAO, IMHO, so I thought I'd share it:

http://nothings.org/gamedev/ssao/

Fantastic link--thanks! I think directional AO methods like SSDO would probably show more realistic results. But the main take-away for me is that the reason SSAO makes things look good even though it's not realistic (as shown by this article), is simply that it adds more shading detail, which is still lacking in real-time renders. Until we have fully dynamic GI that is not just low frequency, as is the case with current real-time methods, the SSAO fills in for the the high frequency GI, the finer details, even though it's unrealistic.


"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS