Open glabute opened 5 years ago
The interpolation of FOV is always wrong! Try to blend between two Vcams with different FOV; the values start to grow normally but do not reach the final weight and then abruptly change to the final result.
https://user-images.githubusercontent.com/52554257/149371027-cdb79d42-e3eb-42f5-83dd-1df50d645784.mp4 One Vcam with FOV 50 and the other with FOV 60.
I really appreciate the fact that is an open package. I temporarily changed that function with this:
static float InterpolateFOV(float fovA, float fovB, float dA, float dB, float t)\n
{
// We interpolate shot height
//float hA = dA * 2f * Mathf.Tan(fovA * Mathf.Deg2Rad / 2f);
//float hB = dB * 2f * Mathf.Tan(fovB * Mathf.Deg2Rad / 2f);
//float h = Mathf.Lerp(hA, hB, t);
//float fov = 179f;
//float d = Mathf.Lerp(dA, dB, t);
//if (d > UnityVectorExtensions.Epsilon)
// fov = 2f * Mathf.Atan(h / (2 * d)) * Mathf.Rad2Deg;
return Mathf.Lerp(fovA, fovB, t); /*return Mathf.Clamp(fov, Mathf.Min(fovA, fovB), Mathf.Max(fovA, fovB));*/
}
Thanks for your remarks.
The reason that the FOV interpolation is not implemented as a simple lerp is that the visual effect of a linear lerp is nonlinear in appearance because the effect on image size is not linearly related to the FOV. Instead, we do a linear lerp on the target size, which gives a better result.
I can't repro the pop that you describe. When I blend vcams with different FOVs it always blends smoothly. I suspect that the change to CM that you made is compensating for an issue elsewhere in your project.
While transitioning from Vcam1 to Vcam2, and if changing Vcam1's FOV during that transition, there is a glitch in transition which happens at the time when FOVs of both cameras become equal.