Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing vcam's FOV during a transition, there is a glitch #10

Open
glabute opened this issue Mar 1, 2019 · 5 comments
Open

Changing vcam's FOV during a transition, there is a glitch #10

glabute opened this issue Mar 1, 2019 · 5 comments

Comments

@glabute
Copy link
Collaborator

glabute commented Mar 1, 2019

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.

@LinkAgm
Copy link

LinkAgm commented Jan 13, 2022

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.

@LinkAgm
Copy link

LinkAgm commented Jan 13, 2022

I think the error is inside here

static float InterpolateFOV(float fovA, float fovB, float dA, float dB, float t)

@LinkAgm
Copy link

LinkAgm commented Jan 13, 2022

@LinkAgm
Copy link

LinkAgm commented Jan 14, 2022

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));*/
    }

@glabute
Copy link
Collaborator Author

glabute commented Jan 26, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants