The Flag Shader is a simple solution to animate flags inside unity when the system performance of your target audience is limited.
Official Forum Thread: https://forum.unity3d.com/threads/tab3d-flag-wave-shader-official-thread.488140/
There are 3 shaders included:
- Tessellated
- Non-Tessellated
- Non-Tessellated Shader Model 3.0
The tessellated shader is DX11 only and will automatically fall back to the non-tessellated shader if it is unsupported. It smooths the mesh to remove harsh lines whilst the wave effect is happening.
The non-tessellated shader is supported on machines using SM4.6+ but will show harsh lines if your mesh doesn't have enough vertices.
The non-tessellated SM3.0 shader is the same as the other non-tessellated shader but has support for Mac and PC's using SM3.0, as per the other non-tessellated shader it will show harsh lines if your mesh doesn't have enough vertices.
How Does it work?
It requires the 'cloth' of the flag to be aligned with the x axis in your modelling program (it can be rotated in Unity). The shader uses a 'flex map' to recognise which areas of the flag should move and which shouldn't and also by how much.
Examples are included in the package of a tessellated and non-tessellated flag.