Moving Parts of a Mesh in -Z via Its Material

I have 2:1 plane that I am trying to use as a flag. The idea is to make it wave through its material, so that I can have adjustable values to make the flag fit into different wind conditions.

What I am currently doing is to pan multiple masks, add them together, lerp the result with vertex color (R) and plug it all into World Position Offset. This gives the flag a very nice waving animation.

However, I cannot make the parts of the flag that are away from the pole move down in Z like here:

I tried using Absolute World Position, masking B and multiplying that by a negative value, and then lerping with vertex color (B); but that gave me the weirdest looking flag ever:


Note that the only the right half is vertex painted in the B channel to test things out, hence the suddenness of the bend. However, the issue is that the painted bits move in X and Y as well. The exact angle of the bend also depends on the rotation of the flag.

In short, I want to make parts of the flag move down in Z. However, what I do moves those bits in X and Y too.

If your flag is going to have different rotation, you should probably simulate wave in local space, transforming resulting offsets into world space.

For gravity effect approximation, you could mask the end of flag using its UVs, provided that it is mapped in 0-1 space.
You should post screenshots of your material setup for more advanced assistance.

Alright, here’s the material setup.

It’s basically a bunch of textures being panned/scaled, and then lerp’d with Vertex Color (R) until the final pin. I have Multiply pins here and there to control the intensity and the speed of the waves.

Here’s what I’ve done to push the vertices down. I’m trying to get the basics to work at this stage, i.e. just how I can push certain vertices down in Z. It then connects with everything else through an Add pin, which then goes into World Position Offset.

The B vertex paint channel that I used to mask the -Z push looks like this:


Overview screenshot of your material is too low resolution to read anything.
But I can tell you that:

This expression makes no sense to me.

You should multiply Float3(0,0,1) by a strength factor scalar and multiply again by blue vertex color. Than you would add that up your wave offsets.

That did the trick, thanks.