EzDistort - Simple Camera Distortion Module

Hello Devforum, I have come to announce EzDistort!
I decided to make this since i’ve seen a few other games (namely dzielnica’s Moncy Half and Combat Initiation’s Witches Brew) use these kinds of distortions and wasn’t really sure how to do them for the longest time.

What is it?

EzDistort is a quick and easy way to add distortion, nasuea, scaling, and other camera effects. It lets you mess with the camera’s render matrix in pretty funky and strange ways.

It allows for any custom distortion that you may desire.

Shear! R01, R10
ShearFFmpegOutput

Stretch! R02, R12
StretchFFmpegOutput

Scale! R00, R11
ScaleFFmpegOutput

Translation! (kind of, its a little more complicated) R20, R21
TranslationFFmpegOutput

and Zoom! (Not FOV) R22
ZoomFFmpegOutput

Setup

Super duper easy!
Just require the module and make a new object, then enable the effect, they start disabled by default.

local EzDistort = require(...) --module path
local DistortionObject = EzDistort.new()
DistortionObject:Enable()

When creating a DistortionObject you can pass through DistortionObjectParams as an argument, which is a table of the following type:

EaseTime: number; -- How long the DistortionLerp takes to reach DistortionTarget
FadeTime: number; -- How long DistortionLerp takes to reach the identity when disabled
Priority: number; -- Sets the RenderPriority to [201+Priority], allows for multiple distortions to be stacked one after the other.
DisableClamps: boolean; -- Disables distortion clamps, not recommended as super high or low values will usually completely break the effect.
TargetCamera: Camera?; --Target camera to apply distortion on, will default to workspace.CurrentCamera if not set.

Then we can apply any effects we want!

DistortionObject:SetScale(x, y)
DistortionObject:SetShear(x, y)
DistortionObject:SetStretch(x, y)
DistortionObject:SetTranslation(x, y)
DistortionObject:SetZoom(Zoom)

Alternatively, you can also use a NamedDistortionMatrix, which just gives a more compact way of applying effects.

--this is just the identity matrix
DistortionObject:FromNamedDistortionMatrix(EzDistort.newNamedDistortionMatrix({
	ScaleX = 1;
	ScaleY = 1;
	ShearX = 0;
	ShearY = 0;
	StretchX = 0;
	StretchY = 0;
	TranslationX = 0;
	TranslationY = 0;
	Zoom = 1;
}))

You can also use a DistortionPreset, presets can be found in EzDistort.DistortionPresets
These are mostly just for showcase and not useful in any way.

local EzDistort = require(game.ReplicatedStorage.EzDistort)
local DistortionObject = EzDistort.fromDistortionPreset(EzDistort.DistortionPresets["PRESET HERE"])
DistortionObject:Enable()

If you want to disable the effect, just disable it, or reset it back to it’s identity matrix.

DistortionObject:Disable() -- will use FadeTime to ease back
DistortionObject:ResetToIdentity() -- will use EaseTime to ease back

Cool Examples

Just some cool things I found you can do with this, thought it was worth sharing.

Extreme FOV

Can finally have FOV over 120.
Camera.FieldOfView = 120
DistortionObject:SetScale(.05, .05)

Upside Down Land

Something something australia joke
DistortionObject:SetScale(-1, -1)

Z-Rotation (?)

I guess this one makes sense since youd be undoing the "shearing" effect on both ends which just leaves you with a rotation.
DistortionObject:SetShear(-.5, .5)

Mesh-Inversion

This one is probably my favorite. It just looks so weird.
DistortionObject:SetScale(-1, 1)

I would also like to shoutout @Maximum_ADHD for making Super Camera Skewer as it helped me understand what exactly the transformations were doing to the camera.

Download:

.rbxm [Version 1.15]:
EzDistort.rbxm (18.1 KB)

Please credit me somewhere if you use my work! Feel free to use or adapt beyond that.

52 Likes