Help importing large scale terrain

I am trying to import a heightmap as a 10,000 x 4,500 x 10,000 piece of terrain. The trouble is, roblox’s heightmap system doesnt seem to accommodate this. The x and z vectors are plenty having max sizes of 16k by 16k, but the y vector seems to be clamped at 1024 at max.
I would try simply scaling it up after i import it, but it seems the terrain scaling tool is severely lacking in this magnitude as well. Is there some kind of plugin i can use to bypass the limit, or perhaps a plugin tool with better selection/scaling bounds?

How script the Terrain to change to another Terrain in Roblox - YouTube use this

This allows me to copy and paste terrain, it does not let me scale it

I have now tried seeing if I could make a script that systematically works through all of the terrain voxels and convert them to parts, scale up the parts size and positions by a given vector and then turn them back into terrain (effectively scaling up the terrain as a whole). This also has proved futile as all of the terrain functions have a maximum region size that they can work with, limiting my use of the commands.

I will continue to instead see if i can make a set of many smaller regions and work through them individually (dividing the terrain into chunks, scaling up those chunks and then putting them back together) but this will prove incredibly tedious and problematic. If anyone has a better solution in the meantime, please leave it here, it would be greatly appreciated

1 Like

I have created the following script:

wait(10)
for i = 1, 5 do
	print(tostring(6-i).." to part generation")
	wait(1)
end



--Size of the whole scaled region, from face to face
local TERRAIN_SIZE = 16000

--Scale factors in which the terrain should be multiplied
local X_SCALE_FACTOR = 1
local Y_SCALE_FACTOR = 4.5
local Z_SCALE_FACTOR = 1

--Model to parent all the parts into
local MODEL = Instance.new("Model", game.ReplicatedStorage)
MODEL.Name = "TERRAIN_PARTS"





--function that turns terrain regions into parts
local function ConvertToParts(mats)
	local size = mats.Size
	
	for x = 1, size.x, 1 do
		for y = 1, size.y, 1 do
			for z = 1, size.z, 1 do
				local Part = Instance.new("Part")
				Part.Size = Vector3.new("4,4,4")
				Part.Position = Vector3.new(x, y, z)
				
				Part.Name = mats[x][y][z].Name
				Part.Parent = MODEL
				
			end
		end
	end
end





--slices terrain selections into smaller parts so roblox can handle them
--If terrain is too large and you recieve a "region is too large" error, increase this variable
local CUTS = 32


local RegionSize = TERRAIN_SIZE/CUTS

for x = 1, CUTS do
	for y = 1, CUTS do
		for z = 1, CUTS do
			
			local X1 = -TERRAIN_SIZE/2 + (x - 1)*RegionSize
			local Y1 = -TERRAIN_SIZE/2 + (y - 1)*RegionSize
			local Z1 = -TERRAIN_SIZE/2 + (z - 1)*RegionSize
			
			local X2 = -TERRAIN_SIZE/2 + x*RegionSize
			local Y2 = -TERRAIN_SIZE/2 + y*RegionSize
			local Z2 = -TERRAIN_SIZE/2 + z*RegionSize
			
			local mats, voxels = game.Workspace.Terrain:ReadVoxels(Region3.new(Vector3.new(X1, Y1, Z1), Vector3.new(X2, Y2, Z2)), 4)
			
			ConvertToParts(mats)
			
			wait()
		end
	end
end

game.Workspace.Terrain:Clear()


--Scale parts
for _, i in pairs(MODEL:GetChildren()) do
	i.Size = i.Size * Vector3.new(X_SCALE_FACTOR, Y_SCALE_FACTOR, Z_SCALE_FACTOR)
	i.Position = i.Position * Vector3.new(X_SCALE_FACTOR, Y_SCALE_FACTOR, Z_SCALE_FACTOR)
end

--Generate Terrain
for _, i in pairs(MODEL:GetChildren()) do
	local region = Region3.new(i.Position - i.Size/2, i.Position + i.Size/2)
	game.Workspace.Terrain:FillRegion(region, 4, i.Name)
end

--Convert to TerrainRegion
local terrain = workspace.Terrain:CopyRegion(workspace.Terrain.MaxExtents)
terrain.Parent = game.Workspace 

Theoretically speaking, it does work. The trouble is, this method takes such a massive amount of resources that my 16 gb of ram will not likely be able to pull off. If anyone has any ways to make this better or if they have a better way of doing it, I would be glad to hear it

Took the heightmap in blender. Take a plane subdivided it into maximum number of triangles and then make a displacement map node connected to displacement output mode. Connect the hieghtmap to displacement.

I have already done this. My problem isnt with width or length, it is with height

Roblox limits heightmap imports to 1024 studs in height, which is insufficient for the map i am trying to import. I suppose if i was really desperate (and im about to be in a second) i could divide the heightmap vertically (sea level/ground in one set of heightmaps, hills and mountain peaks in another) and then import them on top of eachother

After going overboard with the script timeout length (five minutes) and spacing the process out as much as possible, I have found that the entirety of the terrain data is simply too much to fit into an array without blowing the ram budget. Im sure there is some way I could fix this script to be able to scale terrain of this magnitude, but its honestly at this point a better option to try and find another method of doing this.

Cant u try to import terrain in parts divide ur heightmap in 1024×1024 parts

In blender u could increase height by increasing strength

terrain imports are limited in width by 16k by 16k in size. My map fits well within this. The problem is not with the width, it is with the height. The height is limited by roblox to 1024 studs. Chopping the heightmap into smaller pieces is not going to solve this problem

Use blender method and import mesh terrain

I wonder if you could split the source map into 2 maps, and import the heights over each other? You’d have to figure out how to scale the grayscale map into pieces though.

I’ve never tried this but, I split this image into 2 by using the ‘levels’ tool, and scaled each ‘half’ up to use levels 0 to 256. Maybe these could be stacked?
original:
image
base(lower levels) scaled from 0 to 256 grayscale:
image

peaks scaled to 0 to 256 grayscale:
image

and finally, peaks overlayed with the base so you can kinda visualize how they’d stack:
image

The white from the lower map would be the max altitude of that map, then the black from the upper map would be the lowest part of that map (starting at y position of 1024 and going up another 1024):

IDK, might work.

I have tried this. Trouble is, Roblox only accepts heightmaps in the forms of png/jpeg which both have built in image enhancing features for smoothing edges, which ultimately ends up messing with the end result. They technically can stack when importing them, but the in the finished product there is an ugly and very obvious beveling where the layers meet. Perhaps if Roblox one day accepted other heightmap formats, this method would be more doable (or better yet, just increase the max import height)

I just realized the height is just limited based on the total volume, so if you want a taller map, you could import as a grid.

the max is around 6450 x 6450 x 6450

if you reduce the width you in increase the height.

You could import your 10kx10k map as as 4 5000 x 4500 x 5000 imports. This would get the height you want.

1 Like