Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Basically you can generate 2D nosie and 3D(The pics you saw from my tweets were generated using 3D noise)..
- First youll need a scale or frequency as some people might say. This will control how wavy your noise will be. Second youll need a amplitude value. This will basically control how spiky/tall the noise will be. Third youll need a seed if you want random results everytime
- Generate basic 2D noise:
- -- // You need to tweak the variables to get the results you want
- local Scale = 20 -- // How wavy your noise will be
- local Amplitude = 50 -- // How spiky/Tall your nosie will be
- local Seed = math.random() -- // Seed is like a key
- local function Generate2D(X, Y)
- return math.noise(X / Scale, Y / Scale, Seed) * Amplitude -- // Generate a new noise with out variables
- end)
- for x = 1, 15 do
- for y = 1, 15 do
- local Noise = Generate2D(x, y)
- local P = game.ServerStorage.Part:Clone()
- P.Position = Vector3.new(x * 4, Noise, y * 4) -- // Multiply by your block size to space them out and position the block on the noise scale
- P.Parent = game.Workspace.Terrain
- end
- end
- end
- -- // Generate 3D Noise(The fun stuff omg)
- local Scale = 20
- local Amplitude = 50
- local Seed = math.random()
- local function Generate3D(X, Y, Z)
- -- // Were basically creating three 2nd noises and then combining them into a 3D one
- local XN = math.noise(X / Scale, Z / Scale, Seed) * Amplitude
- local YN = math.noise(Y / Scale, X / Scale, Seed) * amplitude
- local ZN = math.noise(Y / Scale, Z / Scale, Seed) * Amplitude
- local Final_Noise = XN + YN + ZN + Y
- return Final_Noise
- end)
- for x = 1, 15 do
- for y = 1, 15 do
- for z = 1, 15 do
- local Noise = Generate3D(x, y, z)
- if Noise < .5 then
- local P = game.ServerStorage.P:Clone()
- P.Position = Vector3.new(x * 4, y * 4, z * 4)
- P.Parent = game.Workspace.Terrai
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement