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.
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.
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)
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)