Can I un-voxelize voxel terrain?
So I made this script that manages to generate some pretty natural terrain in chunks. I want to make it look more natural by making the blocks less "blocky". I know marching cubes might work with that kind of stuff but it limits terrain generation. Is there any other way to "flatten" the terrain?
Script:
07 | seed = math.random( 0 , 10 e 5 ) |
10 | fold = Instance.new( "Folder" ) |
12 | fold.Parent = game.Workspace |
14 | part = Instance.new( "Part" ) |
16 | part.Size = Vector 3. new(platform, 20 , platform) |
17 | part.Color = Color 3. fromRGB( 255 , 255 , 255 ) |
19 | part.Parent = game.ServerStorage |
21 | w = Instance.new( "Part" ) |
23 | w.Size = Vector 3. new(platform, 20 , platform) |
24 | w.Color = Color 3. fromRGB( 100 , 100 , 255 ) |
27 | w.Parent = game.ServerStorage |
29 | function GenChunk(x, z) |
30 | for x = (-csize/ 2 )+x*csize, (csize/ 2 )+x*csize do |
31 | for z = (-csize/ 2 )+z*csize, (csize/ 2 )+z*csize do |
32 | local y 1 = math.noise(x/scale/ 0.5 , z/scale/ 0.5 , seed) * amplitude |
33 | local y 2 = math.noise(x/scale, z/scale, seed) * amplitude* 3 |
34 | local y 3 = math.noise(x/scale/ 1.75 , z/scale/ 1.75 , seed) * amplitude* 4 |
36 | local y = (y 1 * y 2 * y 3 )/ 2 |
38 | local p = part:Clone() |
39 | p.CFrame = CFrame.new(Vector 3. new(platform*x, y, platform*z)) |
42 | p.Color = Color 3. fromRGB( 200 , 200 , 50 ) |
44 | if y > - 1 and y < = 0 then |
45 | p.Color = Color 3. fromRGB( 100 , 50 , 0 ) |
47 | if y > 0 and y < = 2 then |
48 | p.Color = Color 3. fromRGB( 150 , 75 , 25 ) |
50 | if y > 2 and y < = 29 then |
51 | p.Color = Color 3. fromRGB( 50 , 150 , 50 ) |
53 | if y > 29 and y < = 51 then |
54 | p.Color = Color 3. fromRGB( 50 , 100 , 50 ) |
56 | if y > 51 and y < = 65 then |
57 | p.Color = Color 3. fromRGB( 100 , 125 , 100 ) |
60 | p.Color = Color 3. fromRGB( 200 , 200 , 200 ) |
66 | wa.CFrame = CFrame.new(Vector 3. new(platform*x, - 3 , platform*z)) |
67 | wa.Parent = game.Workspace.PT |
72 | for x = -chunks/ 2 , chunks/ 2 do |
73 | for z = -chunks/ 2 , chunks/ 2 do |
82 | game.Workspace.PT:Destroy() |
85 | game:BindToClose(close) |
Image of example terrain:
Image_1