As @Megalomaniak said, you will need the UV and material in order of anything to show up on the mesh. The material tells the Shader drawing the mesh what textures to use, while the UV coordinates of each vertex tells shader what part of the texture should be drawn on each triangle.
If you are trying to generate voxel terrain, I’ve written a two part tutorial series on exactly that. The tutorial was written for Godot 3.0.6 and uses the SurfaceTool, though the project should work with Godot 3.1 without any changes.
The tutorial might provide a helpful starting point on how to generate a terrain mesh with the correct UV coordinates.
The key with working with UV coordinates is you have to remember to convert your positions to UV space. Where the texture is written with pixels, in UV space the entire texture is mapped from zero to one.
For example, if you have a texture that is 256x256 pixels in size and you want to get the center, in pixel space it would be X:128 Y:128
, while in UV space it would be X:0.5 Y:0.5
.
So long as you are okay with the textures being in a grid, it isn’t too hard to convert the grid coordinates to UV space, thought off the top of my head I don’t remember the algorithm.