nicer and faster SSAO

I had some spare time and inspiration from mtracer and Arkano22 and I made yet another Screen-Space Ambient Occlusion filter.
And there is a reason why I reinvented stuff that already exists and works.
faster - code kept as simple as possible.
more natural - samples are gathered circularly making occlusion softer, also AO is not rendered on lit and bright areas. In real life Ambient Occlusion is noticeable only in shadows.

Feel free to use and modify the filter…

screenshots:

http://img232.imageshack.us/img232/9620/ssao2b.jpg

http://img41.imageshack.us/img41/5364/ssao1.jpg

notice the difference in bright areas, where AO makes the light look dull.
http://img168.imageshack.us/img168/1295/ssao3.jpg

YouTube video:
(click on the image to view)
http://img717.imageshack.us/img717/8508/youtubeb.jpg

glsl frag. shader: http://www.pasteall.org/12299

blend: http://www.pasteall.org/blend/2442
latest version - (workd for ATI hardware)
http://www.pasteall.org/blend/2460
or
[ATTACH]103261[/ATTACH]

controls:
wasd+mouse - mouselook
LMB - shoots a sphere
1 - disables filters
2 - ssao+tex
3 - ssao+light
4 - plain ssao

Attachments

ssao_ati.blend (350 KB)

Looks more than awesome! It doesn’t work for me (Ati) the only version that works is the 4th (plain) and with that I get visual errors(picture)

http://www.abload.de/thumb/imaget1j5.jpg

those visual errors look really weird…
got any errors in console?
for each of the filters. that could help me fix it.

Nice work!
Some progress with the real motionblur?

This specific type of SSAO is extremely easy to use, just download the .blend, append the ‘Fx’ object into your game, and you’re ready to go, no additional setup and real easy to tweak when you find the values used for distance, power, and how dark a pixel must be for the effect to be seen.

It’s also very fast in 2.5.

Runs prety quick and the quality is very nice, thanks a lot for this, you help us a lot with your filters thanks!

My wow its very nice, my FPS count dont drop, thanks again, awesome filter!

Amazing! I’ve been looking for something like this. Runs well too!

gill

I can get “2nd” to work if I replace
luminance = clamp(max(0.0,…
luminance = clamp(max(vec3(0.0,0.0,0.0),…
This was at line 81 in the “ssao” page in the text editor window.
I had to save and reopen.
(I’m a noob at python coding btw.)

In general there are a few implicit int to float warnings that are easy to solve martinsh, but I’m having an issue with the ‘max’ function, since the debugger says that: ‘max’: no matching overloaded function found.
On SSAO: lines 66,67,68 and the max issue on line 81 (with a float to vec3 cast issue too).
On SSAO Light: on lines 65, 66, 67, and the max issue on line 79 (with a float to vec3 cast issue too).
Hope it helps.

I could get “2 - ssao+tex” to work by making a change to ssao in the text editor at line 81.
change:
luminance = clamp(max(0.0,…
to:
luminance = clamp(max(vec3(0.0,0.0,0.0),…
That is, “max(0.0” has to be changed everywhere it appears in the line to “max(vec3(0.0,0.0,0.0)”

I couldn’t figure any way to make game mode acknowledge this change so I had to save the blend then reopen it.
I get the little black dots, too. Also a textured cube I added didn’t seem to get the effect.

I’m using an old ATI card so I don’t have high expectations.

Well, it looks cool, but it doesn’t want to work on my computer.
I can run it in 2.49b or 2.50 and I still end up with this.

I also don’t get very good framerate.

Edit: Theres also no errors in the console.

Attachments



Ahh thank’s for the tip Martinsh I get this

the filter
Fragment shader failed to compile with the following errors:
ERROR: 0:81: error<#202> No matching overloaded function found max
ERROR: 0:81: error<#202> No matching overloaded function found max
ERROR: 0:81: error<#202> No matching overloaded function found max
ERROR: 0:81: error<#160> Cannot convert from ‘const float’ to ‘highgp 3-component vector of float’
ERROR: error<#273> 4 compilation errors. No code generated

This one should work also on ATI cards. Thanks guys!
http://www.pasteall.org/blend/2442
Thanks to Moguri, I included mouse-look script for Blender 2.5, just replace “Mouselook.py” to “Mouselook_2.5.py” in the Python Controller. Mouselook_2.5.py works also in 2.49 but due constant failure to import bge.logic it consumes quite alot of Logic, so I included both - 2.49 and 2.5 versions.

IAmThisGuy: I have no idea why it looks like that, seems like a Z-Buffer failure…

I also reduced sample count to gain performance.

as always…no result!

NOTE: ATI USER!

Yeah! It works, and how it works. I can fill up the whole thing with spheres (image) and it still runs with 50 FPS. This is unbelievable! I still get some artefacts but they are way smaller and way less frequent than before (red marked)

http://www.abload.de/thumb/imagekebw.jpg

Thanks Martinsh

Some problems on Ati HD3650m (no console errors)
http://www.pasteall.org/pic/2552

but Wow the video you posted looks so darn great! :yes:

Now I am on my dad`s PC with ATI HD 4650 and I am also seeing same weirdness. With some tweaking I have fixed these visual errors, though I have no idea what is causing it.

download:
http://www.pasteall.org/blend/2444
or
ssao_ati.blend (350 KB)

@diskette:
not yet. I have to bug some BGE devs to implement some stuff needed for motionblur…

wow, video looks great!
I hope I can make use of it in my next BGE game. I certainly adds a lot of beauty to any scene!

Thx Martinsh!!

Well, it’s probably my graphics card. I’ve been looking at getting a new one, so this just adds to the reasons.

Amazing Martinish!
truly amazing.
Can I use this in my project?
it looks EPIC with it!
http://i.imgur.com/44rRam.jpg
http://i.imgur.com/fbJEem.jpg
Dilopho DD