I’ve never really delved much into terrain generation so this is a tad bit confusing for me. What i want to do is make a value ‘y’ that i can set the position of my hexagonal segment to (Trying to replicate hexaria terrain).
I want to have only 2 for loops as oppose to 3, one for x axis and the other for z. This is what i have currently:
local PerlinNoise = require(script.PerlinNoise) local TerrainFolder = game.Workspace.TerrainFolder local Hexagons = TerrainFolder.Hexagons local Hexagon = game.Workspace.Segment local SizeX = 124 local SizeZ = 124 local SizeY = 256 local Amplitude = 256 local noisescale = 32 local Seed = math.random(1,1000000) local HexSize = Vector2.new(Hexagon.Size.X, Hexagon.Size.Z) for x = 0, SizeX do for z = 0, SizeZ do for y = -10 / 2, SizeY do local nx = math.noise(y / noisescale, z / noisescale, Seed) * Amplitude local ny = math.noise(x / noisescale, z / noisescale, Seed) * Amplitude local nz = math.noise(x / noisescale, y / noisescale, Seed) * Amplitude local Density = nx + ny + nz + y if Density > 20 then local Offset = HexSize.Y / 2 * (x % 2) local Color Hexagon = Hexagon:Clone() Hexagon.Position = Vector3.new(x * (HexSize.X * 0.75), y * 0.75, z * HexSize.Y + Offset) if y >= 50 then Color = Color3.fromHSV(0.0925833, 0.153841, math.clamp(y / SizeY, 0.2, 0.6)) end if y < 50 then Color = Color3.fromHSV(0.375306, 0.79411, math.clamp(y / 50, 0.25, 0.4)) end if y < 3 then Color = Color3.fromHSV(0.158111, 0.187503, math.clamp(y / 3, 0.4, .8)) end Hexagon.Color = Color Hexagon.Parent = Hexagons break end end end wait(.2) end
I’m trying to get rid of the need for ‘y’
(The map will be only rendered once then used, so performance isn’t an issue)
This is what it gives me, as you can see it’s not really that good
I’d also like to know how I can create a radial gradient heightmap via code so that I can blend that with noise and create island terrain. Any pointers would help alot.