Making a procedural terrain with Transvoxel/Marching cubes and 3D perlin noise

1.6k views Asked by At

I'm working on an implementation of Transvoxel and it works fine, but I can't get on with the noise. Now I'm generating a 2d heightmap using perlin noise and using the heightmap I'm setting the cell values, but I don't have any idea on how to generate the values for the cells. Actually they have to be between -127 and 128, and they have to increase and decrease smoothly, but I can't generate those values.

EDIT:

I stopped using 3d noise and I'm trying to do something with 2d noise. Now, I can triangulate a density field as I'm using marching cubes and transvoxel since about half a year. But the only thing I don't know is that if I generate a 2d heightmap to have terrain features like mountains then I don't know what densities do I have to use. I tried just simply give everything solid -127 and everything non-solid 127 and I also tried getting a heightmap value at a given (x,z) and then just adding y to it like: (x, 0, z) = 42, (x, 1, z) = 43, (x, 2, z) = 44 etc... But theese variations generate blocky terrains like the image below:

enter image description here

What should I do to make it smooth? Vertex locations are floats with non-whole values so it shouldn't be the problem.

1

There are 1 answers

4
Danielzt On

Transvoxel is a more complex implementation of Marching Cubes and I suggest you forget Transvoxel for now, study Marching Cubes first.

In summary, Marching cubes receives noise from 0 to 1, where 0 is no terrain and 1 is terrain. You just need to write 1 where you are planning to have terrain. For instance, generate a small map with 1 value where y < 3, on all X and Z positions of your map. You should get a flat terrain.

Try out! =)