Announcement

Collapse
No announcement yet.

Foliage collision + foliage bend on collision- In engine feature?

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

    Foliage collision + foliage bend on collision- In engine feature?

    I've been going through the forums and documentation on my effort to make a decision on switching from Unity to UE4. My amateur project is young enough that switching wouldn't be a huge hassle. So I decided that character models and animation transferring won't be a problem (which was my first question).

    Now my 2nd very important issue is foliage collision physics. In Unity, via a user generated tool from the asset store, I easily applied collision-bending to all my vegetation. It is very key to my game. On any plant, or mesh basically, I can adjust the degree of bend (resistance, bounciness) that occurs when an object hits it. Like painting a texture, just paint the least/most affected areas. Easy stuff.

    It gives the world so much more life. To run through a field and see the grass bending around the character is such a significant enhancement to the experience.

    Is foliage collision bending physics a built-in feature of UE4? I can't find any tutorials. Just collision only. The meshes remain static. Nothing about bending grass, bushes, any mesh. If not a feature, are there plans for more lively vegetation in the near future?

    (Vegetation bending physics is my 2nd of 3 key reasons for me to switch to UE4. First reason turned out great. 3rd is wind. But that comes after grass

    EDIT: I guess more accurately, I'm asking about a grass bending shader - like wind shaders. Not an expensive renderer for each blade or branch. A shader that bends foliage (like a quick small punch of wind) when a character collides with it. Like the character's mesh has a breeze and makes foliage react on direct contact. It is cheap on GPU because Unity does it with the shader I linked below in followup post.
    Last edited by comet; 04-01-2014, 06:54 PM.

    #2
    I too, would very much like to hear something about his.
    Check out our most recent work! https://imgur.com/a/03mNz

    Comment


      #3
      Nothing like this exists right now. If you have the source code to the Unity plug-in that allows it, you could probably port it, or find someone who could?

      Surely such a thing is hideously expensive though? Unless it's using some shader magic and not actually calculating 'real' collisions.

      Wind does indeed exist, but once again it's done in the shader I'm almost certain this would be possible but it wouldn't be 'accurate' so to speak, do you have any videos of the Unity plugin working?

      Comment


        #4
        Originally posted by TheJamsh View Post
        Nothing like this exists right now. If you have the source code to the Unity plug-in that allows it, you could probably port it, or find someone who could?

        Surely such a thing is hideously expensive though? Unless it's using some shader magic and not actually calculating 'real' collisions.

        Wind does indeed exist, but once again it's done in the shader I'm almost certain this would be possible but it wouldn't be 'accurate' so to speak, do you have any videos of the Unity plugin working?
        Of course I don't mean it's as accurate as a server farm at Pixar calculating each a million blades of grass But it is certainly a very good enough touch bending effect. The grass simply bends as an object collides, like a wind shader is hitting it. Surely touch bending can be applied to grass easily.

        It is a simple affect that weak hardware like last gen consoles can do. As if a mini pocket of wind is punching the foliage. That is how the effect looks. It is not like a Cinema 4D rendering. Still cheap shader trickery. The grass bends like wind shader is hitting it, but it still works. Only the hit portion of the plant is affected too. It really works well in dense fields. The problem is it's limited by Unity's horsepower. UE4 imagery with this simple shader would be glorious.

        But I'm sad if it doesn't exist in UE4. Of course I know I shouldn't beg for it, being an amateur relying on GUI-based game making. Seeing a field of grass waving in the wind is beautiful in UE4, but then seeing my character run through it, the grass passing through his body and not bending at all, it affects the experience. It is something from gaming generations past.

        Here is the foliage bending shader forum discussion. I want something like this for UE4 because UE4 simply would do it better with more horsepower and eye candy.
        There might be videos somewhere.
        There is an online demo if you have free Unity.

        http://forum.unity3d.com/threads/133...hader-released

        Comment


          #5
          You should have a look at Parameter Collections.

          • The player's position is being tracked and fed into the foliage. That position information is used to move the flowers and grass away from the player as they walk nearby.
          https://docs.unrealengine.com/latest...ons/index.html
          The Unreal Wiki & Unreal Docs are full of helpful Information about almost every topic!
          Found a Bug? Have a Question or a Feature request? The AnswerHub is your best friend!
          Want to share/discuss your progress or a tutorial? The Forums are all yours!

          Comment


            #6
            Originally posted by Chris.R View Post
            You should have a look at Parameter Collections.



            https://docs.unrealengine.com/latest...ons/index.html
            Thanks for that link. I wouldn't have found that documentation with all the search terms I was trying. Truly appreciate it. I feel good knowing I've taken a step in the right direction.

            Sadly, that page doesn't explain how MaterialParameterCollection uses the collected parameters to make the grass move away from the player.

            I understand that the global position of the player is being fed to a shader on the foliage, and then the foliage reacts accordingly. At the same time, I do not understand it. Specifically, I don't understand how or why the problem is solved using global data. Why (and how) is this a global parameters problem?

            My confusion arises from my mental image of the problem: I see it as an issue between the character model and the foliage. And I see the solution as being between the model and the foliage. For example, simply have a wind-like shader on the foliage that reacts to contact with the player/any rigid mesh model collision. The wind effect area would only be a very small area surrounding the player model.

            I can't grasp the concept of a global parameter taking care of what seems to be a very "local" problem. I don't understand how I would set up the MaterialParameterCollection to make a certain shader on the all the game world's foliage bend away from the player. Is it the wind shader briefly blowing the grass away from the player?

            Is it: The MaterialParameterCollection tells the grass a single, small gust of wind is occuring, because the player's global location is XYZ? What parameterized shader is this "global parameters god" telling a blade of grass to use at that moment the player is touching it? How is this "god" aware that only those few blades of grass in location XYZ should move at the moment?

            I picture the player model telling the grass " You move because I am at location XYZ". I don't know how the MaterialParameterCollection god solves it by looking at the entire game world, then applying a bend shader to certain foliage at that very specific moment of player/foliage contact at location XYZ. And what shader is it?

            A "global view/solution" seems more complex to me, but obviously it works and apparently simply because that documentation mentions it.

            (Sorry I'm rambling. This probably started to make less and less sense as I kept writing. I am not articulate, that's for sure)
            Last edited by comet; 04-02-2014, 01:21 PM.

            Comment


              #7
              Unfortunately i can't really help you any further with this, since i haven't done much with parameter collections yet. You can dig through the Material Examples and maybe you will find something, otherwise you may have to wait for an example about it from Epic.
              The Unreal Wiki & Unreal Docs are full of helpful Information about almost every topic!
              Found a Bug? Have a Question or a Feature request? The AnswerHub is your best friend!
              Want to share/discuss your progress or a tutorial? The Forums are all yours!

              Comment


                #8
                The MaterialParameterCollection is just a way of setting a global parameter such as the player location to all materials that want to make use of it. The foliage material would have a WorldPositionOffset input that checks if the foliage mesh is inside some sphere of influence centered on the player, and if so bends the foliage out of the way. It's a global parameter problem because an individual piece of foliage being rendered by the GPU doesn't know anything about the player. Note that this method of bending foliage doesn't really have anything to do with "collision", it's just some math calculated for every vertex of every piece of foliage, based on the player position parameter being sent to the shader.

                I'm not sure where the example material mentioned in that document is, or if it's available to UE4 subscribers yet, but I'll find out and post back here.

                - Jack

                Comment


                  #9
                  Originally posted by JackP View Post
                  The MaterialParameterCollection is just a way of setting a global parameter such as the player location to all materials that want to make use of it. The foliage material would have a WorldPositionOffset input that checks if the foliage mesh is inside some sphere of influence centered on the player, and if so bends the foliage out of the way. It's a global parameter problem because an individual piece of foliage being rendered by the GPU doesn't know anything about the player. Note that this method of bending foliage doesn't really have anything to do with "collision", it's just some math calculated for every vertex of every piece of foliage, based on the player position parameter being sent to the shader.

                  I'm not sure where the example material mentioned in that document is, or if it's available to UE4 subscribers yet, but I'll find out and post back here.

                  - Jack
                  Wow, you articulated that so concisely. And the part I bolded, that is exactly how my mental image of the problem is. Except you summed it up so much better and to the point. Thanks for explaining why it is a global parameter reasoning. I was half right at least. I just used too many words and didn't step back enough to examine the issue better.

                  I see your point about it not really being about collision. Under the hood, the UE4 engine is not calculating two hard objects coming into contact. The result is a simulation of a collision, but behind the scenes, the engine doesn't see it as a collision.

                  My brain just always pictured it as "invisible sphere of influence attached to player touches grass = grass moves."
                  And that could somehow be a "system" not relying on global parameters. Thus, my focus on collision.The sphere and grass just need to know they are touching each other and grass reacts according to its material programming.

                  A global approach does seem faster and easier to apply to a game world though. I am very interested in how the UE4 documentation version is done.

                  You used the term "material." Is it a material that bends the grass, and not shader? I was using shader for my questioning. I thought that's how I could get foliage to bend because coming from Unity, it is a shader that bends foliage. Like the wind shader.

                  Is the UE4 method using a material? Can UE4 bend grass simply by adding a material to the grass mesh? If so, that is incredibly simple and awesome. Especially for a visual learner, GUI reliant amateur like me - dragging a "bend" material onto the grass in Blueprint - UE4 would be my superhero.

                  Thank you for looking into the UE4 documentation. It would be wonderful to have the the foliage bend example material mentioned in the document. Having a foliage bend material would be insanely popular and, speaking for myself, convert me from Unity.

                  Thanks again for your very concise clarity. I am eager for your update.

                  Comment


                    #10
                    Originally posted by comet View Post
                    My brain just always pictured it as "invisible sphere of influence attached to player touches grass = grass moves."
                    And that could somehow be a "system" not relying on global parameters. Thus, my focus on collision.The sphere and grass just need to know they are touching each other and grass reacts according to its material programming.
                    You could approach it from this direction, ie enable CPU-calculated collision on the foliage, and when a cluster of foliage instances get a collision notification, find which instance it is and move it etc. This all gets a bit messy because the individual instances of foliage are grouped together in a single component for rendering efficiency. You'd probably want to hide the instances being hit by the player and replace them with individual components that you then simulate etc. A GPU-only solution is more efficient and scalable, but doing things on the GPU sometimes requires you think backwards from the point of view of each independent piece of foliage as it's being rendered :-).

                    Originally posted by comet View Post
                    You used the term "material." Is it a material that bends the grass, and not shader? I was using shader for my questioning. I thought that's how I could get foliage to bend because coming from Unity, it is a shader that bends foliage. Like the wind shader.
                    In Unreal-speak, the Material is higher-level the network you graph you build, where as Shaders are the lower level HLSL or GLSL code generated from the material graph. Note that one material might generate a number of shaders used for different purposes but that's mostly hidden from the user. We do use the terms independently to some degree. In this case using the World Position Offset input causes the material to generate code inside the vertex shader to move the foliage.

                    Originally posted by comet View Post
                    It would be wonderful to have the the foliage bend example material mentioned in the document.
                    I spoke to the artist who made the content in the doc screenshot. That content is from Fortnite, one of our internal games under development, but he's going to port that material to plain UE4 and build a small example which we will make available to you guys.

                    Comment


                      #11
                      Is the actual collision on foliage working?
                      Point Cloud Plugin: Project Website | Forum Thread | Roadmap

                      If you need help: join me on Discord
                      Please support me on Patreon if you enjoy my content

                      Comment


                        #12
                        Originally posted by JackP View Post
                        I spoke to the artist who made the content in the doc screenshot. That content is from Fortnite, one of our internal games under development, but he's going to port that material to plain UE4 and build a small example which we will make available to you guys.
                        awesome can;t wait to see that, could also be great to do permanent deformations like dents in cars?
                        potentially tesselate the surface where hit, etc. very muc looking forward to seeing what I can do with that example

                        Comment


                          #13
                          Question:
                          When i drag said tree or rock into the map manually my collisions work but with the painter they do not? Is this normal?

                          Answer:

                          Hello,

                          It is expected that Foliage instance actors do not currently hold collision. We do plan on adding this in a future update, but it is not yet in the engine.

                          Cheers!
                          more ▼
                          answered 1 day ago
                          Alexander Paschall gravatar image
                          Alexander Paschall ♦♦
                          1.7k ● 65 ● 5 ● 6
                          Shoiko gravatar image Shoiko 1 day ago
                          So this should just be for bushes and grass for now trees and bolder should be manual understood.
                          12 CatBlack Studios - One man with a dream, to create amazing things...
                          RPG Engine Toolkit: https://www.unrealengine.com/marketp...engine-toolkit
                          Auto Terrain Cover V3: https://forums.unrealengine.com/show...ver-V3-Release
                          Youtube: https://www.youtube.com/channel/UCuT...VDuzeIeJ6_j1pA
                          Facebook: https://www.facebook.com/pages/12-Ca...52913014823124

                          Comment


                            #14
                            Thanks Shoiko!
                            I've been asking that question for ~week now :P
                            Point Cloud Plugin: Project Website | Forum Thread | Roadmap

                            If you need help: join me on Discord
                            Please support me on Patreon if you enjoy my content

                            Comment


                              #15
                              Originally posted by JackP View Post

                              I spoke to the artist who made the content in the doc screenshot. That content is from Fortnite, one of our internal games under development, but he's going to port that material to plain UE4 and build a small example which we will make available to you guys.

                              Hey JackP,

                              Thanks a lot for the information. I haven't found any examples posted to UE4 yet related to this thread. Do you know if this UE4 example of foliage collision is still being worked on?

                              Comment

                              Working...
                              X