Stormie97

Skinning and porting a model

Recommended Posts

Hey everyone. I have made a request a few days ago for a certain model from a Jedi Academy mod. As far as I know, no one responded to it so I decided to give it a try myself. I've never used 3dsMax before but I know a few basics on Blender, so when I saw the KotorBlender plugin, I figured it would be feasible.

Basically, I used Blender to modify and adapt the model to KoTOR's rig. Once that was done, I imported the model into 3DS Max and did the skinning part in that program as apparently KoTORBlender doesn't support it yet.

So now the skinning is done and the model looks good except maybe for the shoulders. They were way too small in the original model so I had them modified to be closer to those of KoTOR's male body model. I tried to make the deformation look good as possible, won't be able to do any better.LukeMod.thumb.JPG.46b1eb83f5baa15c7b71624eb0fee9fc.JPG

Anyway, the thing is that I'm currently confused as to what the next step is. If everything is done, I would guess it's time to export it to the game but when I try to export, I get the following message:

ErrorExport.JPG.1d793dc0c3de537b421303be8e12200d.JPG

Surely there a few things I must to first before being able to export. Would someone mind help me get through this process? Please bear in mind that I'm a complete beginner, all I had achieved until now is create an item using Kotortool.

 

Share this post


Link to post
Share on other sites

I have no idea what "Export All" is but apparently that's a button I've never seen. But judging from the error message, try the following: Navigate to the OdysseyBase of your model and there you will see an option to export that model. I think it's in the "Modifier" tab, but I might confuse the name here. It's where you have all the settings for the model.

Share this post


Link to post
Share on other sites

Well I must be doing something horribly wrong, when I try to export with the one under OdysseyBase, I get the following message:

ErrorAnims.JPG.dd81fa134b1411fefb4463833ce9254a.JPG

Once I've converted it, here is what it looks like ingame :

20180826210338_1.thumb.jpg.904633f4e6b089f2456612e89490b518.jpg

 

Horrible. I then proceeded to delete the animations I had imported for the skinning, and here's what I got.

20180826212809_1.thumb.jpg.52a28b3f6073c1de5daee3567ae5b8a9.jpg

 

Obviously it's way too small, also it just remains it in T-pose, animations don't work (I assume because I've deleted them sigh). Also, the texture is still from the one from the PMBAM model, even though I placed the correct one in the Override folder..

What is the exact step by step process to export a model? I must have the basics of it completely wrong.

Share this post


Link to post
Share on other sites

First, PMBAM isn't supposed to have animations on the model. Looks like a compiling problem, not an export problem. You'll have to compile the model with the binary S_Female02.mdl and .mdx files in the same location for animations to work. Both MDLEdit and MDLOps need to read information from a supermodel to compile body models.

Or, actually, you said you "deleted" the animations, but did you just delete the keyframes or did you remove the animations from the Odyssey base as well?

Second, it looks like you imported with the wrong units. Or maybe the other model needs to be scaled to KOTOR size.

Third, the textures are configured through appearance.2da rather than on the model, unless they're given a null value (****) in appearance.2da. So you either have to edit the texa values in appearance.2da or rename your textures to match the existing PMBAM* textures.

Share this post


Link to post
Share on other sites

Well, I did scale the model to match the one from KOTOR beforehand. That was actually the first thing I did:

Scale.thumb.JPG.f08bbe4e10257a1d624c5352c5cd6700.JPG

 

As for the animations I actually deleted everything I found here:

Animsdeleted.JPG.7e9580326ed70e5ce92576b3d05af5b5.JPG

Share this post


Link to post
Share on other sites
  On 8/26/2018 at 7:48 PM, Stormie97 said:

Well, I did scale the model to match the one from KOTOR beforehand.

Must be the units, then. Fortunately that can be fixed, though I use 3ds Max and not Blender so I can't tell you how.

  On 8/26/2018 at 7:48 PM, Stormie97 said:

As for the animations I actually deleted everything I found here

Ah, good. Also, if you export as geometry, it shouldn't make a difference even if you didn't delete them. Back to compiling theory then.

Share this post


Link to post
Share on other sites
  On 8/26/2018 at 7:50 PM, JCarter426 said:

Must be the units, then. Fortunately that can be fixed, though I use 3ds Max and not Blender so I can't tell you how.

I used Blender for the first part of the porting, being the reshaping of things like the shoulders or arms so they're closer to the ones typically found in KOTOR body models. For everything else, I did use 3DS Max. It's the program I'm using right now while trying to export it. How should I change those units then and to what?

As for the compiling, I'm confused as to how it works (I'm a newbie). Just to see, I tried compiling with MDLEdit but the program crashes as soon as I load the exported .mdl.ascii file

