I’ve implemented an electricity effect for Zarvot today. It’s modular enough to be used in future games and can trivially be adapted into 3D lightning as well.
I’m using this algorithm which recursively calls midpoint distortions on itself. It should be fast: the bottleneck now is the way I’m handling the points. Way too many ‘news.’ Since I’m creating meshes at runtime, the amount of new Vector2s and new Vector2 arrays are cutting my 1500fps down to 900fps on my desktop, in-editor. Haven’t tested it on the Surface yet, but it shouldn’t be nearly as pronounced of a hit. I’m going to have to look into reusing the same mesh and just translating the points, instead of running the algorithm again and again. Although still somewhat fast, the recursion is most definitely slowing it down.
On an old MacBook Pro under Windows, it runs once per frame at 1000+ fps. That’s using the standalone, but it seems pretty good to me. Now when I get Unity Pro, I can probably add some sort of bloom effect to make it look more lightning-y. You know, when I’m not poor.