简体   繁体   中英

Create lightning in OpenGL ES 1.1

I need to create good looking lightning using OpenGL ES 1.1 (iPhone) and was planning on using shaders. However, when I asked about it in a previous question ( OpenGL ES 1.x Shaders ) I was informed there that this was probably not an option on the iPhone.

So now I am back at square one, wondering how I might make a lightning animation. It does not need to look ultra-realistic. I have already tried to use things like triangles stripped together. While this method does work, it is not as good as I had hoped it would look.

Does anyone have any ideas on the subject?

Thanks again,
~Eric

Try using a triangle strip textured with a gradient from black to a low-saturation blue or purple, to white. Set your blending to additive (GL_SRC_ALPHA, GL_ONE).

通常的方法是使用 Perlin 函数计算闪电的路径,将其渲染到发光缓冲区,使用高斯模糊着色器创建漂亮的模糊,然后将其与您的场景合并。

You could maybe adapt the code from this project . Although it's not ObjC/C, it does use OpenGL.

Here is an article that describes the effect in more detail and provides a VB/DirectX implementation.

也许我遗漏了一些东西,但是像其他人一样简单地使用glLight()和固定功能有什么问题?

必须是一盏非常明亮的灯才能使它看起来像闪电,难道您不需要将光照亮或穿过某些东西吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM