
I little cloth physics experiment that kinda evolved into a waving flag with shading and all

Requires Overlay Object. (
available here)
It works like this:
I always add some value to each point's velocity vectors which controls their speed and direction. I always add a gravity factor, but also a semi-random wind factor (based on a lot of sine-waves) which prevents it from falling all the way down.
I then loop over all points and draw a polygon over 4 points to get a vertical 'slab'. Most of the time I draw a red polygon but also a white polygon at the center (this makes the white horizontal stripe through the flag)
At the vertical lines 6 and 7 I only draw a completely white polygon to get the vertical white stripe.
Shading is calculated by doing a dot-product on the flags surface normal vector and with the direction of the light. This gives me the amount of light each polygon has which I use to correct the color.
The result is this waving flag

You can control the points where the flag is anchored by checking the check button to make them visible. You drag them around inside the boundaries of the overlay object.
Would be fun to see the different kinds of flags you can make with this