How to project a material(decal) to a certain depth based on input vector(light)?

I’ve made a decal material to represent the caustics of water, I want it to change with the light source of Sun (& Moon if possible), now I’ve done the part of measuring the difference between water material normal & light vector input, so as to illustrate the light of caustics, but I still don’t know how to project it into correct depth of underwater rockbed, and to project it into correct relative position between caustics decal and water surface. So I’m wondering if there is a way to control the position of my decal material based on how the light vector input is and how deep is the rockbed from water surface?

I mean, I don’t quite understand how to control the relationship between material and the mesh that use it.