I want to create a "river biome" where there are rivers cutting to a flat land mass, to start I wrote a little js to generate a random height map (with simplex noise) but that's where I'm stuck.
as you can see there are clear diagonal lines in there. I tried looking up how to fix this and on my search I found these:
I don't know if this is my problem of if it's something else entirely.
(somebody told me the values might get truncated badly, I don't know how to fix that if that's the case)
here's the significant part of my code:
for(var y = 0;y < myRivers.height;y++){
for(var x = 0;x < myRivers.width;x++){
lightness = simplexnoise(x/50,y/50); // number between -1 and 1
myRivers.context.fillStyle = lightnessToRgb(lightness); //maps lightness to a color
myRivers.context.fillRect(x * 4, y * 4, 4, 4); // fills a pixel with the color
}
}
a codepen: http://ift.tt/2CSeCNh
Aucun commentaire:
Enregistrer un commentaire