Showing posts with label Unity Mecanim Resources. Show all posts
Showing posts with label Unity Mecanim Resources. Show all posts

Saturday, February 23, 2019

Motion Builder and Unity Mecanim Retargeting




        Re-targeting and editing animations was going pretty well. It was nice to revisit Motion Builder. Everything was going fine in Motion Builder, until I baked my final animation from my control rig to the skeleton, and the character would be frozen on the last key frame he was on before baking. I don't know if this is a bug, but it can be a fatal error if you have spent hours to refine an animation, only to not be able to bake it back down to the skeleton and export it as an FBX.

        I took a break from MotionBuilder and hit the Unity documentation, learning how to re-target and edit animation clips in Unity. In the inspector, I learned how to retarget animations, make them looping, and edit the root transform. In order to zero out the position of the character, so that the character was moving in-place, at the origin, I had to edit the clip in the Animation editor. Imported animation clips are read-only by default, and there appears to be no way to unlock it. So, I had to create a copy of the mocap clips I wanted to use and edit the key frames of those.

        Unity documentation on looping animation clips in the engine:
https://docs.unity3d.com/540/Documentation/Manual/LoopingAnimationClips.html
https://docs.unity3d.com/Manual/LoopingAnimationClips.html

        This can be very useful, but is ideal for longer animation clips with more possibly matching parts. Otherwise, it can cause weird smooth "hicups" in the looping animation. For example, if you are trying to make a looping animation clip of someone walking or running, and the clip is not long enough, or does not have enough closely resembling parts, it can cause weird things to happen such as the feet sliding on the floor, or stuttering in the clip. Unity has nice tools to help create these looping animations very quickly, such as wire graphs. The wire graphs show if the two ends where you are cutting the clip short at will produce a seamlessly looping animation or not.

        In short, Unity offers the quickest, most efficient solution to re targeting and editing animations for the bare minimum of what one needs. However, if you want to do more, you will have to edit the animations manually in the Animation editor. Motion Builder, however, allows more precise control for editing animations, is more efficient because it allows the animator to use animation layers. Re-targeting in Motion Builder is more tedious, and so is creating looping animations, but you have more control.

Making read-only animations editable in Unity:
https://www.youtube.com/watch?v=cNnnaHqhks0

I still decided to fix my issue in Motion Builder since I may need to use it to create more precisely refined looping animation clips. The solution was very simple, don't delete the MoCap skeleton character until the animation is baked to the other character's skeleton, and the other character is not currently using the control rig, but it's original rig.

This guide to re-targeting in Motion Builder looks like it can be very helpful in the future if I were to get more in-depth into Motion Builder:
http://mocappys.com/retargeting-animation-motionbuilder/#.XHGKu-hKiUk

In the future, I think I will leverage both programs for what they do most effectively. Instead of re-targeting in Motion Builder, I think I will decide to edit the Mocap skeleton's animations in story mode to make them looping, then bring that into Unity and re-target there. However, there are still other nice features that Motion Builder offers. If I need to do something that requires precise control over part(s) of the body, such as closing the fingers to grip an object, like my character's rifle, Motion Builder allows for that. To solve this issue in Unity, I will need to use avatar masks for the hands.

In the future, I foresee that I may never need to use Motion Builder again, and will be able to pretty much do everything with re-targeting animations in Unity.

Friday, February 22, 2019

Unity Mecanim or Autodesk Motion Builder?

        I have determined that Unity's animation retargeting system in Mecanim can be very powerful, but that it is ideal if you already have finished animations. If I were, say, doing a project using primarily or almost entirely animations from the Unity asset store or some other online marketplace or community, then Unity Mecanim alone would be perfect. I would just funnel in the animations from all of these outside sources into my project and character.




        Straight away, it's pretty cool, you just drop your character rig into the project, and it automatically recognizes if if your character is in t-pose. You may need to configure the avatar, but you don't need to go through the tedious process of characterizing your character like in Motion builder. You can also correct your character, rotating the joints to fit t-pose, much like Motion Builder, but that's where the similarities end.

        I found this video training comprehensive overview of Mecanim very helpful, much of it was review, but still made certain things like Blend Trees easier to understand. Much of it was not review.

https://www.youtube.com/watch?v=wf6vtCgLk6w

        Most of what I needed to know was in the first half-hour. At 51:00, he mentions root transform offset and some other helpful things. At 1:15:00, mentions useful State Machine Behavior script components. Damping, 1:21:00.

        I discovered that one can do many interesting things in Mecanim, such as setting up muscle space, which is pretty much limiting the rotations on the character's joints, which can come in very handy if you want to make your character more or less flexible.
        I also hit Unity's documentation this week, exploring different things I can do in Mecanim.

https://docs.unity3d.com/Manual/animeditor-AnimationEvents.html



        While Mecanim is very powerful, editing animations in Mecanim seems to be very manual, setting keys and editing curves in a dope sheet much like Maya, Blender, or some other 3D package. My key-frame animation skills are not very good. In concept, I can manually edit animations in Mecanim. Even so, I feel that that would be very time consuming and inappropriate for this project and out-of-scope, considering the remaining time frame.

        Immediately after shooting MoCap, the animations are not ready to go into the engine. The MoCap rig rarely ever matches up perfectly or adequately with your character rig. So, editing always required, to ensure that the animation is in-place, and that the positioning of the limbs are correct so that there is no clipping. For this project, I need the extra functionality that Motion Builder has because it allows me to edit animations efficiently, via animation layers. The MoCap animations that I have are not finished, they are not in-place, and not yet suitable for use in Unity. For this project, I need to use Motion Builder.

         I can definitely see myself using Unity Mecanim in the future, so I do want to continue familiarizing myself with the capabilities that Mecanim has to offer, as I am very excited now that I have discovered these. I could possibly use it next quarter in New Media Project, or further along in the future, in place of Motion Builder, because Unity is free, Motion Builder is not.

