Is there any way to mask out portions of a material without creating ghosting when other objects move in front of it?

I can seem to find a good way to mask the material shown in the images, the smaller the holes become the worse the ghosting becomes. Is there any way to use masks without this occurring?