# Marching cubes density function: noise sampling leaves holes in plane

I'm following the GPU Gems 3 chapter 1 (Generating Complex Procedural Terrains Using the GPU). The main difference is that I'm using the CPU for generating the mesh(es) based off of marching cubes. And I have this problem that I'm not sure how to solve or even debug.

In Figure 1-8, they start adding noise to the plane at y=0:

density += noiseVol.Sample(TrilinearRepeat, ws).x;


I tried to do the same thing, but I got a plane with island-like holes in it:

Here is my density function:

float densityFunction(Vector3 ws) {
float density = -ws.y;
density += noise[(int)ws.x, (int)ws.y, (int)ws.z];
return density;
}


noise is a 3-dimensional float array of pink (Perlin) noise whose mean is 0. It has a frequency of 2 and 3 octaves with half persistence. Its standard deviation is ~ 0.2. And it varies around ±0.65.

The isolevel of the marching cubes algorithm is set to 0.

What could be causing this undesired effect?