[Plugin] Grass Remover - Repaint terrain materials quickly

Overview


This plugin has one main use but does it quite efficiently. You simply input a target material, input your material you want it to replace with and then set the padding size. This will automatically get the models in the workspace and remove grass from under them (or any material) and repaint it with a new sort of foundation using any material you choose from.

Usage


Using this plugin is extreme easy heres a couple simple steps to get started!

  1. In the first field set the target material that you want to get replaced. (example: Grass)
  2. In the second field set the material you are replacing it with. (example: LeafyGrass)
  3. In the third field set the padding amount. (I suggest a minimum of 2)
  4. Press confirm and wait for it to finish, It can take some time depending on your map size.

Version 1.0
  • Plugin Release
  • Global paint only
Planned Updates
  • Selected model only mode

Comment any questions and I will respond as soon as I view it.

6 Likes

WOW! I always wanted to do this but it was to hard. This is super helpful.

1 Like

Hey I know this isn’t released yet, but I would like to contribute somehow. I was wanting to make a plugin like this, but you got to this before me.

Here’s how I would do some things;

When wanting to fix all the parts that the grass merges through, we want to make sure we limit how many we go through at once - I would incorporate something like this;

local function FixAllGrassParts(pad)
	for _, v in pairs(workspace:GetDescendants()) do
		if v:IsA("BasePart") and not v:IsA("MeshPart") and not v:IsA("Terrain") and v.Size.Y < 10 then
			print(v)
			if (_%100)==0 then
				wait() --Waits every 100 parts so it doesn't freeze studio
			end
			regionPaintPart(v, 0, pad)
		end
	end
end

And to actually fix the grass part the grass is clipping through - I would do something like this;

local function regionPaintPart(part, yC, padding)
	--each part is divided into smaller regions (each with a size of 4x4 studs) since some parts are rotated and regions cant be rotated
	padding = padding or 0
	local s = part.Size+Vector3.new(padding*2,0,padding*2)
	for x=1, s.X/3 do
		for z=1, s.Z/3 do
			if ((z+x)%200)==0 then
				wait()
			end
			local p2c = CFrame.new(part.CFrame:PointToWorldSpace(Vector3.new(x*3,yC,z*3)-Vector3.new(s.X/2,0,s.Z/2)))
			local p2s = Vector3.new(5,5,5)
			local r = Region3.new(p2c:PointToWorldSpace(-Vector3.new(p2s.X/2,5,p2s.Z/2)), p2c:PointToWorldSpace(Vector3.new(p2s.X/2,5,p2s.Z/2)))
			workspace.Terrain:ReplaceMaterial(r:ExpandToGrid(4) ,4,Enum.Material.Grass, Enum.Material.LeafyGrass)
		end
	end
end

I hope this helps you make this plugin, can’t wait to see it come out!
Kind regards,
Blaze.

1 Like

My bad I had no clue roblox didnt save that it wasnt public! Haha I fixed it, and its all public now

Autofill, or dropdowns for the terrian selection would be nice, and a slider value! Thing to make it more user friendly would be nice to see :smiley:

By no means am I even close to being a UI designer but, I plan on making an attempt.