Tuesday, February 19, 2019

Unity Mecanim Animation Retargeting

I already know how to retarget animations in Motion Builder, so now I will examine Unity, and see if I will utilize it instead. Unity seems like it can be a cost-effective alternative. I will use Unity if it is an effective tool that I can learn to use quickly. I have gathered some tutorials and Unity documentation links.

Tutorials:
https://www.youtube.com/watch?v=dDHltGGDrAA

https://www.youtube.com/watch?v=3TOJt9tntNI

https://www.youtube.com/watch?v=7yGBu97Oej0


Unity Documentation:
https://docs.unity3d.com/Manual/Retargeting.html


Wednesday, January 30, 2019

Spine IK

Controlling entire spine with Unity IK, may be useful in the future:

https://www.youtube.com/watch?v=gsVZOpMia7w

Aiming Without IK

Aiming by controlling the character's spine or chest bone without using Unity IK:

https://www.youtube.com/watch?v=6UgB7TMk3Bg

Controlling individual bones of a skeleton can be a useful alternative to Unity IK when only a simple solution is needed.

Foot Placement

More on foot placement/planting with Unity IK for the future. Some of these are too advanced for me to grasp at the moment, others may be very heplful as an introduction:

https://www.youtube.com/watch?v=NKIZCPenIas

https://www.youtube.com/watch?v=5eDt-bh9OTY

https://www.youtube.com/watch?v=MonxKdgxi2w

Sharp Accent 3rd-Person Tutorials

These are all of the tutorials from SharpAccent regarding 3rd-person character controllers:

https://www.youtube.com/channel/UCq9_1E5HE4c_xmhzD3r7VMw/playlists?shelf_id=10&sort=dd&view=50

They deal with climbing systems, 3rd-person shooters, and advanced 3rd-person character controllers. They will be integral in going into more depth on creating character controllers for 3rd-person games/shooters with advanced mobility mechanics.

To get started with the Advanced 3rd-person controller:
https://www.youtube.com/watch?v=3YTR_9_Trsg&list=PL1bPKmY0c-wnvW9F4BDJMwDHmq2SQ8m3L

More on foot placement with Unity IK:
https://www.youtube.com/watch?v=5eDt-bh9OTY

FPS and Climbing

This youtuber has many tutorials to do with First Person Shooters in Unity, as well as a climbing system tutorial series:

Main page:
https://www.youtube.com/channel/UCOTOF6DP6XxeBnyLRCS46kA

Climbing system:
https://www.youtube.com/playlist?list=PLZcQtrQ9JcLxzUwz1VvabjOVD64v1ixOG

Will I create a climbing system for my game? No, but I at least want a ledge grab, if I can fit it in, and for my character to grab or strike other objects. Also, the concepts behind these tutorials will be helpful in learning about and implementing Unity IK.

Unity IK Gotchas

This guy explains all of the problems that can happen when trying to get Unity IK, Animation Layers, and other features of Unity Mecanim to work together:

https://www.youtube.com/watch?v=RfQUosJh2DU

This one will be essential to troubleshooting problems that can occur when working with Unity Mecanim.

Sharp Accent Intro to IK

A helpful introduction to Unity IK, though I have not been able to implement the foot planting, and he gets into other advanced applications of Unity IK as well. I have a feeling that this one will be helpful in the future:

https://www.youtube.com/watch?v=EggUxC5_lGE

This is another youtuber that I highly recommend for getting tutorials for scripting and animation within Unity, though his are more advanced.

Unity Documentation, configuring the Avatar

Unity Documentation on correctly configuring the Avatar upon import. Also very helpful:

https://docs.unity3d.com/Manual/ConfiguringtheAvatar.html

Unity Documentation, IK

Unity documentation on Unity IK. This one has been helpful in getting me started with Unity IK, as I have been having some trouble grasping it to begin with.

https://docs.unity3d.com/Manual/InverseKinematics.html

Blend Trees 03

Another good tutorial on Blend Trees:

https://www.youtube.com/watch?v=YgaLKrSApWM

Blend Trees, Best Tutorial

This one is the most helpful regarding Blend Trees. Explains how to modify existing animations in Unity when making Blend Trees:

https://www.youtube.com/watch?v=E-zQw4GabKw

Blend Trees 01

Another Unity Official Tutorial, helpful in explaining Blend Trees:

https://www.youtube.com/watch?v=HeHvlEYpRbM

Animation Layers 03

This one was also helpful in giving me another perspective on Animation Layers and Avatar Masks:

https://www.youtube.com/watch?v=LXYq7Wo9DgE

Animation Layers, Best Tutorial

This one has been the most helpful in getting me into using Animation Layers/Avatar Masks in Unity:

https://www.youtube.com/watch?v=-SAnr8-Xfgg

This youtuber is very good. I recommend her to people looking to get into game scripting and and animation in Unity.

Animation Layers, Official Unity Tutorial

This one is very basic, but still helpful in introducing me to Animation Layers:

https://www.youtube.com/watch?v=fi4O1i8a2Ro

Henceforth, I will be posting all of the tutorials and resources I have been looking at during the past couple of weeks, plus the ones I will be looking at in the future while I work on this project. All of these resources are related to Unity Mecanim and scripting character controllers in the Unity Engine.

All Updated State Machines and Blend Trees

These are all of the State Machines and Blend Trees that I set up for my character in Mecanim: