Live data from Hacker News

Realistic terrain in 130 lines of JavaScript

playfuljs.com

11–20 of 57 posts

Re: Realistic terrain in 130 lines of JavaScript

#12
post #10

Earlier quoted context omitted.

To add another note, as complex as real world terrain is, you can generate those fractal mountain patterns and drainage basins algorithmically with a bit of work. There are many ways to go about it, one would be recursive spacial partitioning, another would be to explicitly grow out a tree pattern while minding collision and proximity to other branches. Also, it is possible to use diffusion limited aggregation or ero…

Further reading: 1. A semi-standard textbook on the subject, but now a bit dated (don't be fooled by the 2002 date on the 3rd ed., most of the text is from the 1st ed): http://www.amazon.com/Texturing-Modeling-Third-Edition-Proce... 2. A more recent but much shorter survey paper: http://graphics.tudelft.nl/Publications-new/2009/SDGTB09a/SD...

Thanks for this! I've been looking for resources on building out lifelike macro-terrain-structures.

Re: Realistic terrain in 130 lines of JavaScript

#13

can this algorithm be run lazily? ie, can you continue to generate continuous terrain using this technique or do you need to generate the whole map ahead of time?

It can be run lazily in two ways: first, you can lazily add detail (ie, render down to a specific level of detail and postpone the rest); second, you can lazily build grid blocks out to the horizon (eg, for walking around a terrain first-person). So detail vs size laziness.

Re: Realistic terrain in 130 lines of JavaScript

#14

Just a small note, not to sound snooty, just to educate people on what realistic terrain looks like... This is what midpoint displacement looks like as a heightmap: http://imgur.com/ksETpO0,7gykFEV#0 This is what realistic terrain looks like (this is based on real-world heightmap data): http://imgur.com/ksETpO0,7gykFEV#1 That said, midpoint displacement, perlin/simplex noise, etc are good for modeling terrain at a le…

Reminds me of this - pretty good looking terrain + animation + sound in a 4 kilobyte executable:

http://www.youtube.com/watch?v=_YWMGuh15nE

How it was done:

http://iquilezles.org/www/material/function2009/function2009...

Re: Realistic terrain in 130 lines of JavaScript

#15
There was a Clojure example of this algorithm posted a few months back. Funnily enough, it's been in my "read later" bookmarks for a while now and I just got around to reading it this morning before I saw this post.

http://blog.mediocregopher.com/clojure-diamond-square.html

Re: Realistic terrain in 130 lines of JavaScript

#19
post #18
post #3

Don't miss the demo: http://www.playfuljs.com/demos/terrain/

Is there any way to control the demo? It doesnt seem to respond to mouse or keyboard input.

It only draws a single perspective, so the only control you have is to refresh the page to get a new random bit of terrain.
Post reply on HN