Roblox studio's fps is being capped based on perlin noise wind script

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want my wind script to work with all system resources
  2. What is the issue? Include screenshots / videos if possible!
    Based on the amount of wait time between each interval the fps wanes. for example:

    provides 48 fps CAPPED
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I haven’t found any similar issues on the forums so far so I have no where to look. I’ve lowered the graphics, and increased the wait time (but it just makes it look bad).
1 Like

Please just dont create a blank post g.

accidentally pressed enter instead of shift enter for making a new line

Use RunService.RenderStepped if you want to keep it smooth.

It now caps at around 18
image
I have a pretty beefy pc as well so im not sure whats going on.

Hmm. its on your end so move it to #bug-reports:studio- because Physics is smooth 60 whilst render is 18. Your going to have to tell us how to replicate it.

1 Like

So pretty much the grass blade is just a green part that has been flattened, and I use a script to replicate it and tilt it based on a perlin noise values, this is all the code:

local gridSizeX = 100 -- Number of parts in the X direction
local gridSizeZ = 100 -- Number of parts in the Z direction

local folder = Instance.new("Folder")
folder.Parent = workspace

-- Loop through X and Z coordinates to create the grid
for x = 1, gridSizeX do
	for z = 1, gridSizeZ do
		local BladeClone = workspace:WaitForChild("Leaf"):Clone()
		BladeClone.Parent = folder
		BladeClone.Position = Vector3.new(BladeClone.Position.X + (x - 2), BladeClone.Position.Y, BladeClone.Position.Z + (z - 2))
	end
end

game:GetService("RunService").RenderStepped:Connect(function()
	for Index, Blade in pairs(folder:GetChildren()) do
		local Noise = math.abs(math.noise((Vector3.new(Blade.Position.X, Blade.Position.Y, Blade.Position.Z)).Magnitude, math.fmod(os.clock()/23, 11) * 10))
		Blade.CFrame = CFrame.new(Blade.Position) * CFrame.fromEulerAngles(math.rad(Noise) * 90,0,0)		
	end	
end)

How many grass blades are there? You should probably use workspace:BulkMoveTo if there are many.

Based on @Proville6 workspace:BulkMoveTo() idea, here is how would it look like:

local gridSizeX = 100 -- Number of parts in the X direction
local gridSizeZ = 100 -- Number of parts in the Z direction

local folder = Instance.new("Folder")
folder.Parent = workspace

-- Loop through X and Z coordinates to create the grid
for x = 1, gridSizeX do
	for z = 1, gridSizeZ do
		local BladeClone = workspace:WaitForChild("Leaf"):Clone()
		BladeClone.Parent = folder
		BladeClone.Position = Vector3.new(BladeClone.Position.X + (x - 2), BladeClone.Position.Y, BladeClone.Position.Z + (z - 2))
	end
end

game:GetService("RunService").RenderStepped:Connect(function()
	local BulkCF = {}
	local BulkParts = {}
	for Index, Blade in pairs(folder:GetChildren()) do
		local Noise = math.abs(math.noise((Vector3.new(Blade.Position.X, Blade.Position.Y, Blade.Position.Z)).Magnitude, math.fmod(os.clock()/23, 11) * 10))
		table.insert(BulkParts, Blade)
		table.insert(BulkCF, CFrame.new(Blade.Position) * CFrame.fromEulerAngles(math.rad(Noise) * 90,0,0))		
	end	
	workspace:BulkMoveTo(BulkParts, BulkCF, Enum.BulkMoveMode.FireCFrameChanged)
end)

Although better, it is still providing very low fps:

image

Yea, it helps fps but not that much. Another thing you can try is to check if the object is in camera view and update it only when it is true.

You can also update parts that are far in half FPS, as it won’t be noticeable.

So based on raycast to player and distance to player right? But what if only some of the grass is occluded how would I determine how to update it in “half,” do i just change some of my parameters so that the change is minimal?

So yeah, raycasting would make it even worse. You should only check if the object is in front of the camera, not if it is occluded as it can affect performance even more.
About the half FPS idea there is a easy way to do it. I am gonna show you how when i get on my PC as writing on mobile is pretty slow.

Does Roblox provide a way to write engine-level/GPU level code or am I just out of luck in terms of pure hardware efficiency?