–1 vote

hello everyone,

Does anyone know how to randomly generate a perfect terrain...


in Engine by (10 points)

Noise textures is the way to go. Have them displace vertices using a shader.

1 Answer

+1 vote

There are a lot of different ways of making procedurally generated terrains, but usually you use some kind of noise as a base for generating graphics.

Some examples
For 2D, you could:

  • Create tiles based on the noise map values, e.g. if noise > 0.5 then create ground, else create water
  • Apply a shader directly to a noise texture to modify its color and look

For 3D:

  • Probably the simplest is to use a noise as a heightmap for a subdivided plane
  • Create meshes using marching cubes, surface nets, dual Contouring etc.
  • Create cubes if noise value is above some threshold

There are lots of tutorials out there already, try searching "procedural terrain godot" on google/youtube.

Here's a couple:
Godot Procedural Generation with BIOMES tutorial part 1 - https://www.youtube.com/watch?v=zoE-mosUJ-I
HOW TO GODOT: Infinite procedural terrain generation - https://www.youtube.com/watch?v=rWeQ30h25Yg
Infinite Terrain in Godot 4 - The 'Wandering' Clipmap Terrain Technique (with LOD) - https://www.youtube.com/watch?v=rcsIMlet7Fw

by (1,085 points)

Thanks for your help!!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.