I’ve been thinking about ways to do dismemberment and wounds in UE4, and since I’m not an artist, and UE4 doesn’t have the old UE3 bone-break system anyway, I decided to see if it was feasible to implement Valve’s Left 4 Dead 2 style dismemberment/wound system, which uses a shader based system.
The idea is to create an ellipsoid at the hit location, subtract out geometry around it, and spawn in an appropriate wound mesh. I managed to quickly build up a test using just a sphere, and a material which masks out the geometry around it. Here are the results, the material and how to use it, and a list of improvements to bring it up to snuff with Valve’s implementation. Some of this stuff is a bit hard for me (especially making wound meshes! So please any artists interested in an easy to use wound/dismemberment system, this could use your help), so I figured I’d release what I have and see if the community can help out to get something great for everyone, and improve all of our games at once
RESULT (notice the hole in the white-for-debug shirt)
How to use:
Download this project for an example: L4DTestWounds
You’ll need to feed this location with hit positions at some point, which will replace the socket location I have for testing there. You’ll also technically only want to set the hit location once, unlike what I have below which sets it on tick for testing purposes. To expand to allow multiple hits, add more vector parameters in the material, and do the same thing with the custom node with the new positions for each, then add them all together
Work to be done:
- Implement pre-skin position support, so that sphere/ellipse position naturally follows animated characters (this is key!) DONE!
- Set up the ellipsoid rotation/size DONE!
- Use the blood mask
- Draw blood layer
- Create wound meshes
- Get wound mesh spawning
- Support slashes in addition to holes (thin ellipsoid, needs different blood texture)
(Specific to your game)
- Pick slash or ellipsoid based on attack type
- Set slash/ellipsoid rotation based on hit direction
Edit: Update - This system is now implemented - pre-skin position support in the material. Blood mask and wound meshes are the last remaining step