( previously discussed over there, but for clarity moved here. )
there’s this very efficient global illumination technique out in the wild called ‘Ambient Occlusion’. it is successfully implemented in a bunch of games now and you can find a lot of code samples on the web.
as far as i can tell, screen spaced AO is the way to go, as dyanamic AO is even harder to implement. some links:
it would be wonderful to have this bleeding edge realtime render technique in vvvv. should work with easily with 30fps on a recent graphic card. i’m absolutely not into shaders, so could only go a few steps with the help of a friend.
there’s also a fake ambient occlusion technqiue that is a lot cheaper but faster and easier to write. it’s called ‘Depth Darkening’ and described here.
we’ve started to write a hlsl shader for it. the first results look like this:
so it somehow works but there are still problems with the edges etc. i’ve atteched the code, maybe some of the shader cracks can have a look at it, so a working DD shader would be a first start to have SSAO some day. horray.
I’ve never heard of AO before
From what I can discern, it seems to be related to generating shadows by darkening pixels which have a depth significantly greater than their surrounding pixels.
This definitely sounds like a multipass shader (wink wink to the devs), but should be wholly realisable in vvvv.
I’d do it by rendering a depth buffer and feeding that into a shader which can sample surrounding points on the depth buffer (e.g. 5 in each direction) and assign a darkening factor based on the gradient of the depth buffer.
That said, it’s probably a good idea to start with a div shader (a shader which performs the vector ‘div’ function) on the depth buffer, and clamp each sampling so that only +ve depths are counted (since objects behind dont contibute to a negative shadow, only objects in front contribute to a positive shadow)
Also some clever blurring would be useful, but you’d need to make sure to only blur along the correct depth. In order to do that it might be good to have two channels being output from the modified div shader: shadows and depth. Then blur the shadows channel and depthtest the shadows against the original image.
aren’t there two ones in your office in berlin?
*a very tall one speaking some strange dialect and
*a not so tall one brumbling some strange math-theories (…nobody except himself understands…) into his beard?
yes, its too slow… i will compare my code with kalles link and try to find the speed improvement. but first i have to move to berlin. rrrr aren’t you in the praxisberlin too? we can have a look at it then…
this is a proof of concept copy/paste-job from a relatively new SSAO implementation as initially posted by ArKano22 on gamedev.net. looks quite useable, check the ready-to-use module in the attachment.
there is still room for improvement though, especially with the global illumination technique that yet needs a better compositing mode with the original. also later in the thread ArKano22 postet a rendermonkey document that still could be compared for further source improvements.
here is Joreg’s great patch/shader a bit modified. i added a bilateral blur filter, which prevents blurring across object edges (as good as it gets) and to get rid of some artifacts. also tried a noise texture with higher resolution for slightly better ao quality. performs quite well on my machine (Core 2 Duo E7400, 260 gtx), just try…