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
Rounding out a few more features of my ground object system. You now have the option to spawn out (pooled) actors for larger objects when the ground gets removed for whatever reason, instead of just destroying them. This uses the same system I already had for instanced lumps; instances are removed from the ISM and actors are pulled out of the pool & configured to look like those instances & physically simulated so it looks like they were real objects all along
The cheat is that those pooled actors are local even though we're multiplayer, because none of them affect gameplay. Map changes *are* synced to all players, & they derive local effects from that - although the scatter is deterministic, so they should see the same things. The only instance->actor transition that is network synced is when a collectible resource lump falls out of a wall. But those are the minority; even when destroying a mineral vein many of the lumps are transient for effect only

@sinbad Juice-wise it's super polished. Smooth reactive movements are always pleasing.

If you'd like to also improve the tactile feel I'd suggest a tighter relationship between bendy movements and the things that bend them. Currently grass is pushed away in a much larger radius than the wizard's body, and mushrooms keep bending further away after the wizard has fully landed and is no longer pushing them further. This non-accounted-for movement inhibits tactile feel. But your mileage may vary.

@runevision It's a balance between exaggeration for effect and realism
@sinbad Right. I'd say that it's often possible to exaggerate the effects in ways that are more "tactile compatible", but in the end it's a stylistic decision of course.
@sinbad did your explosion just burn those mushrooms? ๐Ÿ˜

@sinbad Dungeon Flipper game incoming

Mow the greens, trim the mushrooms, power wash the dungeon, get it ready to sell so a fresh batch of monsters can move in and take residence.

@scrivolical you know this is actually a great idea. Fantasy version of Viscera Cleanup Detail
@sinbad those look so fun. I would run around in those for hours.
@sinbad Thatโ€™s looking ace. ๐Ÿซก
@sinbad @runevision @bnut This is soo much better! :)
@sinbad looks great! Maybe a little elastic ease out so itโ€™s bouncier?
@bnut tricky because this whole thing is pulling from a RTT, so that within the area it's almost free to add more displacers. The displacement itself is a particle system rendered into that RTT which decays out. To customise the easing I'd have to make the particle material decay differently over time which his tricky, I'm already using all the particle channels: RG = direction, B=flatten (important when larger things are directly on top), A = intensity. Maaaybe I could fake A to be signed ๐Ÿค”

@sinbad @bnut Nice, this deformation looks great!

If it was me, I'd make the animation of it much faster, maybe even based on distance to player position directly without time-based animation. Most bendy things will bend back into their neutral state just as fast as you can stop pushing them. So delays give a feel of foamy mattresses or marshmallows, or like they're alive (well, like an animal with muscles, rather than plant). But also a matter of taste of course.

@runevision @sinbad @bnut Bounce easing might be fun sometimes. Byoyoyoyoing!
@sinbad @runevision @bnut oh damn, that looks brilliant!
@sinbad @runevision @bnut this looks really good. loving the bright yet not too bright color spectrum.
@tomtrottel thanks! Weโ€™re trying to surf the line between vibrant and garish ๐Ÿ˜„