Weird Holes in Terrain

I recently imported terrain from Gaea and when it finished converting to terrain, it generated these weird holes in the terrain:


The map is 10K+ studs, so it’s unrealistic for me to smooth out every part of the map. Are there any other ways I can quickly fix these holes?

Found this from an old post on devforum (advise you to save a backup version of your project before running this code). You will have to edit the corner Locations.

-- BACK UP YOUR SAVE BEFORE RUNNING THIS

local Terrain = workspace.Terrain
wait(2)

-- Parameters
local fillMaterial = Enum.Material.Ground
local batchSize = 500 -- Voxels to do before printing progress. Too high = freezing
local startCorner = Vector3.new(-141, 14, -150)
local endCorner = Vector3.new(147, -26, 155)

-- No touchy
local resolution = 4
local region = Region3.new(
    Vector3.new(
        math.min(startCorner.X, endCorner.X),
        math.min(startCorner.Y, endCorner.Y),
        math.min(startCorner.Z, endCorner.Z)
    ),
    Vector3.new(
        math.max(startCorner.X, endCorner.X),
        math.max(startCorner.Y, endCorner.Y),
        math.max(startCorner.Z, endCorner.Z)
    )
)
region = region:ExpandToGrid(resolution)

local material, occupancy = game.Workspace.Terrain:ReadVoxels(region, resolution)
local size = material.Size
local currBatch = 0
local elapsedBatches = 0
local totalBatches = size.X*size.Y*size.Z/batchSize

for x = 1, size.X do
	for y = 1, size.Y do
		for z = 1, size.Z do
			currBatch = currBatch + 1
			
			if occupancy[x][y][z] > 0 then
				for yi = y-1, 1, -1 do
					occupancy[x][yi][z] = 1
					material[x][yi][z] = fillMaterial
				end
			end
			
			if (currBatch >= batchSize) then
				currBatch = 0
				elapsedBatches = elapsedBatches + 1
				print("%" .. elapsedBatches / totalBatches * 100)
				wait()
			end
		end
	end
end

print("Clearing")
Terrain:Clear()
print("Writing")
Terrain:WriteVoxels(region, 4, material, occupancy)
1 Like

This ended up just deleting the terrain, but thank you for the time you took to find it.