Announcement

Collapse
No announcement yet.

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

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

    #16
    Hey guys, so I figured out a workaround to get the hit location into the local space of the mesh, so that animations don't cause the "hole" to shift around.

    If you use the location of a socket, then inverse transform it by the skeletal mesh's transform, and set that as the location (no unrotate or anything) it will move with the animation at that socket. You can use an offset to change the location a bit without it ruining the effect.

    Getting the forward/right/up vectors and the radius/length of the capsule in there is the next job.

    Edit: Got up/right/forward vectors into the material, and tested a janky wound mesh for the neck area.
    Last edited by n00854180t; 12-09-2015, 10:02 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


      #17
      Made a gore mesh for the neck in Sculptris, and set up a test using new ellipse settings.



      To get it to look 100% right in motion without hacks, it will need some engine changes - namely being able to get the pre-skinned vertex position.

      Here's more information:

      Originally posted by xulture View Post
      Heya, I think its possible by editing Engine/Shaders/GpuSkinVertexFactory.usf -- this is where input vertex position gets skinned and changed to the new position. Function CalcWorldPosition() does that by calling SkinPosition().

      You'd need to extend struct FMaterialVertexParameters to include this new value (pre-skinned vertex position, say call it PreSkinnedPosition) and relevant parts of the code to propagate non-skinned values.

      After that you'll be able to access it in VertexShader (not in pixel shader, without further changes), via custom node, and reference to Parameter.PreSkinnedPosition. So only nodes plugging into CustomizedUV0..6 or WorldPositionOffset will be able to access it, but you can use CustomizedUV's to transfer positions and access them in PixelShader.
      (Eg save X and Y of PreSkinnedPosition as CustomizedUV1 X and Y, and save Z into CustomizedUV2's X).

      A bit involving but possible.

      Note that editing these shaders usually kicks off full recompilation of all shaders each time you restart engine, and it will crash it if you make errors that prevent compilation of core materials.

      See https://docs.unrealengine.com/latest...ent/index.html
      Unfortunately I don't think I will have time to work on that for a while, and will just be using hacky workarounds with the current system (i.e., base the position off of a socket).

      If anyone wants to take a stab at that, that would rule, and is essentially the main thing left that's missing aside form more wound meshes.


      Edit: https://forums.unrealengine.com/show...-in-a-material

      I've made some progress working on getting the "pose-space" (pre-skinned) vertex positions passed through into the material.
      Last edited by n00854180t; 12-10-2015, 07:22 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


        #18
        Hey since ur into looking for dismemberment options anyway,could u maybe discribe how this is done https://www.youtube.com/watch?v=jciX...otation_225320 , it seems to cut in realtime,instead of using preprogrammed breaking points ,would rly like that for my lightsaber unreal game with ps move,however i only figured out how to do the precalced dismemeberment :/

        Comment


          #19
          Assuming it does real time mesh cutting - doing realtime cuts like that is kind of a pain - most of these other methods exist so that you don't have to try :P

          There are a few odds and ends around the internet that talk about doing real time mesh cutting, but it gets insanely complex when talking about an engine like UE4 and using it on animated characters.

          -------------------

          That said, you can use this system (the L4D2 style one) for the type of cuts you see there simply by trickery - e.g., you spawn a copy of the character character and invert the wound mask so that it hides everything *but* the part you sliced off.

          Also the system in this post doesn't use pre-placed breaks at all, just FYI
          Storyteller - An immersive VR audiobook player

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

          Comment


            #20
            For Unity there are a few real time mesh cutting solutions... e.g. https://www.assetstore.unity3d.com/en/#!/content/4169

            Comment


              #21
              I'd love to do that but it's way more difficult than this, and still kind of requires the same wound meshes, but doesn't have the performance benefits the L4D2 system does.

              Edit: That said if you're interested in that, I'd look at John Ratcliffs "Code Suppository" as it has some mesh cutting code (and no, that is not a typo XD, John Ratcliff is a funny, and brilliant, guy).
              Last edited by n00854180t; 01-20-2016, 06:14 AM.
              Storyteller - An immersive VR audiobook player

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

              Comment


                #22
                This looks great, I was just thinking about setting up L4D's system in UE4. Do you need some innards/guts? Let me know with an update here if you still need a simple "innards" mesh and textures and I can make it for you. I'm downloading the project now to check it out.

                Thanks for doing the leg work!

                Comment


                  #23
                  @esquire - Indeed I do still need wound meshes for this.

                  Would you mind hitting me up on Steam? I have the same nickname there as on here. I can give you some tips on how to build the wound meshes and such.

                  ------------

                  Also to any material experts, I still need a bit of help making it work 100% especially with the projected texture, which I can't seem to figure out the correct UVs for (plugging in the UVs as the xy of the position of the ellipse doesn't seem to work as described in the paper).

                  That said it still basically works, and the wound meshing work can be started on right now.
                  Storyteller - An immersive VR audiobook player

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

                  Comment


                    #24
                    Hi. Sorry for bumping an old thread, but I can't get this to work...I tried everything in here, and no results. I can sometimes mask the geometry, but the mask does'nt move with the character. Example: in the idle animation, the mask sits there in the air . and when I trigger the blueprint to add the mask, it removes it... Am I just to dumb or is this not working as intended?

                    Comment


                      #25
                      [MENTION=240941]Telmo_Pereira[/MENTION] - I have a new example in the works. One component that's not obvious is that you have to alter a couple of the core .usf shader files in order for the mask to follow the animated character. In any case, the new example is much better, but I wanted to get the blood texture mask working before releasing it. That said I'm having some issues with that so I think I'll release it and see if maybe [MENTION=540]Chosker[/MENTION] can help with that aspect of it.

                      I'll get the example out this weekend.
                      Storyteller - An immersive VR audiobook player

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

                      Comment


                        #26
                        [MENTION=11208]n00854180t[/MENTION] - Dude, you're the best
                        It's not suuuper important, but I'm developing a survival horror, so some cool gore would be nice

                        Comment


                          #27
                          I won't be around this weekend but sometime next week I could provide some help

                          looking forward to see what you come up with
                          Follow me on Twitter!
                          Developer of Elium - Prison Escape
                          Local Image-Based Lighting for UE4

                          Comment


                            #28
                            No worries there Glad to have any help!
                            Storyteller - An immersive VR audiobook player

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

                            Comment


                              #29
                              Originally posted by n00854180t View Post
                              Also to any material experts, I still need a bit of help making it work 100% especially with the projected texture, which I can't seem to figure out the correct UVs for (plugging in the UVs as the xy of the position of the ellipse doesn't seem to work as described in the paper).

                              That said it still basically works, and the wound meshing work can be started on right now.
                              Have you tried local (tri/bi-) planar mapping?

                              Comment


                                #30
                                Hi n00854180t,

                                I'm developing a sword fighting game and your solution is exactly what I need to show dynamical damage to the skeletal meshes. I tried to use the project that you posted a while ago but i does not work well with the skeletal meshes due to texture swimming. From the posts that you made later It seems that you could make it work with the skeletal mesh modifying the shaders, but this is way beyond my current skills

                                Any chance that you could post a sample project please? I tried using decals but the results are not good

                                Thanks!

                                Comment

                                Working...
                                X