MeshDataTool or Shader?

Godot Version

4.3

Question

Hey all! I have a large plane mesh (MeshInstance3D) that I have subdivided. My plan is to use this subdivision to make terrain, but I’m actually not sure which way I should go about doing it. I have found some information of shaders that manipulate planes, and I have found information on MeshDataTool that manipulates the mesh. I am not sure which is the best route to go here, so looking for some info. I don’t have any physics in my game, so I don’t have to worry about that aspect thankfully.

I want to be able to manually set the heights of each point to make the terrain, but most of the information I am finding is showing me how to do procedurally generated terrain, which I don’t want to do. It seems that a shader is a popular method for this, but since I don’t want things to be random I am not sure if a shader is the way to go or not.

So basically I am not sure how to modify the mesh to get a terrain, at least not manually. And not sure which of the two methods is the way to go for this.

1 Like

Is your terrain data updated frequently? For a Shader-edited or CPU generated mesh the math will be quite similar, most use generative techniques for this but you can supply a heightmap of any source. What is your exact use case?

That makes sense. I’ve been digging into some terrain generation tutorials and that seems to be the best route. The terrain isn’t updated at all during runtime, so I think just generation is going to be the best way.

The current plan is for crearing terrain for my game, but not randomized. I want the game to be grid based, so generating an array of points works really well for me. Then I want to be able to manipulate those points up or down by a set amount (either 0.5 or 1, not sure which yet) to get some height. I am looking for straight lined terrain, not smooth rolling terrain.