Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How could the math.noise function be used for efficient 3d terrain?

Asked by 5 years ago
Edited 5 years ago

So, in the past week, I have been experimenting around with math.noise in generating terrain, first by just using it to generate smooth looking hills, which went well, then to making voxel terrain, which did not go as well.

The first code I tried out was the following:

local seed = tick()
for x = 0,150 do
    for y = 0,150 do
        for z = 0,150 do
            local p = Instance.new("Part")
            p.Size = Vector3.new(5,5,5)
            p.CFrame = CFrame.new(100 * Vector3.new(math.noise(y/31,z/33,seed),math.noise(x/35,z/33,seed),math.noise(x/31,y/29,seed)))
            p.Anchored = true
            p.CanCollide = true
            p.Parent = workspace
            wait()
        end
    end
end

There is an obvious problem with this script, and it is that it doubles over onto itself multiple times

I think the limited range of perlin noise might be at fault here (besides my own lack of expertise in this topic.)

So, I'm wondering if there is anything else I'm doing wrong, and is there other way to use 3d perlin noise for voxel terrain generation?

When I say voxel terrain, I don't mean the roblox or astroneer smooth terrain, I mean like Minecraft-esque blocky terrain

My apologies if anything in this question isn't phrased correctly, I'll try to correct it if it is found or pointed out

0
That thread and websites linked in that thread doesn't really explain how to position objects in order to utilize perlin noise for 3d terrain, also none of image links work theking48989987 2147 — 5y

Answer this question