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

Hehe, that’s a cool feature! I might use this at some point, thanks for sharing the material tree!:slight_smile:

Hey JackP,
Has this been made available? The only thing I’ve seen like it is the pivot painter example, but that doesn’t have the spring back effect I’m looking for.

I assume this would be plugged into the WorldDisplacement node?

I was trying to create this sort of effect as well. Digging through the source code I found the interactive foliage actor, but no one seems to know how to use it :-p

Latest progress on that front (I haven’t touched it in a while):

https://answers.unrealengine.com/questions/59562/is-the-interactive-foliage-actor-still-a-ue4-work.html

In theory, all you need to do is create your sphere of influence based on a Vector in the Material Parameter Collection, get the world position of each vertex on the Foliage via the “Absolute World Position” node, then ‘move’ the pixels in world-space (probably multiplied by a gradient in Vertex Colours to get stiffer movement at the base), in the opposite direction to the vector between the World Position and your Parameter Collection vectors.

This is the most efficient way to do it, because doing it with real collisions on the CPU would be far too expensive for any production game I imagine.

EDIT: Looks like everything I said has been mentioned already… wups :stuck_out_tongue:

Hi ,

Regarding your screenshot in your previous post,
was your grass created using the foliage tool?

Yes, the grass has been placed/painted with the foliage tool.

Thanks ,
I got it working by following your material-graph.

Interestingly, I have implemented this kind of ‘foliage bending at xyz’ effect in a vertex shader (for another engine) in the past. However, the material-graph representation looks somewhat different and would have taken me much longer to figure out. I am still not fully acclimated to mapping my HLSL knowdedge to a material-graph (it does not always map as expected).

At least I now have a material-graph equivalent of a VertexShader for future comparison.

***Theoretical question:
**
*What if you wanted more than one sphere bending the grass in different places?
(e.g. 3 random balls rolling around, each bending the grass beneath them.)

Any thoughts on how that could be achieved?

Multiple material-graphs (one per ball) is probably redundant overkill.
I am not yet familiar with arrays or loops (not to mention potential performance issues) so can’t say if that would work or if it is even possible.

Can you think of an efficient way for the same material-graph to bend grass at multiple/different xyz locations?

Have you guys tried the Pivot Painter map in the Content Examples?
I seem to remember a couple of examples that cover this.

arrays and loops aren’t really supported in a material (though you can create them inside a Custom HLSL node, yet inputting stuff into that array wouldn’t really be flexible). with a loop you’d avoid the redudancy in your graph but the cost would be the same as repeating it.

I’d say this is a task for the engine guys, probably through the use of the InteractiveFoliageActor or something similar.
I hope they get around to implement this into UE4, as it gives a nice feel of ‘being in place’ and interactivity to the decorative foliage. Assassin’s Creed 4 was excellent in this regard.
and I hope they get to implement this feature to make it work with the Foliage tool. Otherwise it’ll feel like an unfinished feature as it always was in UDK - you couldn’t paint SpeedTrees with the Foliage tool (you can now in UE4), and you couldn’t paint InteractiveFoliageActors with the Foliage tool either

How does that collection parameter node named sphere pos work? How do you create such a parameter? I couldn’t find anything in the documentation. I assume this node specifies the sphere that surrounds the player for plant collision? Is this sphere created in Maya or 3Ds Max, or is it obtained from within UE4?

EDIT: Ah, here it is. Missed it on the first read.

I’ll ask more questions if this doesn’t clear things up.

So I am at the bar ATM and everything Is too loong so I didn’t read but heres how I do it. get the moving player/moving objs facing direction and bend twords using that vector. I then have a variable that is multiplied by Rand and use that value as a timer for when the grass/foliage springs back up. it give a steam rolling effect. but it works well for me. btw I use a blueprint not foliage. But a shader shouldn’t be too different. Hope this gives you some useful info.

Tried creating a Material Collection Parameter. The details are not present in the properties window, and right clicking and then clicking details for this newly created parameter does not show the details for this parameter either. The entire window is just blank, except for the save and find in CB buttons on the top left of that window.

Frustrating.

Hey guys i have been trying to figure this out for a week now and i am still completely confused. I am trying to bend the foliage away from the player and i have everything in my material setup except i don’t get what these material parameters and blueprints are doing or even how to make one for this setup.

Would someone mind posting a screen of their material parameters and blueprints?

Also is anyone using Pivot Painter? Is this a completely separate way to control foliage bending/collision or is it needed?

This is good, it would be great if you did a short tutorial for building and placing this it would allow more feedback due to increased exposure.

The way crytek did it wasn’t very expensive. In fact it even works perfectly well on mobile.
I am of the opinion this is something Epic might want to consider investigating. Anyway. Its their call but i feel its a feature that would make basically everyone happy.

Im sorry to say but a simple material setup isn’t sufficient. It looks terrible. And is not practical for big plants with details. Sure some grass blades n stuff looks fine. But i haven’t seen a single example of it looking great with big plants.
Anyway. I know pretty well how crytek approached it and thought i would try and mimic it with a blueprint. I cant code otherwise i could have been of more help.

My results are pretty weak considering it was a very quick setup just to establish if its worth investigating more.

https://youtube.com/watch?v=WAqmzbxsaC8

That actually looks pretty **** good, apart from the small stutters. Was it particularly hard to setup?

Is it hard to setup?

Negative. just time consuming. Simple bone setup and skinning.
Adjust the constraints in phat with high spring values and angular settings

Im sure with some projection and linear damping those jitters can be removed.

In the blueprint just add a box volume and if character or objects enter volume activate simulations. If none disable simulations.
Pretty simple.

But keep in mind this approach is fruitless until actors are allowed to be added to the paint foliage tool. It would be too time consuming to place vegetation manually

The simple bones example
eab23e60c8b39ca89c1b1a8e1b8743f801422967.jpeg

Ah its a shame instanced meshes wont use it, otherwise id invest the time willingly.

2-3 bones should be fine and you prob won’t get any jitters. Plants are not that flexible anyway.

It shouldn’t be hard for EPIC to add bending, priorities I guess.