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

你离开我真会死。 提交于 2019-12-08 06:28:08

问题


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 ?


回答1:


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+



来源:https://stackoverflow.com/questions/8669023/water-effect-on-android-for-a-2d-game-where-to-start

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!