Create lightning in OpenGL ES 1.1

ⅰ亾dé卋堺 提交于 2019-12-05 14:14:57

The usual approach is to compute the path of the lightning bolt using a Perlin function, rendering it to a glow buffer, creating a nice looking blur using a Gaussian blur shader and then merge it with your scene.

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).

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.

Maybe I'm missing something but what's wrong with simply using glLight() and the fixed functionality like everybody else?

Would have to be a very bright light to make it look like lightning and wouldn't you need to shine the light on or through something?

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