Having fun implementing Marching Cubes, I’m having an issue which I can’t figure out.

I’m using a 2d HeightMap to generate density, then I add a Perlin Noise to get floating values interpolation. But I end up having all the terrain look very ‘blocky’.

I can’t figure out what I am doing wrong.

Here’s the code and output.

```
terrainData = Terrain.activeTerrain.terrainData;
heightMap = terrainData.GetHeights(0, 0, terrainData.heightmapWidth, terrainData.heightmapHeight);
for (int x = 0; x < size; x++)
{
for (int z = 0; z < size; z++)
{
for (int y = 0; y < size; y++)
{
float val = heightMap[x * 10, z * 10] * 30f;
if (y < val + Mathf.PerlinNoise(x, z))
{
data[x, y, z] = 0;
}
else
{
data[x, y, z] = -val;
}
}
}
}
```