Search code examples
androidgame-physics2d-games

Water effect "on android" for a 2D game. Where to start?


I wanna to add some water effects in my android 2D game to give the impression that objects are under water and the water becomes higher and higher. Is there a way to do this programmatically. May be someone can give me please some code suggestions or can say where can I find something to get started. I like to do things programmatically. One time I saw a fire effect artificial done with code. Is the same possible in the water case ?


Solution

  • You're going to have write a gl shader for the water effect.

    steps:

    • render scene to render target (texture)
    • apply shader to render target

    There are many different ways to write water type shaders in 2d. Search around for the technique that best suites your needs.

    Caveat: Shader only work on devices with programable pipelines (devices that support OpenGL ES 2.0+