I have no idea how to use perlin noise even basic terrain generation
Can someone Help me?
very pretty i know
i know this is an old post but this is my script in ServerScriptService* this is what made this very pretty perlin it also generates terrain its probably not the most optimized but its still cool
local PartStorage = workspace:WaitForChild("PerlinNoise_Storage")
local Size = 400
local res = 20
local freq = 0.1
local amplitude = 50
local defaultPosition = Vector3.new(50,50,50)
local generatedSeed = math.random()
print(generatedSeed)
local function getHeight(x, z)
local noiseHeight = math.noise(x / res * freq, z / res * freq)
return noiseHeight * amplitude
end
local function getMaterial(height)
if height <= 0 then
return Enum.Material.Water
elseif height <= 10 then
return Enum.Material.Sand
elseif height <= 20 then
return Enum.Material.Ground
elseif height <= 30 then
return Enum.Material.Grass
elseif height <= 40 then
return Enum.Material.LeafyGrass
else
return Enum.Material.Rock
end
end
for x = 0, Size do
for z = 0, Size do
local part = Instance.new("Part")
part.Parent = PartStorage
part.Anchored = true
part.CanCollide = false
part.CastShadow = false
part.Size = Vector3.new(1, 1, 1)
local height = getHeight(x, z)
part.Position = defaultPosition + Vector3.new(x, height, z)
part.Color = Color3.new(height / amplitude, height / amplitude, height / amplitude)
part.Material = getMaterial(height)
end
game:GetService("RunService").Heartbeat:Wait()
end
for _, v in pairs(PartStorage:GetChildren()) do
local terrain = workspace.Terrain
terrain:FillBlock(v.CFrame, v.Size, v.Material)
v:Destroy()
game:GetService("RunService").Heartbeat:Wait()
end
im not looking for cool things, im looking for How to use perlin noise
read the script when you dont understand it look up the line you dont understand
you never used generatedSeed
just add it as third parameter for math.noise()
sorry i wasnt done yet i was just testing it
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.