Parallel projected voxel terrain generator Your job is to generate a heightmap and show it as a parallel projected, voxel landscape. The rules are the following:


The (heightmap of the) landscape has to be randomly generated
You also have to describe how the algorithm you are using works, so everyone can learn something new here
You have to also either generate an image or display the generated landscape on the screen
The resulting image has to be paralell projected (so not perspective), and it can only contain voxels (so it has to be made out of small boxes)
This is a popularity contest, so you might want to add some additional features to your program to get more upvotes.
The winner is the most upvoted valid answer 7 days after the last valid submission. All valid submissions need to follow the rules, including the description of the used algorithm. You can add additional features which do not follow some of the rules (like adding a perspective mode), but in this case they have to be optional features (e.g. when turning them off the result should follow all of the rules)
My submission doesn't count as valid.


An example result image is the following:



Image taken from here

If you need some algorithms check here
Python2 3D Function Plotter Voxel Edition

This is my entry in this competition:

import math
import random
import Image

terrain=""
randA=(random.random()*4+5)
randB=(random.random()*4+10)
randC=(random.random()*4+1)
randD=(random.random()*4+1)
im = Image.new("RGBA", (1248, 1000), "black")
tile=[Image.open("voxel/1.png"),Image.open("voxel/2.png"),Image.open("voxel/3.png"),Image.open("voxel/4.png"),Image.open("voxel/5.png"),Image.open("voxel/6.png"),Image.open("voxel/7.png"),Image.open("voxel/8.png"),Image.open("voxel/9.png")]


for y in range (-40,40):
        for x in range (-10, 10):
                val=int(1+abs(4+2.5*(math.sin(1/randA*x+randC)+math.sin(1/randB*y+randD))))
                if (val&lt;9):
                        terrain+=str(val)
                else:
                        terrain+="9"
print terrain

for i in range (0,80*20):
        if((i/20)%2==0):
                shift=0
        else:
                shift=-32
        im.paste(tile[int(terrain[i])-1],((i%20)*64+shift,((i/20)*16-(32*(int(terrain[i])-1)))-32),tile[int(terrain[i])-1])

im.show()


As clearly stated in the title it works as a 3D function plotter, but since this competition requires the terrain to be randomly generated it this random sine function 1.5*(math.sin(1/randA*x+randC)+math.sin(1/randB*y+randD)) That depends on 4 random variables. This creates terrains like this:


We can ofcourse replace this random function by any 2 variable function, for example sin(sqrt((x/2)²+(y/2)²))*3 gives this terrain:


and -x*y*e^(-x^2-y^2) gives this:

(the plots on the right are computed by wolfram alpha)

And while we're at it, Riemann zeta along the critical strip:  



For the people who aren't familiar with it, as you can see these pools of water (wich represent the zero's of the function) all lie on a straight line (real part = 0.5). If you can prove this, you will get $1000000! See this link.

I hope you like it!