Help with motion blur

Hey hey!
So I’ve wanted motion blur in my games alot recently, there aren’t lots of tutorials when I search it up as all I see is showcasing it with ReShade or on Strucid.
Even on here all I see is complaining about motion blur.
Anyone know how to make motion blur though?

1 Like

Add a local script so that when the player moves the camera around fast enough, it will make a Instance.new Blur effect inside the game.lighting

I wrote some code for this about 4 years ago. Now seems like a good time to update it. You could get more clever with it and factor in framerate and camera sensitivity, but this will do. Put it in a LocalScript in StarterPlayerScripts.

local MAX_BLUR = 15
local MAX_ROTATION = 5 -- lazy. blur maxes when you turn 5 degrees in one frame

local LastLook = workspace.CurrentCamera.CFrame.LookVector
local BlurEffect = Instance.new("BlurEffect")
BlurEffect.Parent = game:GetService("Lighting")

game:GetService("RunService").Heartbeat:connect(function(dt)
	local camLook = workspace.CurrentCamera.CFrame.LookVector
	local dot = camLook:Dot(LastLook)
	local theta = math.acos(math.clamp(dot, -1, 1))
	BlurEffect.Size = math.min(theta / math.rad(MAX_ROTATION), 1) * MAX_BLUR
	LastLook = workspace.CurrentCamera.CFrame.LookVector
end)

EDIT: I think I goofed some of the math. Fixed.

4 Likes

Thank you very much!
I’ve gotten alot of errors writing code so I’m very very happy to find someone to help me!