Particle collision point to UV

Here’s a fun problem I’m encountering with a pretty simple setup:

  • I have a shader that uses a heightmap to determine if a surface is covered in blood or not.
  • I have a particle system with collisions enabled that is reporting collisions.
  • I want to take that collision information and somehow get the UV coordinates from that. This is the tricky part because particle collisions are reported in worldspace.
  • After I do this, I want to paint the heightmap with white from a brush image so that point ends up covered in blood.

Now, I have a solution I might be able to hack together where I project a ray to the particle collision point and get the UV data that way, but this seems kinda janky. Is there a better way?

There isn’t a better way as far as I know.

I was worried about that. I suppose the easiest way to get accurate results is to get the normal of the collision and project the ray towards it from a position determined by moving away along the normal’s direction then?