“在Android上”的水效果用于2D游戏。从哪儿开始? [英] Water effect "on android" for a 2D game. Where to start?
问题描述
我想在我的android 2D游戏中添加一些水效果,以给人以为物体在水下并且水越来越高的印象。有没有办法以编程方式执行此操作。可能有人可以给我一些代码建议,或者可以说我在哪里可以找到一些入门知识。我喜欢以编程方式进行操作。有一次,我看到用代码人工完成的射击效果。在水情况下是否可能相同?
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 ?
推荐答案
您将为水效果编写一个gl着色器。
You're going to have write a gl shader for the water effect.
步骤:
- 渲染场景以渲染目标(纹理)
- 应用着色器渲染目标
有很多不同的方法可以在2d中编写水型着色器。寻找最适合您需求的技术。
There are many different ways to write water type shaders in 2d. Search around for the technique that best suites your needs.
注意:着色器仅适用于具有可编程管线的设备(支持OpenGL ES 2.0+的设备
Caveat: Shader only work on devices with programable pipelines (devices that support OpenGL ES 2.0+
这篇关于“在Android上”的水效果用于2D游戏。从哪儿开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!