2D Light Flare/Glare Sprite Scaling

I succeeded in figuring out how far the camera is facing the object using print(workspace.CurrentCamera.CFrame.LookVector:Dot(flare_part.CFrame.LookVector)), but making it to scale a bit when the ray is near the wall. I have no idea to create a this feature that works. How can I achieve it? Any ideas with math or vector math and raycasts?

Also here is some informations/examples about “Flare/Glare Sprite Scaling” 2D Sprite things was used.

Point Blank (Roblox)

Garry’s mod (Source Engine, also can be performed on Half - Life 2 and Counter Strike : Source etc, other source engine games)

Thank you.