Alvar007

Creating new facial animations

Recommended Posts

Hello there, I'm kind of new here with this being my first post but I have had this account for some years now and I also did some modding to this game back in summer 2015.

Now I have been messing around with the new tools and I was interested in KotorBlender to create new animations since that's the program I recently learned for modding Jedi Academy as well and I am quite comfortable with it now. So my intention was to create new facial animations but I wasn't sure of the capabilities this plugin offered. I was quite glad when I found out that it has been recently updated and it fully supports animations as well as other models properties.

But when I imported a head I was quite surprised to see that the bones in this game are not really bones like Jedi Academy for example but objects that act like such. Thus, I couldn't attach them to the mesh to see how it deformed when trying to create an animation. So I tried creating a temporary bone rig in blender that you could use and attach each bone to each object so that when you move a bone the object also moves. This may seem like it's working on paper but I had so much trouble with transforms that I almost gave up. They are a real pain in the ass.

First I tried animating the bones and the objects apparently move with them but in reality they are not changing their transforms. So I tried to copy and paste them from the bones and it seemed to work in the program but in game the face was a total mess. This was because the objects were taking the absolute transforms of the bones that were in a different position that the objects are. What appears to be working in the program has nothing to do with the game and viceversa. So I just parented them and even though the objects would jump to a weird location their transforms would remain untouched as you can see in a test animation I made here:

Spoiler

5Pspq1y.gif

So now how do I transfer the bone movements to the objects? I tried a thing in blender called Delta transforms. This are like offset transforms that only take into consideration the relative location and rotation of an object. This was very useful in a parent/child scenario like this because now I had the original objects location/rotation + the relative transforms of the bones. Unfortunately when I tried it in game it did nothing, probably because the plugin only reads the absolute transforms, the delta transforms are stored in a different field. So I couldn't use this approach. Can the KotorBlender plugin be updated to support delta transforms? It would be really useful and nobody would have to do what I'm about to say for it to work.

I needed to somehow transfer those delta transforms to the absolute transforms so that the plugin could read them. There is a function in blender called "all transforms to deltas" that transfers all the absolute transforms to the delta fields and left the absolute ones to zero which is exactly the opposite of what I need. I need to transfer this absolute+relative transforms that I have in the delta fields to the absolute fields. Luckily I found a script that did exactly this but I had to this for every single keyframe which is extremely exhausting and time-consuming. If someone here knows how to code on python can you do a script that does this automatically? It wouldn't be that bad then.

So after thousands headaches I finally got it to work in-game:

Spoiler

PDwfUt5.gif

You can also see that the model has those wrongly shaded faces around the jaw. Anybody knows how to fix that? I saw other people having the same issue but I'm not sure how to fix it. I decompiled and compiled the model with MDLOps 1.0.0 since MDLEdit was giving a lot of problems.

The point of all these is that you can make a facial animation with a dummy mesh so you can see how it looks without having to load it every single time in game. But I don't know if this is a worth approach with all these problems, if you solve one of those two though then it really is at least for me.

I just wanted to share this knowledge to people who may be interested in this or don't know the extension of this plugin. Now I just need to learn animated cameras for the machinima I'm trying to make, does anyone have any tips/tools/tutorials that I could use? Would be really appreciated. Sorry for the long post.

And thanks for keeping this community alive!
 

  • Like 12

Share this post


Link to post
Share on other sites

WOW I haven't seen anyone successfully make custom animations in KotOR  (or I'm just out of the loop). Terrific work!!

  • Like 1

Share this post


Link to post
Share on other sites
On 11/25/2019 at 10:33 PM, tjsase said:

WOW I haven't seen anyone successfully make custom animations in KotOR  (or I'm just out of the loop). Terrific work!!

Thank you so much!

Share this post


Link to post
Share on other sites

Hello!

First of all, great job on the new facial animation!

I discovered recently that KotOR uses in more than one dialogue a non existent TALK_FORCEFUL animation for the Selkath. I was told they only have the TALK_NORMAL animation. Adding the TALK_FORCEFUL would be a great feat, in case you are up to have our aquatic friends to show extra emotions when they talk.

Cheers!

  • Like 2

