Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved Easing function used in SIGGRAPH 2019 Reactor vehicle camera talk?

Discussion in 'Cinemachine' started by codebiscuits, Nov 16, 2021.

  1. codebiscuits

    codebiscuits

    Joined:
    Jun 16, 2020
    Posts:
    28
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,233
    It's a custom thing we invented for the occasion. A and B pretty much correspond to the slope at the end points, and Bias applies an abscissa distortion to squeeze the curve to one side or the other.

    bias.gif
     
    Last edited: Nov 16, 2021
    codebiscuits likes this.
  3. codebiscuits

    codebiscuits

    Joined:
    Jun 16, 2020
    Posts:
    28
    Belated thanks! With this, and some help from some awesome maths people, I can now answer my own question.
    This function seems like a perfect match for the curves: https://www.desmos.com/calculator/ocvtvmwdyp
    upload_2021-12-9_19-35-4.png

    I've had a good verify of the function above, by overlaying the desmos graphs over the ones from the video.
    I implemented it like this, which I've eye-checked side-by side, but I've not done actual overlays:)
    Code (CSharp):
    1. //https://www.desmos.com/calculator/ocvtvmwdyp
    2. //Tested for 0<=t<=1; 0<=a<=1; 0<=b<=1; -1<=Bias<=1
    3. float CustomEasing( float t, float a, float b, float Bias ) {-1<=Bias<=1
    4.     var Bt = t / ( ( ( 1f / ( .5f - ( Bias / 2f ) ) ) - 2f ) * ( 1 - t ) + 1f ); //Biased T;
    5.     var y = ( 3*b + 3*a - 2 ) * Bt*Bt*Bt + ( -6*a - 3*b + 3 ) * Bt*Bt + 3*a*Bt;
    6.     return y;
    7. }
     
    Gregoryl likes this.