Dynamic object opacity

I am setting up a material which lets me update its opacity based on the world space position of where it gets hit.

I am trying out the Sphere Mask and for a single hit it works so far.

What I would like to obtain is to hit an object and each time spawn a different Sphere Mask.
The problem is that the material is already generated.

A possible solution would be to “prepare” a set of SphereMasks and assign a value to each of them programmatically (using a circular buffer, maybe?).

Another solution, but I do not know if it is feasible, would be to somehow store the mask generated by the SphereMask in a buffer within the material.
This buffer would be multiplied or added by the current value of the spheremask.