Share this post


Link to post
Share on other sites
  On 8/26/2018 at 7:55 PM, Stormie97 said:

I used Blender for the first part of the porting, being the reshaping of things like the shoulders or arms so they're closer to the ones typically found in KOTOR body models. For everything else, I did use 3DS Max. It's the program I'm using right now while trying to export it. How should I change those units then and to what?

What threw the units off would be the initial import in Blender or how you got your project from Blender to 3ds Max, so I can't say for sure. But when I'm opening a MAX project with bad units, I've found that opening it with the "Use Game Units" setting in KOTORMax off in the project's original units, then turning game units back on after everything is open tends to fix it.

  On 8/26/2018 at 7:55 PM, Stormie97 said:

As for the compiling, I'm confused as to how it works (I'm a newbie). Just to see, I tried compiling with MDLEdit but the program crashes as soon as I load the exported .mdl.ascii file

If you're having problems with MDLEdit, there's a bug reporting thread for it here. I'd also suggest you get the latest hotfix version here. Though MDLOps should work too. They both do essentially the same things, though how they do it is different.

The basic compiling procedure for both of them is:

  1. Export your ASCII model from your modeling program.
  2. Put it in a folder somewhere.
  3. If you're compiling a body model, check the model's Odyssey base to see what its supermodel is and extract the supermodel files to the same location.. In your case, this is S_Female02, so you need to extract S_Female02.mdl and S_Female02.mdx and place them in the same folder as your exported ASCII file.
  4. Launch MDLOps/MDLEdit.
  5. Configure the target game.
  6. Load in MDLEdit or select file and read model in MDLOps.
  7. Save as binary in MDLEdit or write model in MDLOps. (You can also use the batch option in MDLEdit or the read and write model option in MDLOps for the last two steps.)
  8. Rename the compiled files to their proper names (e.g. PMBAM.mdl/mdx and not PMBAM-mdledit.mdl/mdx or PMBAM-ascii-k2-bin.mdl/mdx and such).

Share this post


Link to post
Share on other sites

Thanks for your help.

I used your method with both MDLOps and MDLEdit (using the hotfix), both time I got this in game:

20180826222622_1.thumb.jpg.5e03c5650364b15dae6468577aa6e4d6.jpg

I also used the "Use game units" tip you gave, doesn't seem to have had any effects I think

Just to be sure, do I have to use any of the Kotormax features before exporting (like Reset XForm, Scalewizard, etc) or do anything to the "hierarchy"? Right now, here's how it looks like:

hierarchy.JPG.ab6c7997f66a716be8bcb487d5d1fb22.JPG

Edited by Stormie97

Share this post


Link to post
Share on other sites

Progress!

I used a bunch of those features from my previous reply such as Reset XForm after having selected everything and after compiling I got this:

20180826224401_1.thumb.jpg.e273a7c4f26336f78df2722831f16bdc.jpg

So the animations work and it has the right size. However I still don't have working textures and the arms are seperated of the Torso. But I'm getting close!

Share this post


Link to post
Share on other sites

Ah, it was an issue with your mesh scale rather than the whole project. That would explain the spaghettification you were having once it was properly compiled. Yeah, if you scale any geometry, you must use Reset XForm or else the scale 3ds Max displays will not match what KOTORMax thinks the scale is. And if you run into any other problems like that, with what you see in your modeling program not matching what's in the game, you can usually take your exported ASCII and import it back into your modeling program. That will at least refresh the display so you can see what the problems are.

As for the arms, they look like either the game is still confused about some things (probably the pivot points). So I'd say try the importing the exported model trick, and then if you see the arms crazy out of place, move them into place by going into the editable mesh modifier and moving the vertices so they snap to the shoulders.

Share this post


Link to post
Share on other sites
  On 8/26/2018 at 8:55 PM, JCarter426 said:

As for the arms, they look like either the game is still confused about some things (probably the pivot points). So I'd say try the importing the exported model trick, and then if you see the arms crazy out of place, move them into place by going into the editable mesh modifier and moving the vertices so they snap to the shoulders.

