Lightning effect in opengl es

Is there a way to create lightning fast effect on iPhone using opengl? (for example this app )

I have now modified the glpaint pattern to draw random dots around the line (between the two dots the user touches) and then connect them, but the result is a zig-zag line that constantly jumps around and falls horribly on the actual device.

+2


source to share


2 answers


you probably just want to make a triangular strip from the center of the device to the point that will be affected, and then paint a lightning texture onto that resulting polygon.



You can animate the texture to get a bouncing lightning effect.

+1


source


An easy way to create a lightning effect is to calculate the lightning path using 2D Perlin function, transfer it to a glow buffer, blur it with a Gaussian blur, and combine it with the scene. You can make the lightning move by calculating two paths (start and end) with the same number of path nodes and moving each node of the launch path sequentially to the corresponding node of the final path. Once the final path is reached, it becomes the start path and a new final path is calculated.



0


source







All Articles