0

I need some help with perlin noise.

I want to create a random terrain generator. I am using perlin noise in order to determine where the mountains and sea should go. From the random noise, I get something like this:

http://prntscr.com/df0rqp

Now, how can I actually detect where the brighter and darker areas are? I tried using display.colorSample which returns the RGB color and alpha of the pixel, but this doesn't really help me much.

If it was only white and red, I could easily detect where the bright area is (white would be really big, where red would be small number) and the opposite. However, since I have red, GREEN AND BLUE, this makes it a hard job.

To sum up, how can I detect where the white and where the red areas at?

FICHEKK
  • 749
  • 1
  • 6
  • 24

2 Answers2

1

You have a fundamental misunderstanding here. The perlin noise function really only goes from (x,y)->p . [It also works in higher dimensions]. But what you are seeing is just your library being nice. The noise function goes from two reals to one. It is being helpful by mapping the one result value p to a color gradient. But that is only for visualization. p is not a color, just another number. Use that one directly! If p<0 you might do water.

starmole
  • 4,974
  • 1
  • 28
  • 48
0

I would suggest this: 1. Shift hue of the image into red color like here 2. Use red channel to retrieve some mask. 3. Optional: scale max/min brightness into 0-255 range.

Community
  • 1
  • 1
Vyacheslav
  • 26,359
  • 19
  • 112
  • 194