Is adding onAfterShadowMap RenderObservable possible?

I see in the 4.0 what’s new that we now have a onBeforeShadowMapRenderObservable, which is great.

So I was wondering, has getting very deep black shadows - especially in gltf workflow - could be impossible, if we can be able to use this to turn all scene to black/every-color-you-need just before shadows rendering, then come back to normal render.

I don’t know if this could even works, and it seems a little overkill for the performances :sweat: but I tried it anyway:

In both playgrounds I want yellow shadows, and I use scene.ambientColor for that, but I need my ambientColor back to normal when shadow computation is done, that’s why I’m talking about onAfterShadowMapRenderObservable.

Also… maybe the way I want to to this is totally wrong?

PS: the already existing onBeforeShadowMapRenderObservable is still not in the doc/api.

All in for the idea! Please open a repo issue and reference it from here :wink:

Job done! shadowGenerator: add onAfterShadowMapRenderObservable · Issue #6314 · BabylonJS/Babylon.js · GitHub

Will take care of it!

issue duration: 20 minutes. Nice :smiley:

1 Like

OK so my “hack” attempt doesn’t works at all :smiley:

1 Like

Hehe, the shadowmap does not contains colors but only depth values (distances from the light)

The shadowmap is then used during mesh rendering to evaluate if the light can reach each pixel