Well I imported the exported ascii file again in 3DS Max and I don't see any displacement

ReImporting.thumb.JPG.9902cc520e53e9acc8b84f1213c9e2dc.JPG

I have tried a bunch of things but nothing helpful so far (such as welding possible vertices and such). I did take a look at the Sanity Check Log file, here it is what I got during my last exporting :

  Reveal hidden contents

Aside from the whole lot of welds checks on the bones, there's a few lines that might be related to my problem:

 

The rotation controller for "Torso" is not linear: 'Euler_XYZ'
'Controllers on Keys' Check failed.
Checking node LArm
Node "LArm" has a scale that is not 1
'Zero orld Scale' Check failed.

The rotation controller for "RArm" is not linear: 'Euler_XYZ'
'Controllers on Keys' Check failed

I don't know what those mean unfortunately

Share this post


Link to post
Share on other sites

Hmm, I'm guessing something may have gone wrong with Reset XForm but this sounds like a @bead-v question.

What I thought had gone wrong hadn't, though. Looks like all vertices are in place, but perhaps the scale on the mesh being off is throwing off how it's animated.

Share this post


Link to post
Share on other sites

Well I'm pretty clueless. I got work tomorrow so it's time for me to sleep. I attaching my Max file hereby as well as the textures if anyone wants to take a look in the meantime (don't judge my stuff too harsh, it's my first time doing anything real on 3d programs)

Luke_Max_File.rar

Share this post


Link to post
Share on other sites

I can't open the archive you posted for some reason. But if it's a .max file, then there's no point, since I have gmax and can't open that. You need to send me a .mdl.ascii file.

Anyway, you definitely need to fix the orientation controller problem. Here's what I would do in gmax:
OIWeTfH.png


The weld error you are getting is nothing, it's just saying that the distance between those verts is small enough that you should consider merging them. You can turn off specific sanity checks, I suggest you turn this one off. But leave the others, not getting warnings doesn't mean everything is fine.
oNtx8Mo.png

Also, I suggest you load a working model decompiled with mdledit/mdlops and import that and use the hierarchy in that model as a guide to fix your hierarchy.

Share this post


Link to post
Share on other sites

Well, I found the issue: Resetting Xform basically messed up my entire skinning:

BeforeAfterXForm.thumb.jpg.48239a36ee970a01ea4eab90076e537b.jpg

So I'm probably doing it wrong, until now I basically selected everything included under PMBAM and hit the "Reset X Form" button. I don't know the correct way to do it though.

  On 8/26/2018 at 10:51 PM, bead-v said:

Also, I suggest you load a working model decompiled with mdledit/mdlops and import that and use the hierarchy in that model as a guide to fix your hierarchy.

Thanks, I'll try out those things and report back.

Share this post


Link to post
Share on other sites
  On 8/26/2018 at 10:51 PM, Stormie97 said:

So I'm probably doing it wrong, until now I basically selected everything included under PMBAM and hit the "Reset X Form" button. I don't know the correct way to do it though.

That is the correct way to do it, but it should be done before skinning. There may still be a way to fix it now, though if there is I don't know it. Or actually I probably do, but I'm struggling to recall the specific steps.

This may help:

  On 6/23/2018 at 2:05 PM, DarthParametric said:

use  Affect Pivot Only in the Hierarchy tab. For matching the pivot of another object, my preferred approach is to make the target mesh a temporary child of the mesh with the desired pivot, set the reference co-ord system of the Move tool to Parent, hit Affect Pivot Only, zero out the XYZ of the position, then select Reset XForm in the Utilities tab and hit the Reset Selected button. In the Modify tab, drag the XForm modifier underneath the Skin and OdysseyTrimesh modifiers so it is just above the Editable Mesh modifier. Then right click on it and select Collapse To. That will bake your transforms without destroying your skin.

 

Share this post


Link to post
Share on other sites
  On 8/26/2018 at 10:56 PM, JCarter426 said:

That is the correct way to do it, but it should be done before skinning. There may still be a way to fix it now, though if there is I don't know it.

Well I guess worst case scenario is redoing the whole skinning part then.. Though I'd appreciate an alternative if someone has one to offer.

Share this post


Link to post
Share on other sites
  On 8/26/2018 at 10:56 PM, JCarter426 said:

This may help:

  On 6/23/2018 at 2:05 PM, DarthParametric said:

use  Affect Pivot Only in the Hierarchy tab. For matching the pivot of another object, my preferred approach is to make the target mesh a temporary child of the mesh with the desired pivot, set the reference co-ord system of the Move tool to Parent, hit Affect Pivot Only, zero out the XYZ of the position, then select Reset XForm in the Utilities tab and hit the Reset Selected button. In the Modify tab, drag the XForm modifier underneath the Skin and OdysseyTrimesh modifiers so it is just above the Editable Mesh modifier. Then right click on it and select Collapse To. That will bake your transforms without destroying your skin.

 

@Stormie97 you got your alternative! Fingers crossed!

Edit: If this works I'll script it and make it a button, promise!

Share this post


Link to post
Share on other sites
  On 8/26/2018 at 11:07 PM, bead-v said:

@Stormie97 you got your alternative! Fingers crossed!

Edit: If this works I'll script it and make it a button, promise!

Thanks, from a noob perspective it sounds complicated but I'll give it a try!

Share this post


Link to post
Share on other sites

Sorry for double posting.

So, I couldn't get that technique to work so I took the time to redo the skinning, everything seems fine now :

Completed.thumb.png.6430693dc9ae2c2f2e93eb1a19cf5f56.png

Well, except for the textures. I really don't understand how those things work.

Basically, the model is using 3 textures, "body.tga" for the jumpsuit, "tunic.tga" for the tunic over the jumpsuit and "pmbama01.tga" for the hands (I used PMBAMA's hands instead of adapting the hands that came with the model as it seemed easier). I'm kinda lost as to what I have to do now to get it to work.

I'm uploading hereby an updated archive with the .max file, the .mdl files (for KOTOR II) and a .mdl.ascii ready to be imported in Max/3DS Max as well as the aforementioned textures. I really could use help on this phase with the textures.

Luke_ROTJ_02.rar

Share this post


Link to post
Share on other sites

Your textures are set up wrong in max, I'm not sure how, but they're exporting as NULL to the .mdl.ascii. Open the .mdl.ascii file, find the nodes that are missing textures (the skins in your case). And you'll see that the texture names (keyword "bitmap") are set to "NULL". You need to enter your texture name here, without an extension or quotation marks (e.g. bitmap tunic). Then recompile that.

Also, ambient and diffuse colors seem to be set to black on your skins. DP can probably tell you more about what effect that has, but judging from another body model (Atton's), those should be set to white (1.0 1.0 1.0). You find these in the .mdl.ascii as well, where you found the bitmap, look for ambient and diffuse.

Hope this is the last of your problems :)

Share this post


Link to post
Share on other sites
  On 8/28/2018 at 9:39 PM, Stormie97 said:

Basically, the model is using 3 textures, "body.tga" for the jumpsuit, "tunic.tga" for the tunic over the jumpsuit and "pmbama01.tga" for the hands

This can't be done for body models like that. The game will apply one texture (the one in the texa entry on your appearance.2da line) to the entire model. Unless you null that out (changing it from PMBAMC to ****) you can't have multiple textures. And in this case, you don't particularly want multiple textures, given that you would have to edit every appearance line and then your mod wouldn't even work for custom appearances.

Instead, what you want to do is put everything on one texture. Generally, the game likes powers of 2, and prefers square textures, though you can get away with whatever except for a few cases where it's required.

Once you have your new texture with everything copy/pasted in and applied to the whole model, you can adjust the UVW maps with UVXform (scaling it to .5 width and height, or whatever you end up going with) and UnwrapUVW to move everything into place (adjusting all vertices by .5 in the necessary direction). If you prefer, you can do this in Blender, then copy the new UVW maps onto your skinned model in 3ds Max. You can do that so long as the geometry is identical.

All UVW modifiers should be below the skin modifier for KOTORMax to export.

  On 8/28/2018 at 10:00 PM, bead-v said:

those should be set to white (1.0 1.0 1.0)

Yes, that's right. And the OdysseyTrimesh modifier has an option to override everything to white for export. That way if you prefer to have it black in the material editor (this will prevent it from showing the alpha channels) or if you just forget about it (the default is grey, after all) you don't have to worry about that.

Share this post


Link to post
Share on other sites
  On 8/28/2018 at 10:45 PM, JCarter426 said:

All UVW modifiers should be below the skin modifier for KOTORMax to export.

What happens if they're not? 😮

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.