Share this post


Link to post
Share on other sites
6 hours ago, Salk said:

Hello!

First of all, great job on the new facial animation!

I discovered recently that KotOR uses in more than one dialogue a non existent TALK_FORCEFUL animation for the Selkath. I was told they only have the TALK_NORMAL animation. Adding the TALK_FORCEFUL would be a great feat, in case you are up to have our aquatic friends to show extra emotions when they talk.

Cheers!

Thanks! So if I understand correctly, the selkath have an unused slot animation for talking and you want me to make one? If so, when does it play? Because the TALK_NORMAL animation would be overriding it right? Anyway, I might look into it later this week if I have the time.

  • Like 1

Share this post


Link to post
Share on other sites
On 12/3/2019 at 4:08 PM, DarthParametric said:

No, it's a separate animation that can be specified during a conversation.

Ok, I took a look at it but it seems the selkath only play the normal animation all the time during the conversations without calling the other one in any of the nodes. So if I wanted to do a mod to make them play the alternate animation from time to time, would I have to replace all the dialogs in the game?

Share this post


Link to post
Share on other sites

Hello!

20 hours ago, Alvar007 said:

Ok, I took a look at it but it seems the selkath only play the normal animation all the time during the conversations without calling the other one in any of the nodes. So if I wanted to do a mod to make them play the alternate animation from time to time, would I have to replace all the dialogs in the game?

There are several .dlg files (example, during the Trials before the Ahto City court) that include TALK_FORCEFUL as talking animation.

If you want I can make a list of those nodes for each single file but I have count at least 8 nodes that call for TALK_FORCEFUL for the Selkath.

Cheers!

Share this post


Link to post
Share on other sites
9 hours ago, Salk said:

Hello!

There are several .dlg files (example, during the Trials before the Ahto City court) that include TALK_FORCEFUL as talking animation.

If you want I can make a list of those nodes for each single file but I have count at least 8 nodes that call for TALK_FORCEFUL for the Selkath.

Cheers!

That would be great, thanks!

Share this post


Link to post
Share on other sites

Okay, here it goes.

There are more than I even thought. I also encountered one instance of TALK_HORROR, several TAUNT (but I believe it was a series of mistakes) and one TALK_PLEADING for Selkath. But those are rare enough to not bother creating new animations for, I believe.

 

manm26aa:

 

man26_pcexile.dlg

Entry 17

Entry 20

Entry 125

Entry 126

Entry 213

Entry 214 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 0

Entry 4 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 210

Entry 183 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 190

Entry 195

Entry 139

Entry 141

Entry 143

Entry 172

Entry 175

Entry 153

Entry 155

Entry 157

Entry 158

Entry 72 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 146

Entry 145

Entry 189

Entry 22

Entry 23

Entry 123

Entry 124 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 120

Entry 34

Entry 105

Entry 106

Entry 62

Entry 66

Entry 67

Entry 80 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 83

Entry 87

Entry 78 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 70 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 55

Entry 57

Entry 60

Entry 37

Entry 43

Entry 42

Entry 39

Entry 40

Entry 99 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

 

man26_selarb.dlg

Entry 138

Entry 146

Entry 144

Entry 145

Entry 133

Entry 78

Entry 134

Entry 135

Entry 130

Entry 126

Entry 105

Entry 110

Entry 111

Entry 112

Entry 109

Entry 102

Entry 104

Entry 100

Entry 89

Entry 76

Entry 59

Entry 55

Entry 45

Entry 30

Entry 24

Entry 22

 

man26_trial.dlg

Entry 246

Entry 88

Entry 26

Entry 136

Entry 242

Entry 272

Entry 260

Entry 262

 

man26_shaelas.dlg

Entry 60

Entry 52

Entry 53

 

manm26ab:

 

man26_selarrest.dlg

Entry 1

Entry 2

 

Edited by Salk
Added new entries
  • Light Side Points 1

Share this post


Link to post
Share on other sites
7 hours ago, Salk said:

Okay, here it goes.

There are more than I even thought. I also encountered one instance of TALK_HORROR, several TAUNT (but I believe it was a series of mistakes) and one TALK_PLEADING for Selkath. But those are rare enough to not bother creating new animations for, I believe.

 

