First WIP of scatter object displacement for MinerMancers. This will be for objects I don't want to destroy as you walk over / too near to them.

I'm using grass to test with for now simply because it's the easiest to make look OK - you can just flatten it and it looks fine. It'll get trickier for more substantial objects which will need to bend but not completely flatten - but the base principle is working at least

I'm not 100% sure I like this yet, but I'm trying to avoid having actual bones in these larger mushrooms and keep them in the instanced mesh. I don't want them to go pop like the smaller ones, and if I want them to bend out the way and animate properly I have to switch them for full skeletal meshes, and I really don't wanna. Push-aside is tough to look right with anything more complex than grass, so I give you: marshmallowy mushrooms that go flomp when you walk over them? 🤔

Yay, this is much better: big mushrooms getting pushed aside as a whole now using shader position offset. The problem I had with doing this before was the caps folding and crushing because per-vertex the calculation was non-uniform (fine for thin grass, no good for big mushies), but I realised I could use per-instance location data, so all the vertices in an instance can move by the same amount (scaled by height so they bend)

Thanks to @runevision and @bnut for prodding my brain yesterday

Here's how this works in UE: first you tell the Instanced Static Mesh how many floats you want in the buffer per instance, in our case NumCustomDataFloats = 3.
Then after you add an instance, you can set it's location data for the shader by calling the ISM's SetCustomData function (note NOT SetCustomPrimitiveData). This takes an arrayview of floats for a given instance index.
Then in the material, use the PerInstanceCustomData node, which has a handy vector variant.
And FYI the displacement itself is a render texture, it isn't hard-coded to the player character. This is because it scales up much better to multiple displacement sources, and a) we're a multiplayer game and b) there are other things that benefit from displacing ground objects, like the stash pot and large NPCs. Particle systems output to this RTT to make decaying displacement work, but it means fine control like easing and bounce are a lot harder to do than if it was just 1 position

The RTT + particles approach also means that I can fairly easily make explosions and other spell effects move the foliage as well - they can spit out different particles into the RTT and be more aggressive about the colours output to the RTT over time - instead of a simple decay they could thrash about a bit (within the limits of the channels I have)

So what I lose in fine control I gain in not really having to worry about how many displacement sources might crop up at once

I've improved the responsiveness a bit. Also demonstration of non-player things affecting the mushrooms
I'm not sure if I'm going to keep this because it's a little bit twitchy, but it's fun to see the kinds of things I can do with this system
More MinerMancers foliage displacement improvements:
* Explosions now have a different displacement effect which oscillates the direction.
* Height is now taken into account so bouncing / jumping in foliage looks much better
@sinbad did your explosion just burn those mushrooms? 😁