"Cavity" shader effect like Blender 2.8 viewport for Babylon.js?

Adding @RaananW for the XR part

The post process is in (ScreenSpaceCurvaturePostProcess) and will be available in the next nightly in the PG with:

https://playground.babylonjs.com/#YF8D42#4

The post process has both ridge and valley properties:

Do not hesitate to change adapt enhance. It is a direct copy of @Evgeni_Popov code :slight_smile:

5 Likes

Thanks everyone. I’m kind of amazed my little suggestion generated so much activity in such a short space of time. Awesome outcome!

When will it be possible to test in playground? :slight_smile:

It’s already in:

Clear the cache of your browser if it does not work for you.

4 Likes

Hi there.

For my scene I want both SSAO and SSC.

It works perfectly by employing the BJS’ original SSAO implementation. Please see see this PG.

The case is that, when I implement the same strategy with SSAO2 (in orther to gather a best performance and aesthetic, and byt the way a much less aliases) SSC is not shown, as you can check visiting this other PG.

Any help on it?

Thanks in advance for your time!

The SSAO2 implementation is using the pre-pass renderer by default, and it seems it is not compatible with SSC which is using the geometry buffer renderer to perform its computations.

I don’t know if it’s expected, maybe @CraigFeldspar will know.

A workaround is to force using the geometry buffer renderer with SSAO2 (5ith parameter of the SSAO2 constructor):

2 Likes

Thanks @Evgeni_Popov.

I see an even higher performance hit with this approach, but maybe I can live with it as my app doesn´t need a specially big FPS number.

Certainly, SSAO + SSC are the way to go in technical-look developments.

Maybe SSC should use prepass also for the 2 to be compatible, but for now @Evgeni_Popov’s workaround is definitely the way to go

1 Like

Hi there @CraigFeldspar and @Evgeni_Popov:

By the way, any advice about trying to make this SSC buffer renderer work with an animated camera imported from a GLB file. It throws the error: “TypeError: can’t access property “createDrawContext”, e is undefined”

Thanks for your time.

Can you create a repro in the playground ? it sounds hard to troubleshoot without it.

Hi there, @sebavan.

It must be other the cause of crashing my scene, as I’m prepared a fast and dirt PG and all seem to work OK there.

I’ll let you know as soon as I can dig a little more on it.

Thank you very much.

1 Like

Hi all - just trying this out in a pg, but it seems to crash everything. Any other way to achieve it or special settings?

I just added this one line:
var cavity = new BABYLON.ScreenSpaceCurvaturePostProcess(“cavity”, scene, 1, camera);

And the PG will crash.
Here’s a PG without the line: https://playground.babylonjs.com/#WF3VKZ#288

And here’s the PG with the line:https://playground.babylonjs.com/#WF3VKZ#321 (with enough reloading it eventually does something, but mostly crashes)

Weird - actually it seems to work sometimes, but then slows down chrome until it crashes - even if you close the browser window.

That said, it works a little weird. The effect is very pronounced - versus light bevel edges.

It works all the time for me, I tried reloading the page + clicking on the “Play” button several times and it always worked.

What I see:

same for me