manm26aa:

 

man26_pcexile.dlg

Entry 17

Entry 20

Entry 125

Entry 126

Entry 213

Entry 214 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 0

Entry 4 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 210

Entry 183 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 190

Entry 195

Entry 139

Entry 141

Entry 143

Entry 172

Entry 175

Entry 153

Entry 155

Entry 157

Entry 158

Entry 72 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 146

Entry 145

Entry 189

Entry 22

Entry 23

Entry 123

Entry 124 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 120

Entry 34

Entry 105

Entry 106

Entry 62

Entry 66

Entry 67

Entry 80 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 83

Entry 87

Entry 78 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 70 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

Entry 55

Entry 57

Entry 60

Entry 37

Entry 43

Entry 42

Entry 39

Entry 40

Entry 99 (there is probably a typo here because I am sure the developers meant to be TALK_FORCEFUL rather than TAUNT)

 

man26_selarb.dlg

Entry 138

Entry 146

Entry 144

Entry 145

Entry 133

Entry 78

Entry 134

Entry 135

Entry 130

Entry 126

Entry 105

Entry 110

Entry 111

Entry 112

Entry 109

Entry 102

Entry 104

Entry 100

Entry 89

Entry 76

Entry 59

Entry 55

Entry 45

Entry 30

Entry 24

Entry 22

 

man26_trial.dlg

Entry 246

Entry 88

Entry 26

Entry 136

Entry 242

Entry 272

Entry 260

Entry 262

 

man26_shaelas.dlg

Entry 60

Entry 52

Entry 53

 

manm26ab:

 

man26_selarrest.dlg

Entry 1

Entry 2

 

Wow, these are definitely worthy of an animation! I will give it a go this week. Do you want it to be a variant of a normal talking animation or an emotion one like sad, angry, etc?

  • Like 1

Share this post


Link to post
Share on other sites

Hello!

Thanks for checking into this, Alvar007.

Unless I am mistaken, nobody before you ever attempted to add animations to NPCs so kudos to you. As DarthParametric pointed out, the human TALK_FORCEFUL animation could be a good inspiration for what kind of animation you could create for the Selkath.

Probably something very similar would work perfectly fine in their case as well.

Cheers!

  • Like 1

Share this post


Link to post
Share on other sites

Ok so I took your advice guys and I tried making the animation following the TALK_FORCEFUL animation from S_Male02, which is kind of the angry talk animation. But before I did anything I wanted to test out if I could a new slot for the model so I called it tlkforce which is what the game uses to match the TALK_FORCEFUL animation. But for some reason the game doesn't recognize it, whenever I try playing it the model just uses the default talking animation. If I try to do the same with an existing animation (I remove it first and try to play it) the game tries for a second but switches to the idle animation (notice I say idle but before it was the default talking one, not the same).

