0 votes

I've been experimenting with generating terrain using a MeshInstance and the simplexnoise. It seems to be working fairly well, however no matter what noise I generate, there is always this rut/ridge thing generated in the middle of the mesh. I've edited the parameters a bit to make it more visible, but it's there no matter what they are
enter image description here

It's clearly visible, even with more extreme terrain
enter image description here
enter image description here
The fact that it's there no matter what I do leads me to belive that it's a problem caused by my code that changes the vertex heights. I'm pretty new to using meshes, so I would not be surprised. This is my code:

func reload_mesh_points():
print("Reloading mesh points")
var mesh = ArrayMesh.new()
var base = PlaneMesh.new()
base.subdivide_depth = division_depth
base.subdivide_width = division_width
base.size = plane_size
mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, base.get_mesh_arrays())
var mdt = MeshDataTool.new()
mdt.create_from_surface(mesh, 0)
var row = 0
var mesh_len = division_width + 1

for i in range(mdt.get_vertex_count()):
    print(i % mesh_len)
    var noise_sample = noise.get_noise_2d((row * noise_frequency) + noise_offset.y, ((i % mesh_len) * noise_frequency) + noise_offset.x)
    if i % mesh_len == 0:
        row += 1

    var vertex = mdt.get_vertex(i)
    var vnorm = mdt.get_vertex_normal(i)
    if randomize_vertexes:
        vertex += vnorm.normalized() * rng.randf_range(randomize_min, randomize_max)
    elif use_noise:
        vertex += vnorm.normalized() * noise_sample * noise_amplifier
        vertex += vnorm * multiplier
    mdt.set_vertex(i, vertex)

Any help as to how to get rid of this ridge is greatly appreciated.

Godot version 3.5
in Engine by (14 points)
edited by

1 Answer

0 votes


Maybe you've already fixed it, but I think the problem may arise from using 'i % mesh_len' here.

Alternatively, you could get the location of the current vertex and use that to sample the noise

by (18 points)
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.