Announcement

Collapse
No announcement yet.

WIP - Dynamic Left 4 Dead 2-Style Wounds/Dismemberment

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    WIP - Dynamic Left 4 Dead 2-Style Wounds/Dismemberment

    Hello everyone!

    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)

    UPDAAAAAATEEEE!!!!







    How to use:

    Download this project for an example: https://www.mediafire.com/?bon59t6i0auhc62

    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
    Last edited by n00854180t; 12-24-2015, 01:31 AM.
    Storyteller - An immersive VR audiobook player

    Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

    #2
    Hi !

    this is really cool. I was currently messing around trying to create something similar to this.

    By following your exemple i was not able to get it to work. Could you check if your missing important informations ?

    how is the actual circle in the alpha is created ?

    i am sorry that i am not actually offering help but asking questions, but i have been looking for something like this for quite a while now

    Comment


      #3
      @Reboot - post some screenshots of your material and your setup for setting the hit position and I'll take a look and see if I can find any problems.

      Also make sure you replicated the "Custom" node with this code:

      Code:
      return length(actorpos.xyz - inp.xyz);
      Storyteller - An immersive VR audiobook player

      Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

      Comment


        #4
        Thank you ! here is some screenshots. my setup is a bit different as i am trying to make it work on a static object but it should be similar.
        Here is the material setup
        Click image for larger version

Name:	materialsetup.jpg
Views:	1
Size:	55.9 KB
ID:	1093584
        Click image for larger version

Name:	materialsetuppluscustom.jpg
Views:	1
Size:	326.0 KB
ID:	1093585

        My static mesh simple setup ( i added a socket named default)
        Click image for larger version

Name:	Socketsetup.jpg
Views:	1
Size:	211.3 KB
ID:	1093586

        My actor setup
        Click image for larger version

Name:	Actormeshandmaterial.jpg
Views:	1
Size:	142.9 KB
ID:	1093587

        and the blueprint setup
        Click image for larger version

