Welcome aboard!
I did not find a simple way to do it…
A somewhat complicated way to do it:
- use the
shadowGenerator.onBeforeShadowMapRenderMeshObservableobservable to know which mesh is about to be rendered in the shadow map - use the
shadowGenerator.onBeforeShadowMapRenderObservableobservable to bind the clip planes to the effect of the mesh that is about to be rendered if it is the sphere - you need to override
shadowGenerator._isReadyCustomDefinesto set the clip planes on the scene if the mesh which is about to be rendered is the sphere
Here’s the PG:
For demonstration purpose I have added a cube which is not impacted by the clip planes.