How to make camera distortion?

How can I distort the camera like in this video?

https://www.youtube.com/watch?v=suqdbI4p_90&t=101s

3 Likes

I was honestly wondering the same thing when I saw that video a while ago. It looks like the camera is stretching but I’m not sure if that’s even possible within Roblox.

Just a guess, he could be manipulating the camera’s FOV/position simultaneously, so it might give that effect.

2 Likes

Its a long video but are you referring to the jittery camera shake?

2 Likes

Sorry for the delay. But yes, I mean the shake of the camera.

3 Likes

I was in the resource section the other day and someone had posted a very popular plugin for that long ago, let me find it one second.

Edit: here you go,

Their camera shake example was for explosions, but im sure it can be adjusted and tuned to what you like.

1 Like

https://www.roblox.com/games/1347593653/Super-Camera-Skewer-64

1 Like

It is actually possible. I did this before by manipulating the camera’s cframe.
https://gyazo.com/1b959a04da421327ce056cef8eea5144

Just look at the camera distortion, don’t mind anything else.

Edit: Mute your sounds, I just realised that the sounds is so loud.

2 Likes

CFrames usually have three directions describing their “right direction”, “up direction”, and “backwards direction”.

If they aren’t all 90 degrees apart, you get distortion.

For instance, here I keep the right vector the same but rotate the up vector:

local angle = 0
local inc = true
game:GetService("RunService"):BindToRenderStep("SkewCamera", Enum.RenderPriority.Camera.Value + 1, function()
	if inc then
		angle += 0.01
		if angle > math.pi/2 - 0.1 then inc = false end
	else
		angle -= 0.01
		if angle < 0.1 - math.pi/2 then inc = true end
	end
	
	local cam = workspace.CurrentCamera
	local rotated = cam.CFrame * CFrame.Angles(0, 0, angle)
	cam.CFrame = CFrame.fromMatrix(cam.CFrame.Position, cam.CFrame.RightVector, rotated.UpVector)
end)

Things start to freak out at the extremes, though. I limited it to about +/- 90 degrees.

12 Likes

thanks Buddy. I couldn’t have done it without your help. But I have a question. How did you know this?

2 Likes

I made a guess, and then tried it out!

The guess came from past experience with 3D rendering and matrices.

If there’s one thing I recommend learning for game dev, it’s the basics of linear algebra. This whole series is fantastic: https://youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab

If you only have time to watch one video, chapter 3 is the most important IMO. Go in knowing that CFrames are rotation matrices. The video explains what a rotation matrix is :slight_smile:

That video may give you a sense of how I guessed that the “distortion” was caused by a non-orthogonal matrix.

4 Likes

Thank you very much. but I have one last question, How can I learn all about the lua language (Roblox Studio). I would like to learn everything that this platform gives and to be able to apply them, to be able to not get stuck when I create a script.