seedhartha

TOOL:KotorBlender (for Blender 3.3+)

Recommended Posts

43 minutes ago, AmanoJyaku said:

A degenerate  has no ethics or morals. 😁

 

It means there's a problem with the geometry:

  • Edges with no length.

  • Faces with no areas (faces on a point or thin faces).

  • Face corners with no area.

https://docs.blender.org/manual/en/latest/modeling/meshes/editing/mesh/cleanup.html

I suspected as much. Either 610dan_31.wok (a tsl walkmesh) was  shipped with a degenerate walkmesh, or I am experiencing a bug.  Maybe both.

Share this post


Link to post
Share on other sites

I think I'm doing something wrong, I would appreciate some help.

Whenever I create a model from scratch or import one and I edit the position of a single vertex on "Edit" mode, I get an error saying "bpy_prop_collection[index]: index 0 out of range, size 0" when exporting to an .mdl file. I've looked on the blender forums this issue and it says that there's a vertex outside any group, does it change anything other than position when moving?

Share this post


Link to post
Share on other sites
On 6/14/2022 at 11:53 AM, LoneWanderer said:

Last time I checked, the plugin loaded with an error and didn't work on 2.79 and 2.80

Got it, thanks for info!

Another question for anyone: I'd like to do some work on a model that has animation attached to it. Is it possible to just Import Geometry, remodel as needed, and then add the animation back in later? Or is it best to keep everything together?

Share this post


Link to post
Share on other sites
Quote

Is it possible to just Import Geometry, remodel as needed, and then add the animation back in later

That should work, yes. I just checked.

Share this post


Link to post
Share on other sites
12 hours ago, seedhartha said:

That should work, yes. I just checked.

Nice! Let me just say, hell of a job with this. No more breaking out to ascii and recompiling into binary. Love it!

Share this post


Link to post
Share on other sites

Just me again, being a pain in the ass. I imported my model with Geometry, Animations, and Walkmeshes selected. I then made some edits to the model. However upon exporting (Animations, Walkmeshes, and Custom Normals selected), I'm thrown a list index out of range error. Any ideas as to what might be causing this error? Thanks for your time (and patience).

Share this post


Link to post
Share on other sites

You have loose vertices in Cylinder01. Select that object and do Mesh -> Clean Up -> Delete Loose.

Meanwhile, I will have to think how to handle it properly.

Share this post


Link to post
Share on other sites
16 minutes ago, seedhartha said:

You have loose vertices in Cylinder01. Select that object and do Mesh -> Clean Up -> Delete Loose.

Meanwhile, I will have to think how to handle it properly.

Thanks for taking a look, I'll give it a go. Thank you!

Share this post


Link to post
Share on other sites

KotorBlender won't export my .mdl file.

When i click on Export/Kotor Model (.mdl) and click Export KotOR MDL nothing happens, no .mdl file is created in the source folder.

I can import files just fine, but cannot export new files...

Share this post


Link to post
Share on other sites

This is likely a setting I'm overlooking, but my models in game are much smoother than they are in Blender. I have Object set to Shade Flat on all my pieces and Export Custom Normals seems to have no affect either. Any advice is appreciated, thanks for your time.

 

Screen Shot 2022-06-24 at 1.27.51 PM.png

Screen Shot 2022-06-24 at 1.31.37 PM.png

Screen Shot 2022-06-24 at 1.32.03 PM.png

  • Like 1

Share this post


Link to post
Share on other sites
13 hours ago, JediArchivist said:

KotorBlender won't export my .mdl file.

When i click on Export/Kotor Model (.mdl) and click Export KotOR MDL nothing happens, no .mdl file is created in the source folder.

I can import files just fine, but cannot export new files...

Can't help without seeing your .blend file.

6 hours ago, CarthOnasty said:

This is likely a setting I'm overlooking, but my models in game are much smoother than they are in Blender. I have Object set to Shade Flat on all my pieces and Export Custom Normals seems to have no affect either. Any advice is appreciated, thanks for your time.

