水效果“在Android上”对于 2D 游戏。从哪里开始?

发布于 2024-12-23 11:16:50 字数 157 浏览 3 评论 0原文

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦在深巷 2024-12-30 11:16:50

您将为水效果编写一个 gl 着色器。

步骤:

  • 渲染场景到渲染目标(纹理)
  • 应用着色器到渲染目标

在 2d 中编写水类型着色器有许多不同的方法。四处寻找最适合您需求的技术。

注意:着色器仅适用于具有可编程管道的设备(支持 OpenGL ES 2.0+ 的设备)

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+

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文