Monogame waves Effect shader

Hey guys can anyone help me create a shader similar to the water in this game this? I would really appreciate it as im really bad at making shaders and dont even have most of the fundamentals down.
ezgif-2-d07b67dbd014

you wont come very far without the fundamentals.

the water in your gif could be as easy as translating the UV.x every frame on a WRAP-sampled texture. The offset could be just a global constant you set as parameter for the shader and increment each frame - but yea, you’d need to learn yourself how to do custom shaders first.

If you have overlapping geometry and can just render the water behind everything else, the other thing you can do is to break the water into slices and move the actual slices (it will be hidden by the overlapping sprites) - that way you get away without custom shaders.

Yes im aware of using animated tiles (My game uses tilemaps) are an option but i prefer a more procedural approach i am aware of a way but i dont know how to implement it. using a sin wave to translate the y pixels upward on my texture is what i want to do but i dont know how to achieve such an effect with my current arsenal of skills.

you cannot transform pixels - you can only transform vertices. a sprite basically has 4 vertices - transforming them would not give you a proper curve but just a skewed quad. So you would need to tesselate the geometry. but you don’t need it - just move the UV.x in the vertexshader (or pixelshader, whatever you prefer), so the texture scrolls sideways trough the quad.

only problem is, that SpriteBatch will actually hard-set the WRAP-Mode to clamp (you’d need WRAP) … you’d need to care for that in your custom shader and set/bind it manually to the assigned texture.

so first you need the custom shader and you have to draw the water in a single pass win SpriteBatch to care for the WRAP. If you create a new Sprite Effect in the conetnt editor you will get a basic shader template you can ubuild upon.

so make the shader. before calling sprritebactch.begin(effect:youreffect) set some number for the offset and lmove the UV.x in the PS by that amount. not sure right now how to get the WRAP going … I usually dont use SpriteBatch any more with such effects …

Can you please show me some code because as a begginer i only know a select amount of skills and right now my skill level only shows me how to change the color of all pixels in a sprite.