How could I make a value smaller for lower fps? (Delta Time)

Hypothetically, how could I do this?
I have a script with motion blur (don’t judge) and it runs off of render-step, which is frame-rate based. If a player has less FPS, the distance between the previous and next camera CFrame is larger, thus making unwanted blur. Someone running on 60 fps would have a good experience with the blur, however. How could I use delta time to lessen a value?
Here is an old free model blur script, but this is as-well affected by the low-fps issue and applies the same logic as my own blur script.

BlurAmount = 10 -- Change this to increase or decrease the blur size

Camera 	= game.Workspace.CurrentCamera
Last 	= Camera.CFrame.lookVector
Blur 	="BlurEffect",Camera)

game.Workspace.Changed:connect(function(p) -- Feels a bit hacky. Updates the Camera and Blur if the Camera object is changed.
	if p == "CurrentCamera" then
		Camera = game.Workspace.CurrentCamera
		if Blur and Blur.Parent then
			Blur.Parent = Camera
			Blur ="BlurEffect",Camera)

	if not Blur or Blur.Parent == nil then Blur ="BlurEffect",Camera) end -- Feels a bit hacky. Creates a new Blur if it is destroyed.
	local magnitude = (Camera.CFrame.lookVector - Last).magnitude -- How much the camera has rotated since the last frame
	Blur.Size = math.abs(magnitude)*BlurAmount -- Set the blur size
	Last = Camera.CFrame.lookVector -- Update the previous camera rotation

Delta time is a parameter of heartbeat:

To get the average framerate (closest to 1), do deltaTime * 60 or deltaTime * 70.

Then, divide your blur amount by this number.

1 Like

As the previous reply suggested you just need to incorporate the implicit ‘deltaTime’ parameter into your calculation(s).


I believe this may work, but I’m having trouble understanding how I could implement it. Could you explain?

Replace the heartbeat line with the one I provided. Now you have deltaTime as a variable you can use in the local function.

I know what delta time is, it’s just how would I implement this math?

1 Like

Set the variable manually. You should use the numbers I provided.

Implement it when setting the blur size

local magnitude = (Camera.CFrame.lookVector - Last).Magnitude --Magnitude can NEVER be negative to begin with
Blur.Size = BlurAmount / (deltaTime * 60)