Thursday, March 7, 2019

xna - How to make 2D water like in this video?



I wanna make water and waves for my little 2D PC game like in this video: http://www.youtube.com/watch?v=ooU6cTeirlQ I don't know how to write a similar shader. Does anybody know how to write a similar shader? Or is it possible to do the waves without shaders?



Answer



It's hard to tell how this is made exactly (except by the developer), but let me summarize what has already been said in comments, with some additions:




  • This is a 3D mesh seen from the edge, probably a simple grid




  • Each vertex of the grid is following spring physics affected by:




    1. A sine wave

    2. The dolphin diving in and out

    3. Their depth




  • Backface culling is disabled, and different textures/shading are used on both faces (tips)




  • The textures might be animated (animated UVs?), but this isn't really visible





  • There's some kind of alpha blending involved on the last row(s) of vertices




Additionally, to perfect the illusion, you have some animated sprites for the dolphin splashes, and a trail that seems to be a textured quad strip.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...