Create lightning in OpenGL ES 1.1

佐手、 提交于 2019-12-07 09:49:42

问题


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


回答1:


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.




回答2:


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




回答3:


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.




回答4:


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




回答5:


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?



来源:https://stackoverflow.com/questions/544097/create-lightning-in-opengl-es-1-1

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