I’m currently working on a system where if a player is stabbed or cut he starts to bleed from the injury, and that blood flows until it naturally stops or is bandaged. That blood can collide and leave marks in the world (on meshes or landscapes). The end effect is to leave blood trails for those who are injured, so you can damage players or NPCs (wildlife too) and track them over time for a stalking effect.
Here’s how I’m currently putting it together:
- I’ve built a semi-complex hitbox for custom collision around our character. It’s as simple as I can make it while still maintaining semi-realistic hit regions. It’s akin to the oldschool hitboxes that were first created during the old Counter Strike days.
- If you hit one of those boxes with something that deals cutting damage, a blood texture (which was previously alpha masked out) is now visible, and a GPU particle spawns that drips blood. The amount of constant blood loss given off by the GPU particle is tied to the amount of damage taken from the attack.
- If the hitbox that is currently “bleeding” collides with another static or skeletal mesh, the vertices of that mesh that were touching the hitbox unveil an alpha’d blood texture.
- If the GPU particle collides with any other mesh or the landscape actor, it leaves a blood decal on the point of collision, with the size and orientation of the decal corresponding to blood loss value of the GPU particle and the direction+velocity of the player’s movement.
- Blood eventually dries and disappears in the world environment, so old trails aren’t left for all time.
I’m bringing this up because as I work on this system I’m curious to know if any of you more knowledgeable and talented developers out there have better methods for achieving this effect.
- Are decals the only way to go on landscape actors?
- Is there a less expensive and/or more accurate way to handle “bleeding” collisions other than the oldschool hitbox?
- Has anyone had issues with registering collisions with GPU particles and actually using that collision data?
- Is there some way that decals could be just as realistic but less costly than adding a “blood” material layer to all static meshes and using dynamic vertex painting?
I’ll post pictures of progress if you guys can help answer some of my questions and I can move forward on a couple things. I might make the source available once I’m done if I have heavier support in its creation.