Answered

How to remove a property so it is not animated?

Alan Kent 5 months ago updated 5 months ago 5

I am making progress! But if I understand by looking at the exported clips in the Unity animation clip panel, it looks like clips are exported with all properties, not just the ones that are keyed in the clip. I want to create clips for different subsets of properties so I can have a clip "Eyes Left" which only animates the eyes. Then I can layer this on top of other clips so walking I can add "Eyes Left" and keep the rest of the normal clip.

I was wondering if the correct approach was to remove the unwanted properties, then "Save Reference Pose" (?), but I could not work out how to remove the properties that it picked up from the Humanoid bones.

I don't want to use a Generic project type as then I cannot load up my character and do the animations on it - it tells me I must use a humanoid project for humanoid characters. I guess I could try and trick it with a proxy object or something...?

For eyes, because I have a script controlling them (custom properties) I only want to capture the custom properties for the "Head" layer (that is where I added the custom constraints, alongside the other blendshapes). Oh, and I don't want the blendshapes included either - I want to create a separate set of clips for blendshape controls (for different facial expressions).

I am planning to create a project per layer of clips - e.g. on project for eye overrides, one for facial expressions (blendshapes and textures), one project for hand positions, etc. I am hoping I can then define different sets of properties per project (put all the hand position clips in the hand project, put all the eye clips in the eye project, etc).

Then the final timeline I pick a full body clip (e.g. walking or sitting, and start layering expressions, eye control, head turns, and hand pose etc clips in override tracks in the Unity timeline).

Is this possible?

UMotion Version:
Unity Version:

Answer

Answer
Answered

Hi Alan,

thank you very much for your support request.

Humanoid always exports all humanoid bones. Humanoid doesn't work well when not "well-formed" (i.e. doesn't include all curves). Unity also only creates well-formed humanoid animations when creating them from imported animation. If you have no keys on humanoid bones, they are stored as "constant" curves in the humanoid animation (thus only add very little memory to the animation).


Generic bones on the other hand are only added to the animation if they have at least one key. You can completely remove generic bones from the "Animated Properties List" by setting their visibility to "Locked". This also ensures that they are not added to the animation even if you have previously created key frames for them.

I was wondering if the correct approach was to remove the unwanted properties, then "Save Reference Pose" (?), but I could not work out how to remove the properties that it picked up from the Humanoid bones.

Regarding the reference pose, please check out the following video tutorial: 

I don't want to use a Generic project type as then I cannot load up my character and do the animations on it - it tells me I must use a humanoid project for humanoid characters

You can configure a character as Humanoid, Generic or Legacy (in the Inspector "Rig" tab when selecting your character). Humanoid is Unity's animation re-targeting system. Generic is playing animations directly (without re-targeting). More information on humanoid: https://blogs.unity3d.com/2014/05/26/mecanim-humanoids/

For eyes, because I have a script controlling them (custom properties) I only want to capture the custom properties for the "Head" layer (that is where I added the custom constraints, alongside the other blendshapes). Oh, and I don't want the blendshapes included either - I want to create a separate set of clips for blendshape controls (for different facial expressions).

You could duplicate your character and configure it as generic. Use the duplicated version to animate all the none-humanoid bones. You can also remove the eyes from your humanoid avatar (Inspector of your character --> Rig tab --> Configure...) as you're driving the eyes from custom scripts anyway. Create a new UMotion humanoid project, now the eyes should not be included anymore.

Please let me know in case you have any follow-up questions.

Best regards,

Peter

GOOD, I'M SATISFIED
Satisfaction mark by Alan Kent 5 months ago

Just noting using a Generic project type did only generate the custom properties I animated, so I created a dummy object and got eyes going (but not using real character, so I could not actually see the eyes moving). I assume it is generating all the muscles from the Avatar for the reference pose (or similar).

Answer
Answered

Hi Alan,

thank you very much for your support request.

Humanoid always exports all humanoid bones. Humanoid doesn't work well when not "well-formed" (i.e. doesn't include all curves). Unity also only creates well-formed humanoid animations when creating them from imported animation. If you have no keys on humanoid bones, they are stored as "constant" curves in the humanoid animation (thus only add very little memory to the animation).


Generic bones on the other hand are only added to the animation if they have at least one key. You can completely remove generic bones from the "Animated Properties List" by setting their visibility to "Locked". This also ensures that they are not added to the animation even if you have previously created key frames for them.

