World Generation


The world generator makes a world based on perlin noise and the settings you put in.

Look at my code
  • GitHub

  • How it works.

    The Landscape:

    At the start it makes a grid of Vector3's for the mesh, how far away these locations are of each other is based on the vertDis in the settings.


    The Y value is calculated based on perlin noise. It adds multiple passes with all different values. These values are also based on the settings you put in. (You can add as many passes you want.)

    After this it calculates the order it needs to connect the verts and puts both a list of the locations and the vert order in the mesh. This makes up de landscape itself.

    The colors:

    The colors change based on the angle of the normal. These angles are called Zones and can be changed in the shader itself.

    Props:

    After making the chunk it places down a bunch of props, it does this by sending a raycast downwards on a random x and z location in the chunk, if the object hit has the tag "Ground" and the angle of the normal hit is below the set angle in the settings it will spawn the prop on this location. It will do this for every prop you put in the list below.




  • Back