I currently implement a game with a top down view of the ocean. I use the following, a little abstract texture:
The actual texture is transparent, I added the green-like color for clarity.
The problem I now have is, that I don't know how to animate this texture so the water looks nice. I tried to move the texture with a sin wave: texture.y += sin(angle)
. Of course now the whole texture is moving which looks kind of unrealistic. The next thing I tried is to add another layer and implement a parallax effect. So that reflections under the water surface would also move, but much slower. It looks a little better but still not... nice enough.
I think the best looking animation would be, if the individual cells would expand and contract, kind of like a web or piece of cloth. Imagine if someone would slightly pull at one vertex of these cells and the neighbored cell would expand and the cell I pull towards to (or push to) would contract. Kind of like a web of springs(?). But I have no clue how to implement something like this:
- Whats the math-model for this? Something with springs, where forces push/ pull?
- And if so, how do I map this model to the given texture? Keeping all the curves and what not...
(I'm also open to different ideas/answers on how to animate the given texture. Realism is not the point here, just some nice looking water like movements...)
Solution from DMGregory
I posted a libgdx example in this post: 2d water animation is jagged and not smooth (see answer about texture filtering)