Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fixed2 uv = i.uv;
- // for a 32x32 texture, could also be a parameter.
- fixed pixelWidth = 1.0 / 32.0;
- fixed pixelHeight = 1.0 / 32.0;
- // make it so the UV is always a multiple of pixelWidth and pixelHeight.
- uv = fixed2(round(uv.x / pixelWidth) * pixelWidth, round(uv.y / pixelHeight) * pixelHeight);
- // offset the UV according to the sine value of the current time.
- fixed waveSpeed = 0.0625;
- fixed waveLength = 8;
- fixed2 uvOffset = fixed2(sin(uv.y * waveLength + _Time.z) * waveSpeed, sin(uv.x * waveLength + _Time.z) * waveSpeed);
- uv.x += uvOffset.x;
- uv.y += uvOffset.y;
- i.uv = uv;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement