Announcement

Collapse
No announcement yet.

Distance Field Soft Bodies

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

  • Distance Field Soft Bodies

    Hi everyone,

    Today I made a little test using the master branch of Unreal Engine. The idea was to mimic the effect of soft bodies by using the new "DistanceToNearestSurface" node.

    Here is the result:


    Since it uses the material to deform it, it is completely fake, but I still think it looks pretty good. I'm not using it myself for anything, so if you need it or would just like to give it a try here is my content package:
    www.roelbartstra.com/resources/downloads/distancefieldsoftbodies.zip

    It is created on the master branch. It does not work with the latest version in the launcher 4.8 preview 4!!!!!!

    Here is the material overview:
    Click image for larger version

Name:	MaterialOverview.png
Views:	1
Size:	505.4 KB
ID:	1151465

    If you want more accurate physics results you could maybe try making a physics repulsor per sphere.

    Feel free to ask any questions and ENJOY!
    Last edited by Roel; 06-09-2015, 06:00 PM.

  • #2
    Awwww this is so awesome!

    Can't wait to use it in 4.8 w/ a shield deformation effect I had in mind, this distance field feature is just too cool!
    Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-source template)

    Comment


    • #3
      Oh my god, you're genius! Thanks!
      Time to resurrect my little jelly!
      SuperGrid: Marketplace Page | Feedback Thread | Demo | Website
      Level design and prototyping for newbies

      Comment


      • #4
        DistanceToNearestSurface node sounds like it's going to be crazy versatile, it could be used for seafoam, clouds going around buildings/mountains, maybe even change how your character moves when it gets close to a wall.

        Comment


        • #5
          This is a really inventive use of the global distance field! Awesome stuff.

          maybe even change how your character moves when it gets close to a wall.
          Well you can only sample it on the GPU in a material graph, so it needs to be visual-only effects. Roel's soft body approximation is just a visual effect, the actual collision between the balls is using the standard physics.

          One thing I am curious about Roel, are the spheres themselves in the distance field? Static meshes are in the distance field by default if they cast shadows and have 'Affect Distance Field Lighting' enabled. If the spheres are in the distance field, usually you get a distance of 0 when you do a DistanceToNearestSurface with your own position. But if the spheres aren't in the distance field, they would not squish each other.

          Comment


          • #6
            I was thinking about a stealth game where your character cloaks near walls and uncloaks in the open. But you could use it for snow piling up more around buildings, or leaves, or trash.

            Comment


            • #7
              Wow awesome sample. I donwloaded your contnet file and put its content in the content folder of a blank project. When I tried to open the map like in the video, I found nothing. I opened the contetn folder in the editor and I found nothing there too. How to use the content folder you provided, Thanks.

              Comment


              • #8
                Awesome idea!

                Distance Fields are going to prove so useful!

                Comment


                • #9
                  Very cool but I can't open the assets in the UE4 (I put the Uasset on my content fonlder but nothing) any ideas?
                  This is very cool I have already test the Flex Nvidia soft body but you need to compile the Ue4 source from the ue4 flex branch and I get a lot of but soo that cool to be integreated in the 4.8 .
                  thank Epic for this amazing engine !!

                  Comment


                  • #10
                    For anyone who is having issues running the project. Make sure to take heed of the following text written in the OP: "It is created on the master branch. It does not work with the latest version in the launcher 4.8 preview 4!!!!!!". So make sure you have the master branch.
                    NVIDIA GameWorks merged branch (v4.9.2) (v4.12.5) (v4.13 p2)
                    Feel free to Donate if you wish to support me

                    Comment


                    • #11
                      Originally posted by GalaxyMan2015 View Post
                      For anyone who is having issues running the project. Make sure to take heed of the following text written in the OP: "It is created on the master branch. It does not work with the latest version in the launcher 4.8 preview 4!!!!!!". So make sure you have the master branch.
                      I see. Now 4.8 is released and is no longer in preview. Can this now work in the full 4.8 or do we still need the master branch to make it run ?

                      Comment


                      • #12
                        Originally posted by zeOrb View Post
                        Oh my god, you're genius! Thanks!
                        Time to resurrect my little jelly!
                        Cool! Let me know if you run into any issues

                        Originally posted by DanielW View Post
                        One thing I am curious about Roel, are the spheres themselves in the distance field? Static meshes are in the distance field by default if they cast shadows and have 'Affect Distance Field Lighting' enabled. If the spheres are in the distance field, usually you get a distance of 0 when you do a DistanceToNearestSurface with your own position. But if the spheres aren't in the distance field, they would not squish each other.
                        Ah! That explaines the strange results I got at positive location. They all seem to be 0, unless you are inside another distance field, which now that you explain it makes a lot of sense. The colliders are less than half of the actual sphere size. It probably sees it as the nearest surface since you are inside it, which is closer than your own surface since you can't get inside yourself.

                        Originally posted by PLASTICA-MAN View Post
                        Wow awesome sample. I donwloaded your contnet file and put its content in the content folder of a blank project. When I tried to open the map like in the video, I found nothing. I opened the contetn folder in the editor and I found nothing there too. How to use the content folder you provided, Thanks.
                        Originally posted by Charles View Post
                        Very cool but I can't open the assets in the UE4 (I put the Uasset on my content fonlder but nothing) any ideas?
                        This is very cool I have already test the Flex Nvidia soft body but you need to compile the Ue4 source from the ue4 flex branch and I get a lot of but soo that cool to be integreated in the 4.8 .
                        Make sure you are working in the master branch from GitHub. It's Unreal 4.9.0.

                        Originally posted by ZacD View Post
                        I was thinking about a stealth game where your character cloaks near walls and uncloaks in the open. But you could use it for snow piling up more around buildings, or leaves, or trash.
                        I though this idea was cool, so I made it for you. Hope you like it:


                        Here is the overview:
                        Click image for larger version

Name:	MaterialOverview.png
Views:	1
Size:	505.6 KB
ID:	1079654

                        I would still suggest also looking into using the depth texture, since it makes more sense from a natural standpoint to base the distortion based on the distance behind the object from the viewers perspective. It also has the benefit of not needing DX11. But I can understand how the distance fields help to make an effect like this more gameplay consistent with distance fields. Especially in multiplayer.
                        Last edited by Roel; 06-10-2015, 02:54 PM. Reason: Material overview added :)

                        Comment


                        • #13
                          Ah! That explaines the strange results I got at positive location. They all seem to be 0, unless you are inside another distance field, which now that you explain it makes a lot of sense. The colliders are less than half of the actual sphere size. It probably sees it as the nearest surface since you are inside it, which is closer than your own surface since you can't get inside yourself.
                          Oh I see how it works now. If you get a value of 0 from DistanceToNearestSurface on your own surface, then you're not intersecting anything. If you get a negative value, you are intersecting something else.

                          Comment


                          • #14
                            The cloaking looks awesome, I could definitely seeing a game or power up based around it.

                            Comment


                            • #15
                              OK , thank you for your time !

                              I will check that but for my project I think that I will still with the 4.8.

                              Very cool work!!
                              thank Epic for this amazing engine !!

                              Comment

                              Working...
                              X