Facial animations + movement
by Luis Anton · in Torque Game Engine · 12/09/2004 (2:57 am) · 4 replies
Hi!
We have created some facial animations for our models (talk, happy, sad, angry, scared and blink). We were not really sure how to combine them with the standard animations (root, run...), so we finally included all facial animations in the dts file, because facial anims used morphing instead of bones, and defined root and run in the usual way (dsq files, sequence0 = root, sequence1 = run...). Exporting the morph animations as dsq crashed the engine.
Now, when we see the model in the show tool, all facial animations come first in the sequence list (and work properly), and then those we loaded from dsq files. The engine expects root to be the first sequence, run to be the second and so on... but instead of root it's 'talk'. This way, standard animations don't work in game. If we don't export facial animations and leave just root and run as dsq files, everything works perfecty.
So my question is: how could we add morph animations (facial) so stardard animations still work?. If there is no standard way, I'll just rewrite Player::pickActionAnimation() and forget about standard sequences...
See you!
We have created some facial animations for our models (talk, happy, sad, angry, scared and blink). We were not really sure how to combine them with the standard animations (root, run...), so we finally included all facial animations in the dts file, because facial anims used morphing instead of bones, and defined root and run in the usual way (dsq files, sequence0 = root, sequence1 = run...). Exporting the morph animations as dsq crashed the engine.
Now, when we see the model in the show tool, all facial animations come first in the sequence list (and work properly), and then those we loaded from dsq files. The engine expects root to be the first sequence, run to be the second and so on... but instead of root it's 'talk'. This way, standard animations don't work in game. If we don't export facial animations and leave just root and run as dsq files, everything works perfecty.
So my question is: how could we add morph animations (facial) so stardard animations still work?. If there is no standard way, I'll just rewrite Player::pickActionAnimation() and forget about standard sequences...
See you!
#2
12/09/2004 (12:31 pm)
Using bones is the best choice. For the facial animations, export the animations ONLY for the face bones. Then, when playing them back in your engine, play them at a different thread.
#3
We have no bones in our model's head, all our facial animation is morphing. We are already able to combine a classical bone animation like 'root' with our face animation 'talk', in diferent threads, so models 'breath' and 'talk' at the same time. No problem with that.
The 'only' problem we have is that, because we must export all those morph animations with the dts file, our animation sequence order is the following:
//morph animations (facial animations), loaded from the dts file
talk
happy
sad
angry
scared
blink
//bone animations, loaded from dsq files
Root
run
So when the 'standard animation code' tries to animate the model, it uses talk and happy, instead of Root and run.
I'll try to alter the player's code (animations enum definition, pickActionAnimation function...) in order to ignore the first 6 sequences, and behave like it used to from the 7th and above.
12/09/2004 (1:07 pm)
Let's see....We have no bones in our model's head, all our facial animation is morphing. We are already able to combine a classical bone animation like 'root' with our face animation 'talk', in diferent threads, so models 'breath' and 'talk' at the same time. No problem with that.
The 'only' problem we have is that, because we must export all those morph animations with the dts file, our animation sequence order is the following:
//morph animations (facial animations), loaded from the dts file
talk
happy
sad
angry
scared
blink
//bone animations, loaded from dsq files
Root
run
So when the 'standard animation code' tries to animate the model, it uses talk and happy, instead of Root and run.
I'll try to alter the player's code (animations enum definition, pickActionAnimation function...) in order to ignore the first 6 sequences, and behave like it used to from the 7th and above.
#4
PLAYER.CC
This way, facial animations are registered before any kind of bone animations.
Then, in player.cc:
Then in PickActionanimation:
Well, that '5' is quite a hack. Better use a constant defined in player.h. It stands for the amount of morph animations before the root animation.
And it's done. This way, standard animations work perfectly, and using a different thread it is possible to combine bones and morph animations, so models can walk and talk at the same time.
I hope someone will use it :)
12/09/2004 (11:58 pm)
OK, I did it. Here are the modifications to Player.h and Player.cc:PLAYER.CC
enum {
// *** WARNING ***
// These enum values are used to index the ActionAnimationList
// array instantiated in player.cc
[b]
// Facial Animations
TalkAnim,
SadAnim,
AngryAnim,
SmileAnim,
ScaredAnim,
BlinkAnim,
[/b]
// Movement
RootAnim,
RunForwardAnim,
BackBackwardAnim,
SideLeftAnim,
// These are set explicitly based on player actions
FallAnim,
JumpAnim,
StandJumpAnim,
LandAnim,
[b]
NumMoveActionAnims = SideLeftAnim + 1 - (BlinkAnim +1),
[/b]This way, facial animations are registered before any kind of bone animations.
Then, in player.cc:
PlayerData::ActionAnimationDef PlayerData::ActionAnimationList[NumTableActionAnims] =
{
// *** WARNING ***
// This array is indexed useing the enum values defined in player.h
//Facial animations
[b] { "extalk" },
{ "exsad" },
{ "exangry" },
{ "exsmile" },
{ "exscared" },
{ "exblink" },
[/b]
// Root is the default animation
{ "root" }, // RootAnim,Then in PickActionanimation:
[b]for (U32 i = 5; i < 5+PlayerData::NumMoveActionAnims; i++) [/b]
{
PlayerData::ActionAnimation &anim = mDataBlock->actionList[i];Well, that '5' is quite a hack. Better use a constant defined in player.h. It stands for the amount of morph animations before the root animation.
And it's done. This way, standard animations work perfectly, and using a different thread it is possible to combine bones and morph animations, so models can walk and talk at the same time.
I hope someone will use it :)
Associate Logan Foster
perPixel Studios
1. Export the head as a seperate DTS and then mount it in place via code.
2. Setup a custom skeletal rig that deforms the face and then export it with your model. You will have to redo the other player animation sequences too, but this way you get proper animation blending.