FaceFx to Unity

Hi,

My team has been using Face FX for the Unity 3D engine. And I have a few questions on it’s integration with Unity.

Doug and the face Fx team have been pretty helpful in getting us started. I thought I’d post what I’ve learned here in case it’s helpful to anyone else.

In our project, we have some characters talking in Unity, there’s a base body animation, and dialogue animation (FaceFx) animating over it. So here’s what I’m doing:

1)I created the avatars in maya, then exported them using the Face Fx melscipt, like it says in this video:

http://www.youtube.com/user/facialanimation#p/u/20/2CyeB-mH81Q

I was able to export them over to Face Fx just fine, the only problem I have was editing the bone poses within maya itself. When I import bone poses, or animations, like shown in this video it’s like the bones shrink down to 0.

2) I’ll take that character into face Fx and create the animations for it.
When I’m done I open up the console tab,
and run the fg collpse command:

%fgcollapse -file "C:\Slade-Maya.facefx" -forcenodes "ImportantCombinerNodeName1|ImportantCombinerNodeName2";

I’m trying to keep the same name for .facefx file, the .FBX and the Actor(within facefx , when you go to rename actor in the Actor tab – the XML animation will refer to this name in code).

From there, I generate the .XML animation. All this stuff should be located in the same folder in Unity.

3) There is a simple example script in the Unity Demo example called “phraselocked”. In the very first lines I changed the variable “PlayerObejct” to the name of my character.
As I understand it, this identifies the character on the stage (the very topmost node of the game object that’s got the same name as the .facefx file).

Then, there’s another variable called “animName”, this says something like “Default_Phraselocked”. What I did was to change the “Phraselocked” piece to the animation’s name that I want to play.

I’m guessing that the “Default” part refers to the animation group on the character. This is all I needed to change on the script to get it running.

4) Next I took the FaceFx controller script and dragged it onto the character either in the hierarchy tab or directly on the stage. This will kill the prefab connection from the FBX, but it’s okay.

Next I reimported the character’s .XML file. This builds in the facefx_controller nodes onto the model in Unity. I gave the character an audio source too with the sound that matches the animation.

5) Finally, the phraselocked script needs to be in the scene in order for it to run, so I just dragged it onto the camera (you could put it on an empty game object too).

Permalink

My programmers have tied this together to some other scripts in order to create a dialogue system. The problem is they need it to talk to some other C# scripts. By any chance, is there a C# version of the Unity scripts available anywhere?

Permalink

I don't currently have C# versions of the scripts, but I'll make it a priority to create them. Things are a little crazy getting ready for GDC however, so it might have to wait until after the conference.

Thanks for the extra walk-through on this post. I'm sure someone will find it useful.

As far as having problems importing bone poses & animations in Maya, that is normally caused by bones that have locked attributes, or that are being driven by an IK/FK rig or some other input that is preventing the plugin from inserting keys. In most cases, bone poses can be exported without a problem, it's just setting keys from the plugin that is the issue. First try moving the bones and setting keys yourself...if you can't do it, the plugin won't be able to either.

I have converted the core Javascript files to C# in the Unity demo. You can now play the phraselocked demo using C# or Javascript. Email us offline if you need these.