This tells me that the game knows there is this animation but it can't find it. Whereas the previous case the game just doesn't even search for it. It's like it's not hardcoded into the game to look for the INT_TALK_FORCEFUL constant in the selkath model. So there is no choice but to replace an existing one. After looking at all of them the least used one is the usecomp animation (I think it's only used when you are sentenced to death in the trial and the guy in the computer turns the ray cell on. But let's be honest, you have to be really bad or do it on purpose to get that ending so it's not a big deal).

The problem is that it's a fireforget animation, not a looping one. Meaning that when it's done the model will return to the idle animation. The looping version of the animation it's not on the model unfortunately and I can't use it.

Anyway, here's the animation:

And here's how it looks in Blender:

8zOW61X.gif

For some reason I can't get the mouth movements in my test, but I tried it with vanilla NPCs and it works perfectly. The only downside to this is that all entries in the .dlg files you posted would have to be updated with USE_COMPUTER_NOLOOP instead of TALK_FORCEFUL in the animation field, in case you are still interested.

What do you think?

  • Like 3

Share this post


Link to post
Share on other sites

Hello, Alvar007!

Thanks for taking a shot at this. Very much appreciated. I think your animation looks good. I especially enjoy the pointing finger and the outstretched arm. I am unfortunately a bit in a hurry and could not check in here before to give you feedback but I promise I will return to it very soon.

Again, wonderful feat there, my friend.

 

PS My suggestion is to contact @JCarter426and/or @DarthParametric and see if it is possible to not have to overwrite an existing animation. Even if the USE_COMPUTER_NOLOOP is used only once, I think it's not viable to replace an animation that is used in the game. Perhaps there is some workaround to this and the two guys I mentioned are wizards and may give you some good advice.

  • Like 1

Share this post


Link to post
Share on other sites

My guess would be that this is probably due to hard-coded animation settings tied to its model type, as specified in appearance.2da. They are using creature/monster animations, for which there is presumably no provision for anything beyond the basic talk animation. You could try changing the modeltype value for the main Selkath NPC rows, (Alien_Selkath_01/02/03, rows 40, 259, 260) from L to F and see what happens. I'm not sure if that will work, and it will presumably break most of their other anims, at least the creature ones anyway, but one hurdle at a time.

Share this post


Link to post
Share on other sites
On 12/19/2019 at 12:58 PM, DarthParametric said:

My guess would be that this is probably due to hard-coded animation settings tied to its model type, as specified in appearance.2da. They are using creature/monster animations, for which there is presumably no provision for anything beyond the basic talk animation. You could try changing the modeltype value for the main Selkath NPC rows, (Alien_Selkath_01/02/03, rows 40, 259, 260) from L to F and see what happens. I'm not sure if that will work, and it will presumably break most of their other anims, at least the creature ones anyway, but one hurdle at a time.

Ok so I just tried this and indeed it breaks most of their animations, only the default talking one works (the one where they scratch their lobe thingy). But it actually reads the TALK_FORCEFUL animation now, I did a quick test animation, called it tlkforce and selected it in the .dlg and it works. Still don't know how to fix the rest of them tho, or if it's actually fixable.

Also, do you know why I can't get the mouth movements in a custom module? I specify the VO_ResRef in the .dlg file and the sound but it doesn't work. I even tried with the vanilla values but no luck. I remember I had this problem back when I first modded the game with humans but I got it to work with a "global" sound file which was not in any of the modules folders inside streamwaves, such as n_gmtwilek_coml2.wav. But I can't get it to work with the selkath for some reason, not even with their own sounds.

  • Like 1

Share this post


Link to post
Share on other sites

The game needs per-module LIP files for lip sync. Since Selkath use one of the generic fake alien VOs, it should be easy enough to take existing LIP files from one of the Manaan modules and create a new XYZ_loc.mod in the lips folder that matches your module name.

As to the animations, all the creature/monster anims will need to be renamed to their human version equivalents. Some of them should be easy, since they will probably just have CR in front of the same name, but the combat ones will likely be completely different. Since you want to do new anims, this might be a good opportunity for you, since, as you have probably noticed, Selkath lack most of the anims regular humanoids have, so they can't use anything but basic blaster pistol or unarmed attack anims. If you want to make 20 or 30 custom combat anims, then the Fighting Selkath idea could turn into a proper actual thing.

  • Like 1

Share this post


Link to post
Share on other sites

This project is extremely ambitious and I commend your work so far, Alvar007!

 

The lip synching should not give you much problem after DP's instructions about how to make it happen but if you need specific help with it, we can discuss it in private.

 

The animations instead is not something I can directly assist with but I see a wonderful opportunity here and your talent at creating new animations is extremely rare and much sought after. Please keep it up!

  • Like 1

Share this post


Link to post
Share on other sites

Thank you both for the information. I actually saw that thread before opening this one, and I think it's an interesting idea to do. But making an animation takes me ages, so I don't see myself doing 20 or 30 custom anims, at least not for now. I have other things in my priority list first, but I may come back to this in the future.

I can do the renaming thing tho, but I need to understand it first:

11 hours ago, DarthParametric said:

As to the animations, all the creature/monster anims will need to be renamed to their human version equivalents. Some of them should be easy, since they will probably just have CR in front of the same name, but the combat ones will likely be completely different. Since you want to do new anims, this might be a good opportunity for you, since, as you have probably noticed, Selkath lack most of the anims regular humanoids have, so they can't use anything but basic blaster pistol or unarmed attack anims. If you want to make 20 or 30 custom combat anims, then the Fighting Selkath idea could turn into a proper actual thing.

What do you mean all the creature/ monster anims? Do I have to rename also the ones from the other creature models? I didn't touch those at all for this. Also how do I know the names I have to change to? There are some F modeltypes such as the Dark Jedi that uses a supermodel because they are humans but other such as the Wookies have their own supermodel. So each model have their own anims even though they are all F modeltypes. But the Selkath do not have any supermodel and all their anims are inside the model so how do I figure this out?

  • Like 1

Share this post


Link to post
Share on other sites
4 minutes ago, Alvar007 said:

But making an animation takes me ages, so I don't see myself doing 20 or 30 custom anims

Too bad, I was thinking of sub-contracting you to work on a mod idea I had requiring custom stunt animations. I'm currently assessing the practicality of trying to mocap it.

5 minutes ago, Alvar007 said:

What do you mean all the creature/ monster anims?

Stuff like ctaunt, chturnr, chturnl, cpause1, crun are the creature/monster-named equivalents of human animations, in this case taunt, hturnr, hturnl, pause1, run. They need to be renamed to the human equivalent in order to work after being set as an F model. Of course these ones are super easy, but some of the others aren't so straightforward, like the combat anims. I'd suggest having a look here to start with. And you can probably check out TSL's animations.2da, as that is annotated with descriptions for most of the anims, unlike K1's. However be aware that TSL added a bunch of new anims, so you need to make sure you don't use names that don't exist in K1.

  • Like 1

Share this post


Link to post
Share on other sites
38 minutes ago, DarthParametric said:

Too bad, I was thinking of sub-contracting you to work on a mod idea I had requiring custom stunt animations. I'm currently assessing the practicality of trying to mocap it.

Wow, those are some big words right there. Funnily enough, I was thinking the same thing for my future projects. I have a Xbox 360 Kinect sensor that can be used for motion capture, but I didn't think you could actually use it for Kotor. I believe you mentioned something along the lines of MotionBuilder right?

If we could transfer the motion to the Kotor rig somehow, then I could actually see myself doing the animations. But we need to figure out the proccess first. Great minds think alike I guess.

46 minutes ago, DarthParametric said:

Stuff like ctaunt, chturnr, chturnl, cpause1, crun are the creature/monster-named equivalents of human animations, in this case taunt, hturnr, hturnl, pause1, run. They need to be renamed to the human equivalent in order to work after being set as an F model. Of course these ones are super easy, but some of the others aren't so straightforward, like the combat anims.

I see it now. I didn't actually realise the Wookie supermodel has the same names of the humanoid supermodels. There are also some animations like creadyr which is the unarmed ready animation that I have to rename to the most sensical equivalent one which in this case I guess it would be g8r1 and things like that. Thanks again.

  • Like 1

Share this post


Link to post
Share on other sites
15 minutes ago, Alvar007 said:

I believe you mentioned something along the lines of MotionBuilder right?

@JCarter426 and I were messing around for a while in Motionbuilder trying to retarget the human anims to the Selkath rig, with a view to also retargeting anims to the TOR rig to make porting easier, but that didn't really go to plan due to our ineptitude, so we eventually shelved it and moved on to other things.

K1_Dancing_Selkath_Anim_Transfer_01_TH.g     TOR_BMN_Dance_Anim_01_TH.gif

But assuming you are proficient with MB, it's certainly an option if you are interested. Perhaps you can team up with @Kensei Jintaro who was also looking into creating new anims.

15 minutes ago, Alvar007 said:

I have a Xbox 360 Kinect sensor that can be used for motion capture, but I didn't think you could actually use it for Kotor.

You can, assuming you can either retarget to the KOTOR rig, or, probably more ideally, just directly set that as your target to begin with when setting up your mocap.

  • Haha 2

Share this post


Link to post
Share on other sites

Interesting. I haven't actually tried MB yet, but it was in my plans. This makes me arise a question: does the game accept any custom rig? Or does it have to be those exact bone names and stuff? I assume it doesn't, otherwise you could have used the TOR rig directly into the game.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.