Accidental Windy Cloth Shader

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!)

1

2

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.

3

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.

14

5

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.

7

Video

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…)

13

8

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.

11

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.

9

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!

15

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s