pygfx icon indicating copy to clipboard operation
pygfx copied to clipboard

Post-Processing Pipeline: Access to a Normal Buffer for SSAO

Open drlukeparry opened this issue 2 months ago • 3 comments

I was looking into write a SSAO post-processing effect with the new EffectPass API that has been implemented recently. For the conventional SSAO approach, in order to produce the occlusion component, we would require the surface normal to be provided as an input buffer from the previous rendering phase.

Is there a way to configure this to be exported within the Renderer pipeline at this stage?

Many thanks, Luke

drlukeparry avatar Dec 05 '25 21:12 drlukeparry

Well, the approach you are describing requires a g-buffer, as in deferred rendering, correct?

In pygfx we are currently doing forward rendering, so I don't think this is the right approach.

Maybe you can investigate if there are forward rendering compatible variations on SSAO?

Or alternatively you can point out how my understanding is wrong? :)

Korijn avatar Dec 05 '25 21:12 Korijn

That is a very helpful suggestion. I am not at all an expert with graphics programming, and for some time wanted to implement the effect to improve scientific visualisation, so I have been trying to find a solution how to achieve this with PyGFX.

The guidance is appreciated. I will look at forward-rendering approaches to see if this can be achieved an alternative way instead 🙂

Thank you, Luke

drlukeparry avatar Dec 05 '25 21:12 drlukeparry

Some cursory research indicates it's possible to reconstruct normals from the depth buffer at the cost of some precision. We do have the depth buffer available. Maybe this will allow you to implement SSAO as a post processing effect?

Korijn avatar Dec 05 '25 22:12 Korijn

See #1254

Korijn avatar Dec 22 '25 00:12 Korijn