Long story short, you need to duplicate vertices to emulate flat shading.

This is a limitation of MDL file format. It's normals are per vertex, but in Blender normals are per triangle. Here's how you can workaround that:

  1. Mark edges connecting your flat triangles as sharp
  2. Add Edge Split modifier to the object (ensure that Sharp Edges flag is set)

On export, this will duplicate vertices on sharp edges, creating a flat shaded look.

kb-flat-shading-1.jpg

kb-flat-shading-2.jpg

  • Like 1

Share this post


Link to post
Share on other sites
13 hours ago, seedhartha said:

Long story short, you need to duplicate vertices to emulate flat shading.

This is a limitation of MDL file format. It's normals are per vertex, but in Blender normals are per triangle. Here's how you can workaround that:

  1. Mark edges connecting your flat triangles as sharp
  2. Add Edge Split modifier to the object (ensure that Sharp Edges flag is set)

On export, this will duplicate vertices on sharp edges, creating a flat shaded look.

Awesome, thank you so much for the detailed explanation.

Share this post


Link to post
Share on other sites
10 hours ago, JediArchivist said:

Fully custom models are possible, but it's not going to be that easy. At a minimum, to be able to export this, you need to:

  1. Create Empty object
    1. Under KotOR Model Node set Type to MDL Root
    2. Rename to match exported filename or it could crash
  2. Reparent your Mesh object to a newly created Empty object
  • Like 2

Share this post


Link to post
Share on other sites
11 hours ago, seedhartha said:

Fully custom models are possible, but it's not going to be that easy. At a minimum, to be able to export this, you need to:

  1. Create Empty object
    1. Under KotOR Model Node set Type to MDL Root
    2. Rename to match exported filename or it could crash
  2. Reparent your Mesh object to a newly created Empty object

Thank You very much for making it clear!

Share this post


Link to post
Share on other sites

Is there a way to batch lightmap an entire level in one go? The described process of doing each individual mesh one at a time is not particularly practical given the sheer volume of meshes in an average level.

Share this post


Link to post
Share on other sites
3 hours ago, DarthParametric said:

The described process of doing each individual mesh one at a time is not particularly practical given the sheer volume of meshes in an average level.

True that. Described process is the only way, as far as I'm concerned. It can be automated, but I will probably never find time to do that.

Share this post


Link to post
Share on other sites

Is that a limitation of Blender or just because of dealing with Odyssey models?

I stumbled across this - https://github.com/Naxela/The_Lightmapper - although it seems heavily focused on creating lightmap UVs, which isn't my primary concern. As terrible as the vanilla lightmap UVs are, I'd prefer not to have to replace hundreds of room models.

Share this post


Link to post
Share on other sites
1 hour ago, DarthParametric said:

Is that a limitation of Blender or just because of dealing with Odyssey models?

I stumbled across this - https://github.com/Naxela/The_Lightmapper - although it seems heavily focused on creating lightmap UVs, which isn't my primary concern. As terrible as the vanilla lightmap UVs are, I'd prefer not to have to replace hundreds of room models.

You don't necessarily have to use a separate plugin. Blender can lightmap pack multiple objects out-of-the-box. It's just that these objects need to share the lightmap texture.

As for limitations, I don't see any, but it is not obvious how to connect these things in code.

lightmap-pack.jpg

Share this post


Link to post
Share on other sites
4 hours ago, DarthParametric said:

Is there a way to batch lightmap an entire level in one go? The described process of doing each individual mesh one at a time is not particularly practical given the sheer volume of meshes in an average level.

Just out of curiosity DP, is there a reason you’re not using Max for your lightmaps instead? I’ve always found it really straightforward in Max. 

Share this post


Link to post
Share on other sites

It's a gazillion times easier than Blender's approach to things certainly, but the results aren't exactly stellar. I've discussed the issues with KMax's OdysseyLight implementation with seedhartha previously and I was lead to believe that KBlender deals with them differently. I figured there was no harm (except loss of sanity points) in seeing what sort of lightmaps Blender could spit out.
 

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.