Screen space ambient occlusion

Community Forums/Showcase/Screen space ambient occlusion

JoshK(Posted 2008) [#1]
Screen space ambient occlusion provides a rough approximation of real-time global illumination. It is fairly inexpensive to render and will run easily on shader model 3.0 cards and up. The difference in image quality is obvious between the SSAO-lit image and the image with direct lighting only.

Video here:
http://www.youtube.com/watch?v=j_98JDOmuhw




The r0nin(Posted 2008) [#2]
Very nice! Expensive (CPU/GPU-wise)? Complicated (or shader-based)?


JoshK(Posted 2008) [#3]
It's very simple and not very expensive to draw.


_33(Posted 2008) [#4]
Nice :P~~~~


Damien Sturdy(Posted 2008) [#5]
That's a nice little shader! "Do want!"


JustLuke(Posted 2008) [#6]
Yeah, very nice effect.


Ross C(Posted 2008) [#7]
Very sweet :o)


Ross C(Posted 2008) [#8]
Does that work on a vertex level? Or does it shade on a pixel level, like a lightmap? I don't know anything about that kind of lighting.


Grey Alien(Posted 2008) [#9]
Looks really good.


sswift(Posted 2008) [#10]
Do not want. On first glance it looks nice, but can't you folks see the halos around the pillars? It looks like the same sort of effect you get when running one of those fourier algorithms for deblurring images.

Also "direct lighting only" is misleading. It's direct lighting, but it's also only a single light source. That scene would look a lot better if you had more than one light source, and the ambient light level wasn't cranked up so high.

If the halos around stuff can be fixed then great, but if not this is worthless.

Also even in the crappy low res youtube video I can see all sorts of bad things happening in the cubes demo. The tops of half the cubes are dark even though they should be brightly lit.

Approximations are good and all, but not if they have really obvious visual defects.


Ross C(Posted 2008) [#11]
TBH, i only looked at the picture. The youtube video wouldn't load. I see your point sswift.


sswift(Posted 2008) [#12]
I found a page on Wikipedia syaing Crysis used this. I haven't played Crysis, but even the sample screen they showed in the article showed halos around the characters and even mountains in the distance being brightened by a tank turret which was close up and had a halo around it.

I also found this page which has a high res image of it in action on some cubes:

http://www.gamedev.net/community/forums/topic.asp?topic_id=463075

I think there may be a way to get rid of the halos, but it might be more expensive to render.

The last time I saw halos like this I was working on a sharpening algorithm, and they resulted from a step which required the scene to be gaussian blurred. That is unsharp masking. I fixed the issue by replacing the gaussian filter with a median filter which is median sharpening, and this looked much better. But the radiuses have to be small because a median filter also isn't perfect and will carve corners off things. I'm sure there's a way to filter things more like a median filter and without the corner carving, but I haven't discovered it yet and it's probably even more expensive than the median filter. But the median filter if done right isn't neccesarily much more expensive than the gaussian.

Anyway, I suspect that changing up how the z values are processed could get rid of the halos.


Mustang(Posted 2008) [#13]
This really can make things fit together nicely visually, and the best part is that it's dynamic - no need to use or pre-bake AO maps that are wrong the second you blow the crate elsewhere. Not true GI, but very good hack anyway.

It's boring to use Crysis for demoing every new-ish tech, but here we go again:

http://video.google.com/videoplay?docid=-2592720445119800709&hl=en


JoshK(Posted 2008) [#14]
I can eliminate the artifacts you mentioned. I just got this working yesterday.


puki(Posted 2008) [#15]
Nothing here that a vanilla Blitz3D installation cannot do - other than the shadows (unless you do them yourself).

Of course, you have to have meshes that are split into multiple objects to get really good dynamic lighting. One of the good uses of 'Deep Exploration'.

/me clutches Blitz3D and scampers off.


Panno(Posted 2008) [#16]
it looks cool , great @ Leadwerks


altitudems(Posted 2008) [#17]
With the advent of real-time lights and shadow mapping, I can see how this could really be beneficial to workflow. I don't think your going to want to make multiple light sources for nicely lit outdoor scenes when a SSAO shader can cheaply produce the same or better results automatically with one source.

I really like the effect and simplicity.
Create the your "sun" light source and move it depending on the time of day. All your shadows are updated and fake ambient occlusion happens also, no going through gile[s] again for the night scene.


Doiron(Posted 2008) [#18]
Do not want. On first glance it looks nice, but can't you folks see the halos around the pillars? It looks like the same sort of effect you get when running one of those fourier algorithms for deblurring images.

Actually, it's a cheap alternative to radiosity and widely used way before its realtime implementation. Simply put, the algorithm darkens the areas of the object surrounded by other geometry.

The artifact you mention depends on leadwerk's current implementation.

Probably the most useful shader you can have to enhanche your scene in conjunction with realtime lights (they replace the need for lightmaps altogether).


JoshK(Posted 2008) [#19]
AO and SSAO are independent of the actual lighting, so you could render an AO map in Gile[s] that would work for any static mesh. It would be more accurate than SSAO, but it would not work as well on dynamic scenes.

You can even calculate a lightmap with a few small lights in gile[s], and combine it with real-time lighting in my engine. That would be faster than rendering a bunch of really tiny lights in real-time.


Damien Sturdy(Posted 2008) [#20]

can't you folks see the halos around the pillars?


I see it, I look past it. It looks better. Can't you see all the computerised graphics in our computer graphics?


_33(Posted 2008) [#21]
Nice little article: http://meshula.net/wordpress/?p=145


caff_(Posted 2008) [#22]
Hmm - nice screenshot but the Youtube vid has been pulled.


JoshK(Posted 2008) [#23]
My visual objects were offset by half the dimensions of the physics objects. It made the visual objects interpenetrate, even though the physics was working fine. I took it down because it made Newton look bad due to a small mistake I made.


Gabriel(Posted 2008) [#24]
So is there a pre-processing stage to this at all or is the effect entirely run-time? I mean I realize it's dynamic, but is it along the same lines as Precomputed Radiance Transfer where you precalculate some information, store it either in a texture or in vertex data, and then combine that with the lighting information dynamically to get the scene lighting or do you only do dynamic calculation without any information stored in textures or vertex data.

Just trying to get a feel for how much data (if any) is precomputed and therefore how much extra data you've got to distribute.


JoshK(Posted 2008) [#25]
There is no precalculation or extra data involved. It just works on whatever you render.


taumel(Posted 2008) [#26]
http://rgba.scenesp.org/iq/computer/articles/ssao/ssao.htm


Loktar(Posted 2008) [#27]
Lol I thought this was for blitz3d at first was about to take my wallet out to buy the library. Looks nice.


_33(Posted 2008) [#28]
I guess if you have a fully working SSAO on SM 2.0, then you have pretty much every Direct X 9.0 card compatibility and advanced lighting possible :P Like Crytek as a matter of fact.


JoshK(Posted 2008) [#29]
Here's a shot under more realistic game conditions (thanks to Rich DiGiovanni). The pipes near the ceiling are unaffected by the direct light, but they have a nice soft global illumination appearance. I am very pleased with how it turned out.



Ross C(Posted 2008) [#30]
Ah very nice screenshot :o) Nice work man.


stayne(Posted 2008) [#31]
Whoah. NICE. Was there any post-processing at all with this image? The dirt on the floor looks burned in with PS.


_33(Posted 2008) [#32]
Impressive! Looks a bit Doom 3 ish with all that silveresque stuff, but the lighting is more refined here.


JoshK(Posted 2008) [#33]
That is pure realtime, 100 FPS, except for the logo which was added after.


caff_(Posted 2008) [#34]
Any chance of an interactive demo of this?


fredborg(Posted 2008) [#35]
It's looking nice, keep it up :)