Name:	Actorsetup.jpg
Views:	1
Size:	351.2 KB
ID:	1093588

        any idead what i am missing ?

        Comment


          #5
          I don't see anything wrong with your setup - it's probably assumptions on my end that ended up being wrong.

          Have you tried setting the HitPosition parameter in your material to a constant value? See if you can play with it until the dark circle appears in the mask node. Otherwise I'll probably have to play with it myself to figure it out.

          If you don't mind packaging up the project I'll be happy to take a look at it (or just moving the actor and the material to a new project and packaging that).
          Storyteller - An immersive VR audiobook player

          Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

          Comment


            #6
            How is the position determined ? From my understanding, the vector created by the linearColor is used as a position, and my quess is in Unreal units. i tried setting the vector on start to 0,0,0 , 0.5,0.5,0.5, 10, 100 100 100.
            My Cube is 1 meter height so i tried a bunch of value anyway.

            I uploaded the asset to mega, just click on download through browser, the file is only 307kb
            it is an actor, a static mesh, a material ans a material instance.
            https://mega.nz/#!A1ITHAoI!AyoKLg2LS...MkulX0aVN0uivA

            Comment


              #7
              Yeah it technically should end up being in the object's local space, in Unreal units. Your guess is correct.

              Probably something I did or didn't do in the material correctly.
              Storyteller - An immersive VR audiobook player

              Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

              Comment


                #8
                Were you able to download the files correctly ?
                I tried other things too and cannot figure out what could be wrong

                in the material, which kind of Param did you use ? i used a VectorParam.
                Also, how is the circle that appear in the opacity mask created ? the nodes in the material seems to only check the position and determine if it should be 1 or 0.
                Last edited by Reboot; 11-20-2015, 11:33 AM.

                Comment


                  #9
                  It makes the circle using the custom node that's returning the length between the two input positions.

                  I did download your assets and manage to get them to work in the editor, but couldn't figure out why it wasn't working. I'm going to take another look at my project here where I have it working and see if I can't figure it out.

                  If someone who knows more about materials wants to chime in with the right way to replicate what the paper is doing (texkill/clip on anything inside a certain radius of the point), please do I'm not the best at this.
                  Storyteller - An immersive VR audiobook player

                  Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

                  Comment


                    #10
                    So I think I figured it out - it seems to be a problem with the cube mesh itself. I tried the same exact code on the Starter Content cylinder mesh and it worked out fine. Also you can just directly pass a local-space position for Hit Position - no need to do Unrotate or subtract the world position as I was doing.


                    Try this project (mediafire link - 2mb project) and see if you can get it to work.

                    If you open up the blueprint you should see the hole appear at the bottom (0, 0, 0). I've set the Hit Position variable to (0, 0, 100) which is the top of the cylinder, so if you hit Play after loading the TestMap, it should move to the top. You can also click on the BP during runtime and change the Hit Position - it will update when you stop editing the values.

                    Here's a screenshot of the cylinder in the viewport in editor with the hole at the default position:


                    Here's a screenshot of the cylinder during runtime with the hole set to be at 0, 0, 100):
                    Storyteller - An immersive VR audiobook player

                    Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

                    Comment


                      #11
                      Hi n00854180t this is looking really good. I've been in several discussions about this topic myself and have plans to implement a Gore System using several techniques: Left 4 Dead, SoF GHOUL, Destructible/Fracture Meshes, and Collage Construction. I'm aiming for a Gore system suitable for a multitude of creatures of various shape and limb count. Perhaps use it to pull a similar effect to Mortal Kombat X Ray Attacks.

                      I'm under the impression L4D exterior wounds are 100% vertex shader manipulation with all the needed transparency, depth etc, to simulate filler 'caps' for the internals. There is no mesh swapping or spawning. I purchased the Advance Dissolve FX Kit for this purpose.

                      Your character appears to have separate clothing meshes. I believe L4D using single mesh body (base body + clothing). I would anticipate the technique being applicable to modular base body and clothing pieces, but I'm curious as to how you're going to approach it.
                      ExORION: The Most Active [Rev-Share] Sci-Fi FPS Project in this Forum ...Join the Fight!

                      Comment


                        #12
                        The cylinder needs guts!
                        My small game on IndieDB ****** Beams on Twitter ****** Beams on Steam ****** VideoStuff ****** PictureStuff
                        UE brings Math back into my life or i am not sure.

                        Comment


                          #13
                          Originally posted by TechLord View Post
                          I'm under the impression L4D exterior wounds are 100% vertex shader manipulation with all the needed transparency, depth etc, to simulate filler 'caps' for the internals. There is no mesh swapping or spawning.
                          Check out the white paper again - they made wound meshes in Maya using a high res mesh of interior organs which they projected onto a texture then formed around the high res geometry to give it shape. They definitely do some sort of wound-mesh spawning - the vertex shader only masks out the ellipsoid area (sphere for now in mine).

                          Your character appears to have separate clothing meshes. I believe L4D using single mesh body (base body + clothing). I would anticipate the technique being applicable to modular base body and clothing pieces, but I'm curious as to how you're going to approach it.
                          Since it all happens in local component space, as long as each material has the functionality and is being fed the same point, it should end up masking the same area. Plus the wound mesh would hide that area anyhow.
                          Storyteller - An immersive VR audiobook player

                          Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

                          Comment


                            #14
                            Hi !

                            I managed to get your latest exemple to work. i believe the issue was the scale of the object or something in the material. It's simpler now and it works.
                            I played around with it and made a linetrace where my cursor is aiming to help with the debugging.

                            How were you planning on doing multiple hit ? the only thing i can think of that would work in blueprint would be a predetermined array of hitposition.
                            I did some research on if it's possible to "save" the result to a texture and update it constantly but no luck so far.

                            Comment


                              #15
                              Yeah basically if you want multiple hits, you just need to add more Hit Position parameters to the material, and then duplicate that whole section of code, and then add the resulting masks together before plugging it into the opacity mask.

                              Edit: To make it easier, you might set up a material function with all the code from where it takes the hit position parameter, to where it wires to the opacity mask. Then just set up extra hit position parameters, wire them into their own material function for the mask, and then add all the outputs and wire it to the opacity mask.

                              Since it's just simpler math save for length (and you could optimize it by using length squared and then just passing smaller amounts for the size, which is the multiply node there).

                              -------

                              As an aside, if someone can figure out how to make these masked areas follow an animated mesh properly, and/or set up the ellipse generation, I'd be eternally grateful. And as a reminder, artists capable of making wound meshes are also much needed!
                              Last edited by n00854180t; 11-21-2015, 03:45 PM.
                              Storyteller - An immersive VR audiobook player

                              Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

                              Comment

                              Working...
                              X