Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Is procedural animation by poses based on Overgrowth possible on Unity?

Discussion in 'Animation' started by metalbass_92, Jan 9, 2017.

  1. metalbass_92

    metalbass_92

    Joined:
    Jan 9, 2017
    Posts:
    3
    Hi everyone,

    I've seen on a gdc video from 2014 (http://www.gdcvault.com/play/1020583/Animation-Bootcamp-An-Indie-Approach) where a nice technique to animate characters (and other objects) is used by just using static poses, that will be interpolated to produce the animations. The dev that talks about this has used this on Overgrowth, an early access title on Steam. I don't know what the game is made on, but it's not made on Unity, AFAIK. I've been trying to approach that with Unity, since it looked like a good idea.

    In order to test this I thought I could animate a hand (e.g. that could be used in an FPS). I've generated AnimationClips with 3 poses (open hand, closed fist and pointing with index finger), so I can interpolate between them to get the animation of closing and opening the hand.

    I've put those clips into an Animator and got them to interpolate linearly between them. It looks OK, but I need to control the interpolation, so I can get the nice interpolations that can be saw on the video (around 7:00 and 8:00).

    In order to have better control, I set up a blend tree between the the open hand pose and the pointing pose and controlled the blending by code. This allows me to control the interpolation a bit, but still doesn't allow me to interpolate out of the [0, 1] range, as the blend tree seems to clamp it. I assuem that if I want to mimic what is shown on the GDC video at 8:00, I need to go out of the [0, 1].

    I'm thinking that it may be that Unity is not exposing features for this to possible or nice to implement, since it seems like a non-standard approach to me. What do you guys think? Am I just overlooking the feature that will allow me to do that?
     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Have you looked into animation curves? Im not intimately familiar because I generate my animations externally using curve controls in Max - but this may be what you are looking for.
     
  3. metalbass_92

    metalbass_92

    Joined:
    Jan 9, 2017
    Posts:
    3
    Hi theANMATOR2b,

    I have used those curves on custom monobehaviours and I've also used them in the standard fashion (between keyframes of an animation).

    I don't see how I can use them for what I want.

    What I'm trying to do here is control the interpolation between the poses (1-keyframe animations). While I'm able to interpolate linearly with just playing a different animation clip from the animator, I lack the control about the interpolation that I need.

    Thanks
     
  4. NeilW

    NeilW

    Joined:
    May 29, 2014
    Posts:
    40
    To get the exact set up displayed you would need to go outside of the 0-1 range and would then be extrapolating (rather than interpolating) - I wouldnt be suprised if this isn't supported. However you could get something virtually the same by just changing the range slightly so that the limits of the bounce are in the range 0-1.

    I believe the suggestion to use AnimationCurve is that this is a nice way of allowing you to visually create the transition curve between your animations rather than doing this programatically (Would mean this can then be given to an animator to polish etc)
     
    theANMATOR2b likes this.
  5. StarloopStudios

    StarloopStudios

    Joined:
    Jan 11, 2017
    Posts:
    4
    Hi NeilW,

    that's correct, it can be considered extrapolating, but it's completely possible to extrapolate with an unclamped lerp, as the linear function used to interpolate is also defined outside of the [0, 1] range of t. You can check here: http://answers.unity3d.com/answers/953610/view.html

    When we talk about using AnimationCurve I never know if you're refering to using it inside the Animation window, to edit AnimationClips or to use it from code or any other method that I don't know about?. Can you clarify?

    Thanks
     
  6. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I've done overgrowth's animation tweening via AnimationCurve in unity myself - works fine. You're after all, using the curve to create an expressive lerp. You can pass this final value in to a blend tree or time.
     
    limaoscar, akelian and theANMATOR2b like this.
  7. metalbass_92

    metalbass_92

    Joined:
    Jan 9, 2017
    Posts:
    3
    Hi Digital Ape,

    can you elaborate a bit on your setup?

    My first test was basically a state for each pose, but that was without blend trees. When I added a blend tree, I put that inside of a state.

    I understand that this makes states represent transitions. Is this how you set it up?

    Also, I imagine that you put a script into each state, so the blendtree can be modified from there. The issue is that I haven't been able to access the blendtree and instead had to use a string to access the float that tweaks the blend tree.

    Thanks
     
  8. NeilW

    NeilW

    Joined:
    May 29, 2014
    Posts:
    40
    Using a parameter to control the blend is what you should be doing (for performance reasons you may wish to store a hashed version of the parameter name rather than using the string directly - https://docs.unity3d.com/ScriptReference/Animator.StringToHash.html).
    At run time you don't have access to the blend trees themselves instead you just set parameter(s) to control the blends. The reason for using a blend tree rather than state transitions in this case is because you just want to be able to freely move the blend parameter backwards and forwards and have it respond instantly. State transitions have their own timings, rules about if they can be interrupted etc.
     
  9. Bazz_boyy

    Bazz_boyy

    Joined:
    May 22, 2013
    Posts:
    192
    Reviving this thread for more answers.

    Does anyone know how you extrapolate with blend trees? I tried changing the threshold so that its a little bigger than 1 (I interpolate between 0 - 1). however, that just stretches blend over the extra time, so when the blend param returns to 1, the animation isn't proper, it's still a blend between the former animation.

    Am I doing something wrong?
     
  10. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I haven't tried it for regular anims but if you're using blendshapes then you can do so by disabling "Clamp BlendShapes (Depreciated)" option in project settings / player.
     
  11. Bazz_boyy

    Bazz_boyy

    Joined:
    May 22, 2013
    Posts:
    192
    Must be in a newer version of unity (im on 2017.4 ) because I cant find it.. But thanks for letting me know it exists! Apparently theres a new feature i n Unity 2018 for unclamped blendshapes.. https://forum.unity.com/threads/removing-clamping-of-blendshapes-to-the-range-0-100.504973/
     
  12. RIPANN

    RIPANN

    Joined:
    Aug 9, 2017
    Posts:
    9
    Hi hippocoder,
    Its cool that you have implemented this successfully.

    I have been trying to implement this for a month now. I am able to blend between animation poses to get a running cycle working. I am using 2D blend tree with Animation curve. But I am stuck with the jerk motion between the pose transition.

    Any suggestion about how to smooth out the transitions between the poses or what was your approach, will be very helpful.