Realtime SSAO?

Hi, anyone have any clue how I could possibly add real time ambient occlusion? …and if one exists somewhere would it work on mobile?

Cheers

Hi @Grimmy,

In the PlayCanvas engine repo you can find a very good SSAO implementation (copy/paste your script in your project, parse it and the ssao effect to your active camera):

Here you can see it run live, among other effects: PlayCanvas Examples

But I wouldn’t use such a heavy post effect on mobile. Usually I would bake ambient occlusion offline and use it as a texture on the material on the Ambient channel.

1 Like

Great. Is that a javascript or a shader? I tried dragging on to the camera as a regular script component but its doesnt seem to work.

It’s JavaScript, it should work if you parse it first. Try adding a script component and find the ssao script and add it.

image

1 Like

I know this is an old thread but I found a different ssao here which to me looks better and has far more control. How would I implement that example in the editor?
It looks like it use something here: /static/scripts/posteffects/posteffect-ssao.js but where can I get that script?

Cheers

You cannot use it in the Editor yet, it’s coming with the engine 2. We’re aiming to add support for engine 2 in the editor in about a month, it’s in the works.

In saying that, if you need it urgently, you could find the implementation here:

which also uses these for blurs:

and port it to the current SSAO script:

but that’d need some non-trivial changes.

1 Like