How to add Trees to Perlin Noise?

:+1: :+1: :+1:
Ok I will do it I might make this a kit maybe.

This is what I ended up with I will try to make the water code fit with the trees then It will be finished.

What are you using for the water? The easiest (and probably best) way to do it is to place water instead of a part whenever the height is below a certain level.

local Part = Instance.new("Part") --For cloning
Part.Anchored = true
Part.FormFactor = "Custom"
Part.Size = Vector3.new(4,4,4)
Part.TopSurface = "Smooth"    

local seed = math.random(1, 10e6)
local frequency = 3
local power = 20
local resolution = 256 
local WaterLevel = 0 --We store the level the water spawns below

for x = 1, resolution do  
	for z = 1, resolution do
        local y1 = math.noise(
            (x*frequency)/resolution,
            (z*frequency)/resolution,
            seed
        )

		local y2 = math.noise(
            (x*frequency*.125)/resolution,
            (z*frequency*.125)/resolution,
            seed
		)
		
		local y3 = math.noise(
            (x*frequency*4)/resolution,
            (z*frequency*4)/resolution,
            seed
        )
        
		local y = (y1*y2*power*power)+y3
		
        local Part = Part:Clone()
        Part.Parent = game.Workspace.Map
        Part.CFrame = CFrame.new(x,y,z)
		
		if z%resolution/2==resolution/4 then
			wait(0)
		end
		
		--[[if math.abs(y2) < .1 then
		    Part.BrickColor = BrickColor.Green()
		elseif math.abs(y2) > .25 then
		    Part.BrickColor = BrickColor.Red()
		else
			Part.BrickColor = BrickColor.Blue()
		end]]
		if y+(Part.Size.Y/2)<WaterLevel then -- We check if water is able to spawn.
			print(WaterLevel-y+(Part.Size.Y/2))
			local WaterPart=Part:Clone()
			WaterPart.CanCollide=false -- We set some values to the water.
			WaterPart.Transparency=1
			WaterPart.Reflectance=0.1
			WaterPart.Size=Vector3.new(4,WaterLevel-y+(Part.Size.Y/2),1)
			WaterPart.BrickColor=BrickColor.new("Cyan")
			WaterPart.CFrame=CFrame.new(x,y+(WaterLevel-y+(Part.Size.Y/2))/2,z)
			WaterPart.Parent=workspace.Map
                        game.Workspace.Terrain:FillBlock(WaterPart.CFrame, WaterPart.Size, Enum.Material.Water)
		end
	end
end

this is the code I am using for water

Instead of creating a part for the water and then filling the terrain, you can just fill the terrain. The players can’t interact with the water parts anyway.

1 Like

Yes but I want players to be able to swim in the water. So I did this:

I made water using the terrain editor.

That works too lol and whenever the map is under the certain height it will show water.

1 Like

Yes and this is easier to make

Using Perlin Noise To Make A Map here I made it a tutorial I will edit the tutorial and add ways to make water.