Blood Effect

Hi,
I’m implementing the “Decals” effect to simulate stuff like blood that appears on the walls and so on.
My question is: what is the way to clip these “Decals” when they are partially out of a polygon?
Thanks in advance.