So after failing to set up my python environment, I decided to try and make swaying grass instead as its something that I’ve wanted to do for a while. Somehow I ended up with a windy cloth shader!
I started off with a material that used the simplegrasswind materialfunction that’s inculded insider Unreal. This was based off of the vertexcolours that I painted inside maya. (I think I’m starting to understand these now!)
I wasn’t too happy with the motion for this, so tried an alternative method that used a sine wave to make the grass oscillate between two points. It still wasn’t quite what I was looking for though.
I tried using the logic from my god rays to get the material to move from side to side, and ended up creating an awesome billowing look! Not what I was aiming for, but it looked pretty cool so I decided to take it further.
I wanted to see a practical application for this shader, so I created a flag model with vertex colours that allow only the cloth part to move.
I then tried to add something that would move it from side to side. I created this by using the god rays billow logic combined with my original oscillation idea, but using a cosine wave instead. (As can be seen in the picture below, getting the direction values right is really important…)
With this working, I added a quick photo texture (don’t have my graphics tablet today!) and tweaked the vertex colours so there were no weirdly stretching vertices.
There are definitely some tweaks needed to make this function like an actual flag. I did some gesture drawings from videos of flags and thought a bit about the whip and wave principle. I think a flag that behaved in that way would require a proper cloth sim. NVIDIAs apex cloth works really well with unreal, but obviously this material is far more optimised. I’m downloading apex right now, so I’ll be able to make a comparison soon.
Picture of gesture drawings.
I also did a quick test to see how well it runs – I dumped a bunch of stuff from the content browser into the scene, inculding a lot of particles. It ran at 60!