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.
--//Settings
BlurAmount = 10 -- Change this to increase or decrease the blur size
--//Declarations
Camera = game.Workspace.CurrentCamera
Last = Camera.CFrame.lookVector
Blur = Instance.new("BlurEffect",Camera)
--//Logic
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
else
Blur = Instance.new("BlurEffect",Camera)
end
end
end)
game:GetService("RunService").Heartbeat:connect(function()
if not Blur or Blur.Parent == nil then Blur = Instance.new("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
end)