What is "Fractal Brownian Motion" and how can I use it?

  1. What do you want to achieve? Keep it simple and clear!

What I would like to achieve/gain is the ability to use and learn Fractal Brownian Motion. (a.k.a. FBM)

  1. What is the issue? Include screenshots / videos if possible!

My issue is implementing it into my noise script.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

The solutions I’ve tried so far are, looking on YouTube, and Developer Hub (I don’t know many scripting help website so any feedback on that would be great!)

So this is the code I want to add FBM to.

function NoiseGeneration(mapsize,freq,seed)
	local heightmap = {}
	for x = -mapsize,mapsize do
		local hx = {}
		heightmap[x] = hx
		for z = -mapsize,mapsize do
			local y = math.noise((x+seed)/freq ,(z+seed)/freq)
			hx[z] = math.clamp(y+.5,0,1)
		end
	end
	
	return heightmap
	
end

function TreeVisualize(mapsize,freq,seed)
	local HeightMap = NoiseGeneration(mapsize,freq,seed)
	local rng = Random.new()
	local tree = game.ReplicatedStorage.Tree
	
	-- Plane
	local Part = Instance.new("Part",workspace)
	Part.Name = "Plane"
	Part.BrickColor = BrickColor.Green()
	Part.Size = Vector3.new(mapsize,2,mapsize)
	Part.Anchored = true
	Part.Position = Vector3.new(0,0,0)
	
	for x = -#HeightMap,#HeightMap do
		wait()
		local hx = HeightMap[x]
		for z = -#hx,#hx do
			local y = hx[z]*2
			local chance = rng:NextInteger(0,1)
			--print(chance<y,y)
			if (chance < y) then
				local tree = tree:Clone()
				
				tree:SetPrimaryPartCFrame(CFrame.new(
					x,
					.5,
					z
				))
				
				tree.Parent = workspace
			end
		end
	end
end

function FBM()
 	-- Where I want to add the code
end

Please do not give me entire scripts or design entire systems for me.

Thank You!

Ok, It’s completed. Everyone can reply now.

1 Like

Well, thinking about it in basic terms, fBm is Perlin Noise. Think of it like Perlin Noise with extra steps - although fBm takes significantly more computing power and I’m not sure if I’d recommend using it for ROBLOX terrain generation.

The distinct difference between fBm and standard Perlin Noise is the arrangement - fBm has strictly ordered octaves progressing to greater frequency and smaller amplitude.

Here’s a nice Google Code document regarding it, I think you might be able to learn some important things from it.

So, I’ve tried my best to implement this into my code.
Is this an expected outcome?

1 Like

Yes, that’s what you could expect from using this algorithm.

Ok! Thank you for your help, and explaining it well to me!