Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently using 3D Perlin Noise to generate random terrain in combination with Marching Cubes.

My issue seems to lie in scaling the noise function to get reasonable heights in my terrain. If only one octave is used, all points in relation to the noise are obviously interpolated which results in fairly smooth data. However, to get overhangs/caves/jagged terrain, I have to use multiple octaves with varying amplitudes and/or scale the resulting values to my 'max' height I want of the map.

I might be missing something, but by using marching cubes with 3D perlin noise, I regularly get floating bits of terrain.

Any ideas on how I could correct this or if there's other noise functions I might use to get results like I'm describing? I'm wanting hills/valleys/mountains/lakes/etc. No need for floating bits segregated from the rest of the map. I believe this is a similar issue to what Minecraft has when it has terrain that just floats around in the sky occasionally upon generation.

Thanks for any assistance, Mythics

share|improve this question
up vote 7 down vote accepted

Probably the only way to completely get rid of floating terrain is to test for connectivity. Depending on the size of you map, that might be an option. You can do that by picking base point, like the very bottom of your world. Then ensure all your voxels are either:

  1. Connected to the base.
  2. Connected to a voxel that's connected to the base.

Likely starting at a known connected point (like the bottom of your world) then doing a breadth first traversal of connected voxels would work pretty well. Make sure you're flagging voxels as connected while you go. You can do this per-chunk.

Additionally, there are less expensive ways to minimize, but not completely remove the floating terrain.

  • Gradient bias: You can bias the placement of solid voxels with a gradient. The gradient function would fall off somewhat sharply after you're above the "ground level". This article talks about using a gradient and has some other neat tips.

  • Height map noise: You can generate noise as a height map instead. This would remove the overhangs and caves, but you can simulate those with an additional subtractive noise layer.

  • Less noisy noise: Use fewer octaves in your terrain noise and generate subtractive noise to get overhangs and caves.

share|improve this answer
Terrain might only be connected through the adjoining chunk if it's an overhang from there. – Loren Pechtel Apr 10 '13 at 3:23
@Loren: That's perfectly fine though. As long as the engine lets you address chunks by full index, it would work with no issue. – Phil Apr 10 '13 at 3:51
@LorenPechtel I do say you can do it per chunk, but you'd need to check adjacent chunks when you're on the edge of a chunk. This can become an issue when generating new terrain and haven't generated the adjacent chunk. When you come to this situation where you have potential floating terrain, you can either generate the adjacent chunk, or use the noise algorithm to parse the voxels until you find "bedrock" or a known connection to the current chunk. – Byte56 Apr 10 '13 at 4:16

it may be too late to answer, but I was starting now with this voxel terrain generation thing, with Perlin Noise and I found a way to create the terrain without those floating pieces. I think that this may help you. So, to create the terrain I first generate a heightmap than I read the pixels from that heightmap. Now comes the interesting part, I read the "brightness" (actually is the grayscale) value of each pixel on that heightmap and that gives me the height for that particular part of the map, then to create the terrain I assume that this heightmap is my terrain viewed from above, so if the grayscale value of a pixel (after being maped to my terrain "maxHeight") on that height map is, let's say 30, that means that in that specific point of my terrain I will only generate 30 voxels in the y axis and this gives me a terrain with no floating parts. If you want caves and so on, you can apply another noise on the original (under the surface) to create those caves. Hope this works for you.

share|improve this answer
I believe this is similar to the second bullet point in my answer above? – Byte56 Apr 10 '13 at 4:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.