Plasma fractal also known as Random Midpoint Displacement Fractal is not only a cool visual effect but also an extremely useful algorithm often employed in the computer games industry. Also known by its other name - "diamond-square algorithm" is used to create realistic heightmaps for 3D computer graphics and it can also create clouds or smoke effects. But most of all, it creates wicked plasma effect you can see above. And what is cooler than programatically generated plasma? Programatically generated plasma in JavaScript!

Plasma fractal is a visual implementation of the diamond-square algorithm. The algorithm recursively divides canvas into smaller squares, then it locates point in the middle (midpoint) and shifts it randomly within the square. This operation is continued as long as square is bigger then a pixel. Calculated average of the positions of each corner is then saved as a pixel value and finally each pixel is drawn on the canvas.

This is just a static image. Use controls on the right to create your fractal.

Roughness:
Red:
Green:
Blue:
Draw time: 0ms