seedhartha

TOOL:KotorBlender (for Blender 3.3+)

Recommended Posts

More updates:

Version 3.9.0 has added support for Bezier-type controllers, compressing quaternions on export and armature-based animations, i.e. it is now possible to animate a character using a Blender armature and then copy keyframes onto regular "bone" objects before exporting the model.

More importantly, version 3.10.0 has implemented semi-automated minimap rendering. It works like this:

  • Import a module layout via File → Import → KotOR Layout (*.lyt)
  • Press KotOR → Minimap → Render (auto)
  • Open "Render Result" image in Image Editor area and save it as "lbl_map{modulename}.tga" file
  • Open "MinimapCoords" text in Text Editor area and copy-paste generated properties into module .ARE file using any GFF editor

 

 

kotorblender_3_10_0_minimap.png

Screenshot 2024-01-01 143406.png

  • Like 3

Share this post


Link to post
Share on other sites

Hello !

This look amazing. However, I was wondering if you have a tutorial available to learn how to use this tool.

I am basically a noob, and I would like to import new characters (bodies and heads) into Kotor 1 and 2.

In the past I have been able to do it, but it was on 3DS max, which was not really user friendly, so I kinda gave up after the first head and first body (and I have to say that it was a long time ago, so I don't even remember how to do it correctly)

But your tool looks way more fun to use, so I would like to give it a try again, but I go on google I can only find tutorial for 3DS max, and usually for weapons. (I cannot find tutorial for heads or bodies anymore) But I cannot fing anything for blender and most important, nothing for the amazing tool you made 😅 (or maybe I am just not good at researching)

So is there any chance you have made a tutorial or know one that exists and is applicable for your tool?

Thank you in advance for your help 😁

Share this post


Link to post
Share on other sites

Hey!

I see your point. Some high-level instructions that are specific to KotorBlender can be found in the README:

https://deadlystream.com/files/file/1853-kotorblender-for-blender-33/

As for the Blender itself, you are much better of learning from some respected YouTube channels, like this one:

https://www.youtube.com/@blenderguru

That said, if you have any issues or questions about the tool, you can ask them here or on Discord.

  • Like 1

Share this post


Link to post
Share on other sites

I do see the value of good documentation / tutorials. I'm sceptical though if it will actually bring more people to use KotorBlender.

So to anyone following this thread, do you think a tutorial is necessary here or just a nice-to-have? What topics would you like to have covered? In which format?

  • Like 1

Share this post


Link to post
Share on other sites

Hello !

Thank you for your feedback, I will take a look at the videos, it looks very interesting.

However, I am not sure that the videos will help me on my problem, this is why I was asking for a tutorial.

Anyway, yesterday, I had an idea that might also help you on the potential need of a tutorial. I thought that, in order to solve my problem, I should tell you what I did from importing the first model to exporting it to the game. But as it would have been very long to post it as a simple message, I basically wrote it in a word document (.doc) and I was planning to attached it to my next mesage.

And while I was writting it, I told myself "hey, once I know where my mistake is, I will be able to correct this document, and it could maybe be used as a tutorial for beginners". So I wrote it in a way that it looks like a tutorial with instructions, and most important, pictures everywhere.

The document is now almost done (around 30 pages), it goes through importing the .mdl model to blender (in the example it is the head of Trask), replace the model by the one you want (Vertex Groups, etc), adding texture (simple tutorial, nothing compare to a dedicated tutorial on Blender), exporting it and see the result in the game.

However, as I said, for now I have a problem with the result 😅 because it looks like this :

image.png.e3aeabe08b6a79e3c7ef64e1eee9d885.png

So I think I am not far from getting something good, therefore I am guessing that what I put in the document is not totally wrong. So once corrected it could be good enough to start. And with your comments it could actually become a real tutorial with all the details of the amazing work you did.

What do you think ?

Would it be ok for you to take a look at my document (I will send it today) and if you like it, you can use it as a baseline for your tutorial (this is up to you, I am not trying to take credit of your work by doing this document. I just think that it could help you to aving having to spend time on this)

 

EDIT:

And to answer to you about: "I'm sceptical though if it will actually bring more people to use KotorBlender.", I am talking about myself but I am probably not the only one, I never understood nor liked 3DS MAX, and I always prefered Blender. However, in the past, 3DS MAX was the only software with good tutorial on how to create mods on KOTOR, even when the first plugin for Blender was created. Therefore, even if I prefered Blender, I had to stick to 3DS MAX as it was the only software with plugin I learnt how to you. So yes, a tutorial will always attract more people, even more if they have to chose between one with a tutorial and one without.

Edited by Galney
  • Haha 1

Share this post


Link to post
Share on other sites

 I am back!

So as mentionned in my previous message, here is the document I prepared (pictures are in low resolution, because the document was to heavy to be shared directly on this message, but if needed I have it with better quality).

Again, I have a problem with the result, so I know my document is wrong, can you please help me to find out where and how to correct it.

Once corrected, if you want to, you can use it as a tutorial document (I named it like that actually)

Thank you in advance for your help 😁

TUTORIAL_LOW_RESOLUTION.docx

 

 And here is attached blender files Tutorial_3. It is the last one I made before exporting it to KOTOR (If you want the two first version of this Blender file I can provide it). Along with it, there are the .mdl and the .mdx files and the texture.

(I could not transfer it in my previous message because the total size was to heavy)

So if you don't see my mistake in the document, maybe you will find it in the other files?

Thanks again ! 😁

Tutorial_3.blend n_traskh.mdl n_traskh.mdx n_traskh.tga

Edited by Galney

Share this post


Link to post
Share on other sites

Nice job on the document, very organized. One thing I noticed is that you don't have to touch Shader Editor at all, you can just press Rebuild All Materials on the root object or Rebuild Material on individual objects.

So the root cause is not normalized bone weights, i.e. total sum of all bone weights per vertex exceeds 1.0 in your model. You can fix that by pressing Weights - Normalize All while in Weight Paint mode:

Screenshot 2024-01-17 194644.png

However, that made exported model crash on load, so I had to fix it. Please download version 3.10.1 of KotorBlender from DeadlyStream.

Here is your fixed model in-game:

748221981_Screenshot2024-01-17194915.png.0ce80254cc645e07733e969194726d59.png

  • Like 1

Share this post


Link to post
Share on other sites

Amazing!

 

Thank you very much, that solved my problem. I will update the document with your comments.

 

Just one question, is there a simple way to adjust the head position to the rest of the body? 

I am guessing that we have to move the "Character dummies" but I am not sure.

Also, apart from moving the "character dummies" a bit, then check in the game the results, and keep repeating this until your head is well adjust to the body, I don't know if there is a more simple and faster way to do this.

Here is an example of what I am talking about:

image.png.eed82b42aa28aa3bf8ce523cab571a8f.png

You can see that the neck of the head is not aligned with the neck of the body.

I am also guessing that the same method shall be applied to adjust equipment, such as mask or goggles, on the head?

Share this post


Link to post
Share on other sites

The KBlender thread isn't the place for general modelling questions. I''d suggest you search for existing threads for info or create a new thread asking about it. But to answer your specific question, the root (i.e. world zero) of the head model is attached at the headhook in the body model. Adjust your head mesh to match one of the vanilla heads (particularly note the bottom ring of polys/verts on the neck where it will mate with the body).

  • Like 1

Share this post


Link to post
Share on other sites

Hi, sorry I did not consider it as a separated subject as I thought the tool was maybe managing it itself.

I will go on another thread next time, sorry for the inconvenience 😅

However, thank you for your help, I was manage to solve it thanks to you. I think I will add it to the document too, as it can help!

Share this post


Link to post
Share on other sites

Hey! The tool is amazing- however when I try to export an area as .glb or .gltf it doesn't work properly- it's "foggy", all the textures blink in and out of existance, some are seen through other textures etc, just a big mess... is there a way or tutorial that shows how to export these?

https://imgur.com/a/sHYZnOo

Share this post


Link to post
Share on other sites

KotorBlender only officially supports MDL format.

Technically speaking, material information (textures, colors and transparency) is stored in addon-specific data structures, and is only converted to Blender materials for preview purposes. GLB / GLTF exporters for sure don't have access to KotorBlender data structures, and how they interpret Blender materials is up to them.

  • Like 1

Share this post


Link to post
Share on other sites

Hey guys. Perhaps I was looking incorrectly, so I'll ask again here. Does the engine have a limit on the number of vertices per model? How many vertices should the model have (optimal value) if I would like to change the bodies? I haven’t done a stress test yet, but I was wondering how the engine would behave if there were more than 10 NPCs with polygons of more than 30k each in one location :D

Share this post


Link to post
Share on other sites

Hello everyone!

Can someone please help me with my Companion Cat mod?

I just need someone to export my model and its respective texture as .MDL and .MDX files for both KOTOR I and II, as I have tried alot already but I either can't wrap my head around it (i have zero knowledge of Blender or any other 3D modeling tools) or there is a problem with my blender version or kotorblender plugin.

 

I know the model is not rigged, and that it would take a tremendous amount of work to properly rig it, so I am not asking anyone to do anything like this!

This is why I kindly ask You to just leave it unanimated, as is, just floating around over ground level! I would be very happy just with this result!

I have attached the model .blend file and the accompanying texture below.

I am kindly asking You to just export the model and texture as KOTOR I and II .MDL and .MDX files!

 

Many thanks in advance and have a great weekend!

@seedhartha

CatTex1.png.ee7f3708eae3b3895c0496ad0a9097c1.png

cat.blend

  • Dark Side Points 1

Share this post


Link to post
Share on other sites
Posted (edited)
On 1/1/2024 at 6:46 AM, seedhartha said:

Version 3.9.0 has added support for Bezier-type controllers

Are there any special steps to export Bezier keyframes, aside from just setting the keyframes on Blender’s timeline to Bezier interpolation?  I’ve successfully exported one model with Bezier keyframes (which animates very smoothly in-game), but I have a second one which only exports with regular linear keyframes even when I set all of them to Bezier in Blender, and I haven't yet figured out what I've done differently (aside from the fact that they're two distinct models).  Opening the exported MDLs with MDLEdit confirms that the one model has Bezier and the other has regular.  Is there perhaps another step which I’m not realizing?

Model 1 animation track (exports as Bezier):

Spoiler

1811665122_Screenshot1-Bezier.png.a96096a88899ea7dfa9fa16af5cec425.png

Model 2 animation track (exports as regular):

Spoiler

1068744588_Screenshot2-Non-Bezier.png.dbd9dd8af7a1fa38a84bbb954d6bc9a2.png

EDIT:  After some more experimentation, I think it didn’t like that my first keyframe of the animation sequence was location 0,0,0.  Moving the first keyframe to a slightly different location allowed it to properly save with Bezier keyframes, as did adding a dummy keyframe of 0,0,-0.1 right before the beginning of the sequence.  In any case, I seem to have got the animation working now.

Edited by WildKarrde
Additional testing observations

Share this post


Link to post
Share on other sites

I am apparently having trouble importing any .mdl files into blender (now running 3.6.14)

Using KotorTool I extracted the models, textures, and layouts to a /data folder with no subdirectories:
image.png.c2a9a919ea1fc920a04aa7a68f4340f9.pngimage.png.ca3488050030c1c8ecca42a26bea2163.png

Upon importing an .mdl file, the Material Preview view comes out black and red:

image.png.c3e860b6ba37917220b45d6bdef3249b.png

(The walkmesh is responsible for the red)

As far as I know all the materials seem to have imported properly, but the texture previews are all black:
image.png.ffa899c09cc6d1eab07afdfde99f6652.png

Would anyone be able/willing to get a guide of some kind set up?
I thought that I followed the instructions pretty well as far as where to extract all the .bif files and stuff like that, but there seems to be something I'm missing.

Share this post


Link to post
Share on other sites

You don't need to extract the files anywhere in particular. You can put them wherever you want, you just need to point KBlender to the folder locations. Go to Blender's Preferences window (top menu bar Edit -> Preferences), select Add-ons in the lefthand list, optionally tick the "Enabled Add-ons Only" checkbox up the top of the righthand pane to filter the list, scroll down to "Import/Export: KotorBlender" and expand it. You'll see two fields you can enter values into, "Texture Search Paths" and "Lightmap Search Paths":

image.png.d88ad2a0d0d0780cf829b386a5e14138.png

The "Texture" path is the contents of swpc_tex_tpa and the "Lightmap" path is the contents of the multiple lightmaps.bifs (or singular in the case of TSL). Male sure you extract each game's textures into their own separate folders, assuming you want/need content from both. You can add multiple folder paths into each field, separated by semi-colons (;). For example, in my case for the Texture field I have the K1 texture folder, then the TSL texture folder, then the K1 Override folder.

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.