Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one make a point to point "bolt" of lightning using perlin noise or other algorithm?

Every implementation I've come across of perlin noise generation has been for the generation of 2D terrain, etc. I cannot find a decent example of point to point lightning generation anywhere.

Are there many other forms of generating 'lightning'? I was told this is what I want. What algorithms exist for forked lightning, or 2D trees (I could turn this upside down for lightning maybe)

I work in multiple languages so examples in pseudo-code are OK also.

like image 850
ThantiK Avatar asked Aug 26 '10 19:08

ThantiK


1 Answers

My understanding is that Perlin noise is designed so all of its patterns are close to one single "size", but lightning is a fractal with patterns at every "size". There may be a way to use several Perlin noise systems at different scales to make lightning, but perhaps one of these other methods would work better:

The midpoint displacement method is a very fast algorithm for generating shapes that look a lot like lightning. Alas, it only generates a (very jagged) lines between two points, never forks. There's some source code and pictures at http://www.krazydad.com/bestiary/bestiary_lightning.html

Probabilistic L-systems can be used to generate shapes that look like lightning. I see that at least one person abandoned Perlin noise and switched to L-systems in order to simulate lightning. http://www.grepart.com/showcase/content/lightning_paper.pdf

The stochastic Lichtenberg algorithm runs somewhat slower, but it is more physically realistic model of lightning and generates lots of forks. http://fisica.ciencias.uchile.cl/alejo/fractal_antenna/node7.html

Is this a dup of the "Best lightning generation\simulation algorithm?" question?

like image 129
David Cary Avatar answered Oct 18 '22 10:10

David Cary