Some info on the gore tech


A lot of people ask me how I created the gore system, and some even ask me to sell it as an asset. I don’t want to sell it yet because it would require some extra work, so I will instead share some info on how I started and explain some general things.

This is where I started some years ago: http://log.idlecreations.com/2014/04/chopping-up-rag-dolls-in-unity.html (search it up on the internet archive)

That page should give you some ideas about the complexities of mesh dismembering. For damaging surfaces, you want to learn about render-textures and shaders.

Implementing this system has taken me years of learning and lots of headaches. It is not easy by any metric. The code base is gigantic and complicated even for me. Expect to suffer a lot lol.

Actually, if I had to write it today, I would quit game dev for good given how insanely overengineered it is. I actually started it as a hobby project back when I was in cs grad, I had just learned how to program and wanted to test my “new powers”. So I was also playing RE2Remake at the time, and I was absolutely amazed by its gore system. I wanted to try implementing it myself, so I started learning basic game dev and here we are today.

I would recommend you implement a more ‘basic’ dismember system instead, like a Left4Dead 2 approach (shader-based clipping + gore caps to fill holes + spawn generic gibs to fake dismembering) - it’s pretty much the system that’s getting used everywhere nowadays because it is super scalable and easy to implement, and it also works better with memory and high-poly meshes (no need to keep copies of meshes like my gore system) and allows to keep low draw call count (due to no need to split the mesh into arms, legs, head, etc. - the entire model is rendered once for each pass).

Left4Dead gore system is so common nowadays that I have seen it implemented (with small variations) in the following games: Dying light, Dead Rising, The Last Of Us, and a bunch of others. It really is as simple as: shader-based hole (alphatested clip/discard) + gore cap to fill gaps + spawn fake gibs.

Anyways here’s some pretty raw info on my custom tech:

It is a mesh-based dismembering system. It pretty much supports any mesh, with a minimal baking process (I bake touching vertex data for some connectivity algorithms). Simple dismembering (breaking joints) happens in-mesh, meaning, there is no mesh/object duplication happening, but instead just bone-weight retargeting and triangle deletion (to get rid of the ‘stretching’ issue). I do this because it helps by not increasing drawcalls for each dismembered limb, which could help in a real game where most dismembering would be joint-based. Slicing and Exploding however require duplication/creation of objects. Slicing is super complicated - not only does it require entire mesh duplication, but also skeleton/ragdoll duplication. Exploding is also super complicated (and slow) because it is done in real-time and is fully dynamic. The gore-capping is dynamic and is done with a complex (and rather slow) algorithm I invented - it somewhat works by using bone-weight information to approximate the concavity of the damaged edge sections. Surface blood rendering is done using vertex colors and render-textures - they are read in the shader and used along with noise to render blood etc. Animated skinned-decals are super over-engineered - it works by copying the mesh inside the ‘decal box’ but instead of rendering it as normal mesh (using a gameobject etc.), it gets rendered to a render-texture instead, and then, this render-texture is read in character shader. This gives me the ability to clear and re-render decals over-time (which allows for animation). All the 3 types of dismembering (joint, slice, explode) require collider mesh regeneration. I borrowed a convex-hulling code from github (oskar quickhull3d) and optimized it to a burst-compiled job and boom, super fast. Most (if not all) of the dismembering operations are burst-compiled jobs running async actually. That is why performance is good. Most of the slowdowns come from GC (I am getting rid of them slowly) and reading/writing data from/to GPU (mesh updating operations). Ragdolling is done with a complicated skeleton system I have written - it works by separating animated bones from ragdolled bones and there is a lot of transform re-parenting and state management, and it is not very performant. I borrowed some code from a free asset/package I found on unity forum. By far I can say that this is one thing that I will probably have to re-write in the future.

That’s a lot of text, but it should help anyone interested in getting into this character-dismembering thing.

Get GutBox

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.