How could I make NME material work with SSAO2?

Hey guys!

I wanted to address a small issue regarding SSAO2 render pipeline. I want to use it as a solution for some fake shadows in my scene. However, I noticed that SSAO2 seems to ignore my node material, in the sense that it does not produce the ambient occlusion effect around objects that have NME created material.
Any other material seems to be successful in rendering the screen space ambient occlusion (even when I select Default Fallback or none).

Do you have any ideas on this, please?

Here is my scene:
Office Node Mat | Babylon.js Playground (babylonjs.com)

I have also attached a screenshot below.

One thing that I would have tried is to go in debug mode and compare these two different materials side by side, but I can’t seem to “debug mode” the Node Material.

Thank you so much!
Florin.

Welcome aboard!

You have to use the PrePassOutput block and set the viewDepth and viewNormal inputs for SSAO to work.

Here’s an example:

PG: https://playground.babylonjs.com/#S2LLHM#1
Node material: https://nme.babylonjs.com/#1MC9FC#2

2 Likes

Oh, so we don’t have prepass output by default in Node Material.
Amazing! I’ll look into this, thank you very much, Evgeni!

Hi @Evgeni_Popov ,

I tried to get IblShadowsRenderPipeline working with Node Materials using the same approach, but unfortunately I wasn’t able to make it work.

Is this a known limitation, or does it work differently and require other settings or a different setup?

Thanks in advance.

Best regards,
David

Hi David,

Unfortunately, IblShadowsRenderPipeline doesn’t currently support Node Materials, and the approach used for SSAO2 (with the PrePassOutput block) won’t work here because the two systems apply their effects differently.

SSAO2 is a full-screen post-process — it only needs geometry data (depth, normals) from the prepass, which PrePassOutputBlock provides. The occlusion is then composited over the entire frame.

IblShadowsRenderPipeline works differently: in addition to reading geometry data to compute the shadows, it also needs to inject shader code into each material to apply the shadow factor. This is done through a material plugin (IblShadowsPluginMaterial), which modifies the material’s fragment shader at specific injection points. Currently this is supported for PBRBaseMaterial, StandardMaterial, and OpenPBRMaterial.

Node Materials have a fundamentally different shader architecture — they generate their shader source code through the node graph at build time, bypassing the plugin injection system entirely.
Because of this, the shadow plugin cannot inject its code into a Node Material’s shader, and the pipeline silently skips Node Materials.

This is a known architectural limitation rather than a configuration issue, so there’s no workaround with the current setup.

1 Like