水效果“在安卓上"对于 2D 游戏.从哪儿开始? [英] Water effect "on android" for a 2D game. Where to start?

查看:28
本文介绍了水效果“在安卓上"对于 2D 游戏.从哪儿开始?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的 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+

这篇关于水效果“在安卓上"对于 2D 游戏.从哪儿开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