Jump to content
  • Advertisement
Xavier Arias Botargues

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

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement

Mecanim is really the way to go, but, you would need to expend a good chunk of time trying to understand it. Then you would adopt the following workflow: Building the poses and interpolations outside Unity (most of the animations), build the transitions of animations inside Unity, and then you would add physical interactions and IKs over the animator. 

Edited by RenzoCoppola

Share this post


Link to post
Share on other sites

I could say that mecanim was thought mostly as a mocap tool. It's really smart in finding good transitions (starting a walk with left/right leg, etc.), interpolating complete baked animations (walk, run, left, right, etc.)... stuff like that, but you could also use handcrafted animations too. Maybe you can hack your way around mecanim, but don't try it. "Bake the animations", you will find it easier. I think the statemachinebehaviour doesn't give enough information to make a custom transition between two animations, and if you want to program things over mecanim, you must use statemachinebehaviours.

Edited by RenzoCoppola

Share this post


Link to post
Share on other sites
I don't have much Unity experience so can't help, but even if you have to completely bypass unity's animation system, you can write your own animation system and supply your own data to your own skinning shaders. Or you can CPU skin everything into your own vertex buffers.
So technically it will be possible somehow :wink:

Share this post


Link to post
Share on other sites
Definitely possible in unity. The bones in a rig mesh are simply unity game objects. Unity's built in animation just controls the bones using pre-baked animations but if you don't use premade animations you can manipulate the bones in anyway you want.

Share this post


Link to post
Share on other sites

It would be worth your while to simply grab Unity and learn Mechanim. It's not as complicated as you might imagine.

Share this post


Link to post
Share on other sites

Hi everyone,

 

thank you for your answers so far.

 

@RenzoCoppola @Khatharr I'm not currently searching for the standard way of animating through mecanim, we're already familiar with it on our company and have already used it on multiple titles.

When you animate a main character the mecanim trees that you need are usually very big and you spend a lot of hours animating all that.

 

As mentioned on my initial post, the new approach mentioned on the video is really interesting because it could allow us to reduce time spent animating and still provide very compeling results.

In fact, just having 2 poses as 2 animation clips and letting the linear interpolation animate it has good enough results, but we're looking for a way of having a better control, so we can have similar results to the one shown on the video.

 

@Hodgman: i'd love to avoid writing skinning from the ground up  :D

Let's hope it doesn't come into that, since that will probably mean that is more cost-effective to have the animators handle all that animation complexity and not craft an animation system for this.

Now that I have written this, it looks like that's what the overgrowth team did, since they seem to be using a custom engine or even not separating that as an engine at all.

 

@HappyCoder: how do you extract the pose info from the AnimationClip?

The first naive approach that I can think about is:

  1. Play the 1st animation clip so the bone-tree updates with the current pose.
  2. Store the 1st pose by getting the bone heirarchy from the scene.
  3. Play the 2nd animation
  4. Store the 2nd pose
  5. Interpolate between the 2 poses by interpolating on script.

The bad part about this is that we cannot use the OptimizeHierarchy https://docs.unity3d.com/ScriptReference/AnimatorUtility.OptimizeTransformHierarchy.html which would get rid of those gameobjects to get a nice performance boost on the CPU. It's become very standard for us to enable this on all skinned animations, specially on those that don't need any attachement (like swords, helmets... etc).

 

Thanks,

Xavier

Share this post


Link to post
Share on other sites

It takes hours and it doesn't scale really well... true, but that's the awful mecanim (I know the feels). Making every transition is painful too. I don't like the idea of patch-ups over the inbuilt system. Source code modifications are mostly out of play because of the new updates (but why not?). The prettiest solution would be to make a tool for the animator's animation toolstuff to help the workflow (you would probably just need to make some mirroring and automatic keyframe insertion + interpolation selection and parametization), but you could also go further, and if you are commited,  then making the system from the ground up would be a good solution. Hope my ideas could be insightful. 

Edited by RenzoCoppola

Share this post


Link to post
Share on other sites

@Xavier Arias Botargues It's not that complicated, you can simply:

1. create poses in Unity and serialize them in a custom format

2. create and save curves using builtin Curve window

3. Assign the curve and poses in a custom script

4. Interpolate poses using the curve at runtime

 

Here's script that let you pose character in editor: https://forum.unity.com/threads/set-up-ik-in-editor.332035/

 

All you lack is a state machine mechanism like mecanim which you can also implement yourself. But you can get away with just manage states in your script logic.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!