Tuesday, October 27, 2009

FaceFX in UnReal: Part 1

FaceFX is a facial animation software and it is natively supported inside UnReal Editor. If you have a need to do Machinima and your characters need to talk or show some animated expressions, then you need FaceFX. In the absense of any documentation or decent tutorial on how to do this, it was a real nightmare for me to figure out how to pull it all together. I want to thank Dave Tyner (from http://www.treadster.com) for patiently helping me out on this one. A big shoutout to you!

OK. On with the tutorial. As usual, I will just keep it as brief and as simple as possible so readers are not bogged down by details. You can work on the details once you have figured out how to get this thing working.


You need the FaceFX plugin for 3DSMax in order to export FaceFX animations. If you have patched your Unreal, just do a .dlu search.


Choose the version that matches your 3DSMax (version 9 worked with Max2008) and put it into the plugins directory and run Max.


You can then access FaceFX plugin under Utilities.


Next you will need the Gear_Marcus.max character, downloadable from UDN. Observe how they rigged the face. You can apply the same rig to your custome character that you want talking.


First, the easy bit. Using ActorX, export Marcus's head.


Then, with FaceFX opened, Create Actor.


Select all the bones you want to export and Export them under Reference Bones.


It should look like this.


Scroll down to Bone Poses. The Marcus character comes with some nice animations so you can scrub through and find the facial poses that you like. Export a set of poses.


These are the Phonemes I need for my custom animation.


Save it to create a .fxa file.

That's it for Part 1. In Part 2, we will work with UnReal Editor to get things cooking!

Friday, September 18, 2009

Custom Character in Unreal: Part 2


You will need to make a special material for the Custom Character called MaterialInstanceConstant. This is required for team faction colours and other multimplayer modes. Just right click on the grey area like in the picture.


Go to the CH_All package and select the IronGuard Base Material.


Apply it to your MIC Material under FontParameterValues->Parent.



Apply the relevant textures to the relevant slots.





Next, all the meshes have to be realigned so that the Z Origin is -51 and the RotationOrigin's Yaw is -90. You need to do that or else the character will not be aligned properly. Why is it misaligned in the first place, ask Epic.


Assign the proper materials to the meshes.


Assign sockets to the arms so Unreal knows where to place the weapons.
b_LeftWeapon -> DualWeaponPoint
b_RightWeapon ->WeaponPoint




When you run Unreal, the UTCustomChar.ini file will have added your custom char data to it. If somehow things screw up, delete the new entries in this file, hack the files in your Published/CookedPC/CustomChars directory and try again.

The next series of pictures show you how to access the custom charater. If everything was done right, you should be getting these results.











The character is intentionally pink/maroon and different so I know it was successfully working and not using the standard Unreal IronGuard


NOTE: If your character does not appear in the game (and the game did not crash), there are two possibilities: Unreal cannot find the package (some issues with your naming and directory structure) OR your character can be found, just that it's wayyyyy off coordinates. Reset the pivot points to (0,0,0) and that should fix it.

Custom Character in Unreal: Part 1

If you want to create your own character and select in in Unreal and play with that character, then this next quick tutorial will show you how. I will just use the IronGuard character with some modified textures so everyone can do this tutorial fairly quick and dirty without begin bogged down with small details like modeling, rigging, UVW Mapping. Once you know how to export and import into Unreal and set it up, you can concentrate on the small details thereafter.


First, notice the IronGuard character is built in parts. This is to facilitate swappable body parts within Unreal. Export the individual parts in PSK files. You should have:

YourCharacter_Head
YourCharacter_FaceMask (Optional)
YourCharacter_Torso
YourCharacter_Thighs
YourCharacter_Boots
YourCharacter_Arms
YourCharacter_Helmet (Optional)
YourCharacter_LShoPad01 (Optional)
YourCharacter_RShoPad01 (Optional)




In your Generic Browser, Import all these PSK Files.


Next, Import all the textures for the character as well as the mugshot (512x512 image).


Remember the name of your package and the group these textures are allocated to. Here, my package is named KevinPackage and the group (subdirectory) where the texture files are located are under "Textures". Depending on the texture, under LODGroup, make sure it is the correct "type" of texture eg:


The mugshot is a UI Texturegroup.


A Normal Map for a Character obviously goes to the TextureGroup_CharacterNormalMap.


You can see that the Textures are located in the Textures Group of the KevinPackage package.


In order for Unreal to run your custom package, it has to be saved in the UTGame/Published/CookedPC/CustomChars directory. Make the directory if it does not exist.


Make a directory within the CustomChars directory, in my case, SmileyBoy, and you should have two files in there: UTCustomChar.ini and YourCharName.int file.



Notice the .ini file has a "+" sign. This will "add" custom code to your main UTCustomChar.ini located in the UTGame/Config directory. Do not hack that file directly. Just in case anything screws up, you can then hack the main UTCustomChar.ini and remove the offending code. Remember to save the file after that.


Just to give you a visual explaination what the lines of code mean. If your character uses another character template, obviously it cannot be "IRNM" (IronGuard Male).

To be continued in Part 2