Announcement

Collapse
No announcement yet.

Distance Fields "dynamic" grass tweaking

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

    Distance Fields "dynamic" grass tweaking

    SOLUTION:

    Originally posted by hippowombat View Post
    Hey Phil, try using a component mask with R&G channels enabled, B channel disabled, between your clamp output pin and your material WPO pin.


    Hey everyone,

    I've set up a material that uses distance fields to fake interaction when the character walks through it - based on this - (the blueprint has an invisible cylinder that generates the DF, since skeletal meshes don't).

    So far it's kinda working, stuff is moving, as you can see here:

    Without it:



    With it:



    Here is my material setup:



    The issue, as you may have noticed, is that ALL the grass is affected and deformed, even just on a flat floor and not near a moving mesh, as you can see here (grass is placeholder and ugly, but you can notice the unwanted effect):



    As you can see the whole mesh is just kinda offset, twisted and bent in funky, uneven ways.

    My theory: They're being affected by the floor ? (it's a landscape) Or maybe they're even affecting each other ?

    I have a no idea where to start fixing this, so I was hoping you guys would have an idea

    Thanks in advance !

    Cheers
    Attached Files
    Last edited by Philcrifo; 02-16-2018, 01:02 PM.

    #2
    I had the same problem. The landscape has its own distance field.
    Try to reduce or eliminate the z value by multiplying it with a vector(1,1,0)

    Comment


      #3
      Originally posted by Mars007 View Post
      I had the same problem. The landscape has its own distance field.
      Try to reduce or eliminate the z value by multiplying it with a vector(1,1,0)
      Hey Mars007, thanks for your answer

      I actually tried that, to no avail, the results remain messed up.

      What I find to "fix" the problem was setting the scale range of the grass strictly over 1. If i set the scale range below 1, the grass will get messed up.

      "fix" is between quotes because I'd like to be able to set the range below 1, so this is only a temporary fix.

      Still looking for insight on this

      Cheers

      Comment


        #4
        Originally posted by Chariots
        You could try to mask the effect by vertex color, so that the bottom vertices don't get affected by distance field offsets. You could also try a vertex color gradient like you'd do for wind animation.

        To properly fix it, you need disable the distance fields from landscapes/floor meshes. Afaik there is no way to distinguish objects within distance fields.
        I do have vertex colors so the bottom is not affected, that's not where the issue comes from i believe.

        About disabling the distance fields from the landscape: I can't seem to find any way to actually do that! Maybe I missed it?

        Comment


          #5
          Use gradient information in which direction closest surface is. When it's pointing down then disable the bend.
          Something like this:
          Code:
          float bendIntensity = clamp(1.0 + DirectionToClosestSurface.z, 0.0, 1.0);

          Comment


            #6
            Originally posted by Kalle-H View Post
            Use gradient information in which direction closest surface is. When it's pointing down then disable the bend.
            Something like this:
            Code:
            float bendIntensity = clamp(1.0 + DirectionToClosestSurface.z, 0.0, 1.0);
            Thanks for your answer, not sure where exactly I should put this line of code though ? (I'm an artist )

            Comment


              #7
              Hey Phil, try using a component mask with R&G channels enabled, B channel disabled, between your clamp output pin and your material WPO pin.

              Comment


                #8
                SOLUTION:

                Originally posted by hippowombat View Post
                Hey Phil, try using a component mask with R&G channels enabled, B channel disabled, between your clamp output pin and your material WPO pin.

                Hey Hippo !

                Thank worked wonders! Thanks so much!

                Cheers
                Last edited by Philcrifo; 08-23-2017, 09:54 AM.

                Comment


                  #9
                  Just going to say, I don't mind people using my work, it's why I posted it, but the least you could do is credit me instead of saying you made the material yourself.

                  https://forums.unrealengine.com/comm...eld-touch-bend

                  In any case, glad you got it working! This was done a long time ago before a LOT of changes to distance fields, I'm surprised it's still useful.

                  You may also want to play around with how wide the radius is. I never quite got it to a good universal setting, you may need to configure it a bit to get it looking right and not have the illusion of a phantom force around it.
                  Last edited by Zero-Night; 10-24-2017, 10:40 PM.

                  Comment


                    #10
                    Originally posted by Zero-Night View Post
                    Just going to say, I don't mind people using my work, it's why I posted it, but the least you could do is credit me instead of saying you made the material yourself.

                    https://forums.unrealengine.com/comm...eld-touch-bend

                    In any case, glad you got it working! This was done a long time ago before a LOT of changes to distance fields, I'm surprised it's still useful.

                    You may also want to play around with how wide the radius is. I never quite got it to a good universal setting, you may need to configure it a bit to get it looking right and not have the illusion of a phantom force around it.
                    Hey ! I fiddled with this for so long and tried so many things that I lost track of what I took from where. But you're right it's definitely based on your post, so all credits goes to you. (edited the first post)

                    Thanks

                    Cheers

                    Comment

                    Working...
                    X