I was wondering if the correct approach was to remove the unwanted properties, then "Save Reference Pose" (?), but I could not work out how to remove the properties that it picked up from the Humanoid bones.

Regarding the reference pose, please check out the following video tutorial: 

I don't want to use a Generic project type as then I cannot load up my character and do the animations on it - it tells me I must use a humanoid project for humanoid characters

You can configure a character as Humanoid, Generic or Legacy (in the Inspector "Rig" tab when selecting your character). Humanoid is Unity's animation re-targeting system. Generic is playing animations directly (without re-targeting). More information on humanoid: https://blogs.unity3d.com/2014/05/26/mecanim-humanoids/

For eyes, because I have a script controlling them (custom properties) I only want to capture the custom properties for the "Head" layer (that is where I added the custom constraints, alongside the other blendshapes). Oh, and I don't want the blendshapes included either - I want to create a separate set of clips for blendshape controls (for different facial expressions).

You could duplicate your character and configure it as generic. Use the duplicated version to animate all the none-humanoid bones. You can also remove the eyes from your humanoid avatar (Inspector of your character --> Rig tab --> Configure...) as you're driving the eyes from custom scripts anyway. Create a new UMotion humanoid project, now the eyes should not be included anymore.

Please let me know in case you have any follow-up questions.

Best regards,

Peter

Thanks for the detailed information. I have got things going reasonably well now using Avatar masks and humanoid clips. So making progress.


I just wanted to clarify one point - you mentioned "You can configure a character as Humanoid, Generic, or Legacy. When I create a Generic project and drag the character into the pose panel, I get this error. So I cannot use a humanoid character as the pose target for a generic project.

I think what you are saying is to duplicate the character, then remove the "humanoid" from the clone - that way UMotion will allow me to do a generic project using the clone. That makes sense. I will give that a go!

Note: I am kinda doing something similar already. Rather than load up all the characters using FBX versions, I exported one character to create a FBX file, then imported it back in, tweaked it a bit to add all the missing C# scripts, then am using that as the pose character for all animation clips. The real scenes use the real characters (not the FBX files) with the animation clips. Seems to be working so far!

What I have found however is animation clips and clever scripts often don't go well together. For example, I believe I should be able to use LastUpdate() to override the direction the head is facing via a script. But it has not worked very well in practice (frequently does not update the head direction). So for expediency, I have created "Look Left" and "Look Right" etc animation clips and just do it by hand (with an Avatar mask). It's good enough and pretty robust.

When I create a Generic project and drag the character into the pose panel, I get this error. So I cannot use a humanoid character as the pose target for a generic project.

Yes, the UMotion project must match the configured rig type of your character (i.e. a humanoid character is only compatible with a humanoid project, ...).

I think what you are saying is to duplicate the character, then remove the "humanoid" from the clone - that way UMotion will allow me to do a generic project using the clone. That makes sense. I will give that a go!

I think you might be misunderstanding the term "humanoid" (it's a bit misleading). "Humanoid" is the name of Unity's animation system that implements animation re-targeting. It is named "humanoid" because it is only compatible with human like biped characters. You can configure human like characters as generic, which is then using the regular animation system (without animation re-targeting). There is no need to delete the actual human character from the fbx file.

So what I was trying to say is, duplicate your character and configure the duplicated version as "generic". Then you can assign it to a generic project. When you only create keys for the custom properties in that project, only those are getting exported.

For example, I believe I should be able to use LastUpdate() to override the direction the head is facing via a script.

Yes, LateUpdate() is called after the animation system is executed (thus allows you to override the animation). This should work well (I've been using this myself several times). Make sure that you haven't called the method "LastUpdate()" (that method would not be called by Unity, unfortunately it also won't create a warning/error message). You can test if your method is called by placing a Debug.Log("called"); statement in it.

I hope this makes sense, let me know if anything is not clear.

Best regards,
Peter

Thanks for the extra time. Still learning. I have a basic understanding of avatars and humanoid - what i was less familiar with is the “import settings”. I have been using VRoid characters imported using UniVRM which just creates a prefab with avatar - there are no import settings to change. 


With the imported fbx file I can see how i can change the object type from humanoid to generic in combination with the different project type. I will give that a go. (I cannot load the VRoid character into a generic or humanoid project without exporting as fbx then reimporting back into unity.)