Search Unity

how to use perlin noise with tilemaps?

Discussion in 'Scripting' started by djc51401, Aug 2, 2020.

  1. djc51401

    djc51401

    Joined:
    Apr 3, 2020
    Posts:
    12
    im trying to procedurally generate 2d top-down islands and i watched a video from sebastian lague that got me a very basic start to it but the problem with it is that the video i used was the gave generation ones and so its only really good for 2 types of blocks. i want to do a perlin noise generation but every tutorial i find is making a 2d texture and then using a single plane to generate the world. How would i use perlin noise in a tilemap so i can make different elevations/ materials?? any helps appreciated!!!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,749
    Generally you use it by scaling the average noise "hump" in the noise so that the islands are the right size, and then you sample all the points via the PerlinNoise (2-dimensional input), and if it is greater than 0.5 consider it island, otherwise not.

    You'd need to interject a floodfill step to determine continguousness, and not get islands that go of your sample area.