Flat facial animation on 3D character

Hi,

This general question is not limited to only Maya, but other 3D modelling tools. I’m trying to create a 3D character that has a flat facial animation look and to use it inside Unity. The problem is I’m not sure how to do it.

  • Do I have to make shapes for the face expressions or can I use textures?
  • Should the facial animations be controlled by script in Unity or?

Here’s an example what I like to do:

Notice how the facial animation changes according to dialogue.

Hope someone can help me with this. Thanks in advace.
-Hakimo

Bump. If I’m posting this in the wrong forum please let me know :slight_smile:

Unity doesn’t support BlendShape animation, although I have seen some user based scripts for that. If you want to go with what’s built-in in unity, you have to do bone-based facial animations.

Take a look at http://unity3d.com/support/resources/tutorials/video-animation-view

You can do some 2D animation of the lips, eyes, etc. using Unity’s built in animation tools.

Thanks very much. Sorry for the late reply. I didn’t get any notification about it. I’ll take a look at the animation view :slight_smile:
-Hakimo

For this type of effect I think a texture atlas of the different facial expressions might work best. Then just change the UV offset parameter of the texture to get the desired expression to show up. There would be no blending, but it didn’t look like there was any in the video you linked either.

Hi, thanks for the reply. I have a new question. I’ve looked at the animation view tutorial and I’m finally able to make facial expressions and have it animated on a 3D character. Here’s a snippet of code:

if (currentSpeed > 0.1) {
		print("test");
		}
	else
		animation.CrossFade("idle"); //Physical animation
		meExpression.animation.CrossFade("MeIdle"); //Facial animation
		
	if (Input.GetButton ("Fire1")) {
		animation.CrossFade("search2"); //Physical animation
		meExpression.animation.CrossFade("MeSad"); //Facial animation
	}

Is there a way to manage animations? E.g When character jumps, play the facial animation and after jumping, stop the animation? I can’t use the !animation.IsPlaying for some reason. And from my example code above, everytime I press the fire1 button, it plays the search2 and sad animation but I can also see the MeIdle animations.

Hope someone can help.

Thanks very much
-Hakimo

You need to use animation Layers.

Thanks for the reply Fishman92. I’ve looked at animation layers and even animation.synclayer but I can’t seem to grasp on how to use animation layers. I have two game objects, each with an animation attached. One is for character body and the other one if for facial animations. Here’s a small snippet of what I’ve made:

var charExpression : GameObject;

function Start ()
{
	// We are in full control here - don't let any other animations play when we start
//	animation.Stop();

	// By default loop all animations
	animation.wrapMode = WrapMode.Loop;
	animation["walk"].layer = 3;
	animation["idle"].layer = 3;
	charExpression.animation["faceJump"].layer = 2;
	charExpression.animation["faceJump"].wrapMode = WrapMode.Clamp;
	

	// The jump animation is clamped and overrides all others
	var jump = animation["jump"];
	jump.layer = 2;
	jump.enabled = false;
	jump.wrapMode = WrapMode.Clamp;
        animation.SyncLayer(2);
}

function Update() {
        if (marioController.IsJumping())
	{
                charExpression.animation.CrossFade("faceJump");
		if (lastJump.time > landBounceTime) {
			lastJump.speed = 0;
		}
	}
}

The animations I should get is the jumping animation and facial animation to play at the same time. For now the facial works but it’s not playing the animated jumping of the character’s body. I’m a bit confused about how animation layer works but from I understand, what it does is basically grouping the animations yea?

Hope someone could help.

Thanks very much.
-Hakimo

Scrap that, again I’ve seen to have complicated things. This might be an easier solution, since I have the facial animations on another gameobject inside the character’s hierarchy, is it possible to call an animation event from another game object?

  • Hakimo

Discussed this with a Unity Evangelist. At the moment, I can’t call on a function of an animation of a another game object from the animation view editor. For now, scripting it is the only solution.

I saw blendshapes mentioned, but I don’t think the video you linked was using blend shapes, it just changed the texture. So you should make a texture atlas with different facial expressions in it and then move the UVs around to the ones you want, when you want them.

Yep already done that :slight_smile: I’m using the facial animation script from the Animation tutorial at unity3D. For now I can call the animation from script but I can’t call the animation in the view editor since it’s on another game object.
-Hakimo

How did you do it in the end?
Do you mind sharing your solution?

And did you do texture swapping?
As in have an eye texture, mouth texture etc that you replace

I am also looking to do something similar, so my thanks in advance!

In Max Maps are animate able like noise, but for a flat shape animation hmm … maybe morph modifier can help, in your 3d application make a face with different face textures then add them to your morph it and make them animate able, it should work imo

Hey Goshujin,

Welcome to the Unity Forums. Here’s a link that I use to start with. I used the C# version of the facialanimation code. In the vimeo video it shows how it works. Once it’s done it’s called like any other animations i.e. animation.Play("HappyFace");

Don’t forget to download the unity file from unity3d and watch the videos.

If you any more questions, feel free to ask :slight_smile:

-Hakimo

Hi Makan,

Umm I don’t think there’s any support yet for morph targets in Unity. Unless you know something I don’t know :wink: If yes, could you share me that link etc?

-Hakimo

Well i think we can make animations with morph then collapse it so that it change to editable poly or mesh in case unity don’t support it, then exported to fbx and bake the animations, and run it to unity…:slight_smile:

Awesome. Sorry for the late reply. I’ll try and see if it works :slight_smile: Have you tried it before?

Sir I have a 3d max fbx file.But i try animation 3d chracter but is no working in animation plz you are help me.