Points casted shadows not updating when using a ShaderMaterial


I’m using a ShaderMaterial to animate the points of a Points object

var particles = new Points(

If I set this Points object to cast a shadow, it only casts the static shadow of the geometry, and doesn’t take into account the movements of the vertices created by the ShaderMaterial.

From what I’ve read, I understand that I need to create a customDepthMaterial or a customDistanceMaterial shader, dependending on what light I’m using, as specified in threejs documentation. But I’ve no idea how this shader should work.
The documentation mentions that those materials should be use for the depth map, but I don’t understand how the depth map is involved in the making of shadows.

Can somebody share some advice / documentation / example about this?