Hey, I'm back! I haven't been very active on here for months because I was trying to make a new shader tutorial site. I still might on occasion, post a tutorial here (just simple ones for now), but I'm planning on making a more organized format on the new site. Anyway, by request I decided to make a tutorial about a 2D wind effect.
Ripple effect
To make our wind, we need a simple ripple effect. We will create a vec2 and call it "Coord". This will be used for the wind distortion. We will set it to "v_vTexcoord". Now you need to change the texture2D coordinates to our Coord vector. It should look like this:
vec2 Coord = v_vTexcoord;
gl_FragColor = v_vColour * texture2D( gm_BaseTexture, Coord);
This is a pass-through shader. If you run the shader applied to a sprite, it shouldn't change anything. To make a ripple we will use a cosine wave. We could do it like this:
vec2 Coord = v_vTexcoord + vec2(cos(v_vTexcoord.y*30.0)/30.0,0);
If you run this you will see this (before and after):
vec2 Coord = v_vTexcoord;
gl_FragColor = v_vColour * texture2D( gm_BaseTexture, Coord);
This is a pass-through shader. If you run the shader applied to a sprite, it shouldn't change anything. To make a ripple we will use a cosine wave. We could do it like this:
vec2 Coord = v_vTexcoord + vec2(cos(v_vTexcoord.y*30.0)/30.0,0);
If you run this you will see this (before and after):