TransWikia.com

unwanted patterns in simplex noise

Computer Graphics Asked by Sam Apostel on November 13, 2021

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.

this is what it generates:
enter image description here

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.

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: https://codepen.io/anon/pen/gooyMj

One Answer

I know im a bit late, but hopefully this can help other people. you can add detail by using Fractal Brownian Motion. There is a great article here that i used as a guide to make my own version in c#. Also I would check to make sure your vars are ints.

Answered by DOSLuke on November 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP