   How to create path for lightning effect?
  What would a function have to look like to create a random path for a lightning effect like in the demo shown here: http://rainwarrior.thenoos.net/dragon/effects.html ?I just cannot figure one, been trying it the whole day.   
  I would set the two points it starts at and ends at. Then I would also set it's minimum height and maximum height so it won't go everywhere. Afterwards I would assign smaller places for more than one point, so to say, in between that possible maximum of 10, there's 5 so each point can go anywhere between 2 places each. Then I'd let these points be sent anywhere between these randomly and then connected. To make it even cooler [in my opinion] I would have a number to be set to anything random and this would be the amount of points on that given shot of electricity. Then those would be divided up by your maximum points and all connected through GL_POINTS to get your solution. This is just theory and I'm not promising aything. I'll probably test my idea out in a bit. I hope I helped some.   ;  I tried that, and I even tried to limit point distance from baseline using a sine function to make it look more like a distorted wave, but that still looks too irregular. One restriction must be that two adjacent points must not be too far away from each other, or you get a wild zig-zag line, which I don't want. I just couldn't figure something taking the dependency of adjacent points into account and still giving enough variation.   ;  you can try recursive solution,1. given two points (a,b)  at distance>4 pixels,2. insert point (c) "somewhere around the middle of the line" (*)3. repeat recursively for (a,c) and (b,c)  (until distance<=4)(*) for "somewhere around the middle of the line" you can try taking random direction and at most line_length/4 radius, or other forumula... just need to pick a formula that will make sure the recursion ends after a few iterations.   ;  I have done something simmilar before. I had starting end end points, array of points, that stored difference between point n-1 and n. On each update I randomed those distances in some range. This way I prevented wild zig zag shapes but had some problems with last points. I wanted to have only start point fixed and end point could move its y coordinate in some range. Result was quite good   ;  You might want to try displacing points along the line using Perlin Noise (see for example here). This can produce a similar look to the image you referenced. L-Systems might be another option, they are quite well-known in generating tree shapes but can also be used for a number of natural phenomena including lightning.   ;  I looked at the demo again and noticed that the electricity had little 'waves' going through the line. Seeing that, I'm not so sure if it is completely random, but it has to have some formula or equation of some sort to produce that. Why not e-mail the creator? It's worth a shot right?   ;  I e-mailed the author.I cannot get that Perlin stuff to create a distorted wave. Well, I can kind of, but I am not satisfied with the result.Edit: I am just wondering ... are there only people on this forum who cannot really help with stuff like this (or other), or can't those who know how to do something like this be bothered with dealing with such lowly stuff?[Edited by - karx11erx on September 5, 2007 2:28:59 PM];  [Kind of off topic, but whatever]The people who could help probably are to busy. I wish I could tell you exactly how and why to make that effect, but I simply to do know how. I am not deep into the physics/simulation field as I am in visuals/illusion - type stuff and paths. To lay it plain, physics to do with the natural world programming wise are not my forte, though I wish they were. They help. :)But I'm not sure where the 'experienced' users are; they're probrably discussing how to create life via code.   ;  from pointA -> pointBcreate X number of points along this vectorfrom each of these points, u need to displace X number of vertices along the tangent vector ( the sideways vector )u can use a smoothed random function (eg 1d or 2d perlinnoise) to make the lightning look not so chaotic   