Fractal Terrain in Javascript
Hunter Loftis has built a terrain rendering engine in only 130 lines of Javascript. Here’s what the output looks like:
Programmers tend to be lazy (I speak from experience), and one nice side effect of laziness is really brilliant ways to avoid work. In this case, instead of spending mind-numbing hours manually creating what would likely be pretty lame rocky surfaces, we’ll get spiritual and teach the computer what it means to be a rock. We’ll do this by generating fractals, or shapes that repeat patterns in smaller and smaller variations.
I don’t have any way to prove that terrain is a fractal but this method looks really damn good, so maybe you’ll take it on faith.
You can try it out here…reload to get new landscapes. Callum Prentice built an interactive version. This obviously reminds me of Vol Libre, a short film by Loren Carpenter from 1980 that showcased using fractals to generate terrain for the first time.
Stay Connected