FOV decoupler function: modify horizontal and vertical fov

Earlier today I discovered a neat trick on complete accident that allows you to modify the horizontal and vertical field of view and I wanted to share it since it could have some cool use cases and it’s also pretty hilarious. It’s very buggy, may be prone to crashes and can break at any time, so I’d recommend to only use it for quick transitions and stuff or to just mess around.

Usage

The code sample below is a module script that I quickly made to test it out. squash should be a number similar to ParticleEmitter.Squash (values below 1 stretch horizontally, above stretches vertically and below 0 breaks the fabric of reality). camera is an optional parameter that allows you to specify which camera to modify.

Note that for this function to work in its current state it should be called on each frame after all camera manipulation stuff is completed unless CameraType is set to Scriptable, much like other camera functions.

--!strict
return function(squash:number, camera:Camera?)
	local currentCamera = camera or workspace.CurrentCamera or error('attempt to adjust fov scale with no currentcamera set')
	local cf = currentCamera.CFrame
	if squash > 1 then
		currentCamera.CFrame = CFrame.fromMatrix(cf.Position, cf.XVector / squash, cf.YVector, cf.ZVector)
	elseif squash < 1 then
		currentCamera.CFrame = CFrame.fromMatrix(cf.Position, cf.XVector, cf.YVector * squash, cf.ZVector)
	end
end

Again I want to reiterate that this could break due to updates, because at the end of the day it is a bug and much like negative reflectance it may just stop working at some point.

Module file:
FOVDecoupler.lua (476 Bytes)

14 Likes

no, it’s just a cool thing i discovered that allows to “stretch” the fov in a direction

3 Likes

if you can decouple them, might that make it possible for the numbers to exceed 120 fov

2 Likes

could be a cool thing to look into at some point but not with this implementation

Not really a new thing, camera CFrame matrix manipulation has existed for a while now

It is NOT a bug. It is a feature (an unintended feature) because of just how CFrames work lol

2 Likes

this is pretty cool, I’ve implemented it into one of my games.

is there a proper way to keep the vertical FOV the same regardless of the squash amount? (currently im just multiplying the vertical FOV by the same number as the squash but it seems a bit off)

1 Like

interesting, i wonder how long it’s been in the game then if that place was made in 2018

Probably since the dawn of Roblox. It’s just how CFrames work

1 Like

you should be able to use a squash value higher than 1, i’ve tested it with values between 2-6 and it seems fine to me as it’s only a scale of the horizontal fov if that makes any sense

I mean moreso with values less than 1, im using this to simulate using “stretched res”. after more experimentation I believe my method is as good as it gets for what I want.

edit: figured out this bit of code to make it perfect (kinda scuffed but it works)

FOVMult = 1 + ((1 - StretchAmt) / math.pi)
FOVMult = math.clamp(StretchAmt * FOVMult, 0, 1)
1 Like