Removing a limb by using a cutout shader.

Im trying to create a cutout shader that stops rendering a part of a model so it looks like is missing, the section missing is stablished by a 3d spherical body.

Also that section of the body that is removed is replaced by that same sphere rendered with is flipped normals only in the intersection, so it doesnt look like there is a hole in it.

Is a technique used by games such as left 4 dead, and the new MK, however I really dont know where to start in unity with something like this. Right now Im using strumpy shader editor to create my own shaders, but I dont know how to make them interact like this.

The version used in left 4 dead is explained in detail here. GDC 2010 Left4Dead2 Wounds | PPT.

So hmm theres no way to do this with unity? I was thinking maybe using Physics.sphereOverlap for starters

I would also like to know.

Well hopefully someone will answer but right now Im thinking on a work around, I was thinking in making the shader cutout (clip) a certain alpha value or color and have different mask textures per damage, so basically by applying a different mask to the material you change the damage in the body. (head off, arms off, etc.) I could even combine two textures so the damage is more varied. it may seem silly but it expends a lot less memory than having different models with damage.

The problem with this is that you still need a “cap” in the missing part or you will be able to see inside the body. One cheap way to fix that though, would be add some extra polygons inside the body so they are visible when the mask is on. Cheap but it could work.

Have you tried depth masking?

Now I only have one question, is there a way to paint the texture mask in real time? (modifying the texture)

What about projectors?