Basic Water Animation not Tiling


I’m using WaterBasicDaytime / FX/Water (Basic) from standard assets example along with water.cs (Water Mode Simple) but I have a problem.

Water animation doesn’t tile. Every 10 seconds Water animation resets to it’s starting point making water animation flicker or cut for a moment.

If I remove Clamping from Offset calculation it seems to work fine but there must be a reason why there is a clamping.

I use

Vector4 offset4 = waveSpeed * ( t * waveScale); 

instead of

(float) Math.IEEERemainder(waveSpeed.x * waveScale4.x * t, 1.0) - For each axis

Why is this clamping made? Is there a way to tile water animation with clamping.


The _WaveOffset variable is just a straight addition to the UV coordinates of the two bump maps so it looks like the problem is with the IEEERemainder function. If I had to guess I’d say it’s returning -1 when the input is multiples of 10 which could be causing the jump or flicker in movement. Frankly, I have no idea why that particular function is used. You could try using modulo or just keep what you have since it seems like it would work just fine, unless you had very large values of time.