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.

2 Likes

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

Is the ‘official’ version of the new ssao shader for engine v2 anywhere I can get it yet?
(Asset store version was last updated 4/18/2023)

It’s this script you need to add on your camera:

1 Like

Great. Thanks! :slight_smile:

But what is a .mjs script and how do I make that compile in PLaycanvas …and then attach it to the camera?
It doesn’t seem to appear in the dropdown where all the other.js scripts appear. Renaming doesn’t seem to affect it either.
??

Cheers

It works as other scripts. Just click on Parse button on it to parse it.

1 Like