You can use the new ShadowDepthWrapper class to easily generate shadows for your custom shaders:
ShadowDepthWrapper
https://playground.babylonjs.com/#II3Z1J#3
See Custom shadows with ShadowDepthWrapper