Recommended Posts

thumb-84ff89d5a6b4256b17831bd576799e80-mdlops-options.jpg

 

File Name: MDLOps

File Submitter: Fair Strides

File Submitted: 14 Jan 2016

File Category: Modding Tools

 

 

-----------------------------------------------------------------
-->--
-----------------------------------------------------------------

 

-------------------------
-->--
-------------------------

  Reveal hidden contents

 

 

-----------------
-->--
-----------------
This script is released under the GPL, see the included
GPL.txt.

 

----------------
-->--
----------------
MUCH MUCH MUCH thanks to Torlack for his NWN MDL info!
Without his info this script could not exist!

 

Thanks to my testers:
T7nowhere
Svosh
Seprithro
ChAiNz.2da

 

Thanks to all at Holowan Laboratories for your input
and support

 

file browser dialog added by tk102

 

AABB, animations, lights and emitters, and speed-up by JDNoa

 

Calculations of vertex and face normals by VP and Fair Strides

1.0 version by ndix UR, thanks to bead-v for inspiring many of the added
features, figuring out a number of critical format algorithms, and sharing
the journey

 

-----------------------
-->--
-----------------------

This is a Perl script for converting
Star Wars Knights of the Old Republic (kotor 1 for short)
AND Star Wars Knights of the Old Republic, The Sith Lords (kotor 2 for short)
binary models to ascii and back again.

 

Binary models are converted to an ascii format compatible
with NeverWinter Nights.

It can also do some other operations on models,
like renaming textures and replacing meshes.

 

------------------
-->--
------------------
-Automatic detection of binary model version
-Automatic detection of model type
-node types supported:
-trimesh
-danglymesh
-lightsaber
-skin
-emitter
-light
-reference
-dummy
-model properties supported:
-diffuse
-ambient
-shadow
-render
-alpha
-self illumination
-many, many more
-supports compile/decompile pwk/dwk/wok walkmesh files
along with their associated models
-when reading in a binary model a text file is created
that lists all the textures the model uses.
-replacer function lets you replace 1 tri-mesh in a binary
model with another tri-mesh from an ascii model
-renamer function lets you rename textures in a binary
model

read the tutorials "KotOR_Tutorial.txt" and "Quick_tutorial.txt"
for an explanation of how to get your models into kotor

 

----------------------------
-->--
----------------------------

  Reveal hidden contents

 

 

-------------------
-->--
-------------------

  Reveal hidden contents

 

 

-------------------------------------------
-->--
-------------------------------------------

  Reveal hidden contents

 

 

--------------------------------------
-->--
--------------------------------------

  Reveal hidden contents

 

 

----------------------------------
-->--
----------------------------------
This script may only be hosted from sites that do not claim
ownership of files they host. In other words, any site that
claims "All files submitted to this site become property of
the site owner" can not host this script.

 

You are free to host this script from your website as long
as the distribution contains only the files listed below.

 

You are free to submit this script to any public download
site as long as the distribution contains all the files
listed below.

 

GPL.txt
icon.bmp
KotOR Tutorial.txt
mdlops.exe
mdlops.pl
MDLOpsM.pm
Quick_tutorial.txt
readme_mdlops_1-0.txt
replacer_tutorial.txt

 

I also ask that if you do host or submit this script to a
site send me an e-mail to let me know. My e-mail address
is at the top of this file.

 

 

Click here to download this file

  • Like 5

Share this post


Link to post
Share on other sites

This is great guys, it's amazing that the kotor series gets new and updated tools more than a decade after release. Thank you both.

Share this post


Link to post
Share on other sites
:w00t: I just used this last night on my mullet man head model, and it worked beautifully, so I've uploaded a new version of that mod. Thanks a ton.

Share this post


Link to post
Share on other sites

That's great work, guys. I can't understate the amount of mod ideas I've given up on because of smoothing issues, or the amount of time I spent looking through models in a hex editor to see if I could figure out the issue, to no avail. So this is a real boon to the community.

 

However... yes, of course there's a however...

 

However, I have a bug to report. I just edited a body model, and while the smoothing was retained very nicely, I noticed that the model's shadow is now gone, as you can see below.

 

swkotor2%202016-01-24%2012-02-05-25_zpst

 

There's the head's shadow, but the body's shadow is nowhere to be seen. Converting the model with version 0.6 does not result in this problem, but of course I lose the smoothing that way.

 

I've yet to determine if I can get around this using Taina's Replacer, but even so it would be nice to have it all in one package. (EDIT: Taina's Replacer did NOT work. Same problem.)

 

Since 0.6 didn't lose the shadow, I'm hoping it's just something missing from 0.7 that can be added back in.

Share this post


Link to post
Share on other sites

I'd have to consult with Fair Strides.

 

I don't think any of the shadow flags were touched, but it's possible that something was changed when he was cleaning up code? Hard to say.

Share this post


Link to post
Share on other sites

JCarter426, could you perhaps post the first 20 or so lines of the skin Torso part of the ascii? Just the part up to the verts section. I'm thinking you might try changing the Shadow flag on the ascii if it's 0, but if that doesn't fix it, I could take a look at the source code again...

Share this post


Link to post
Share on other sites

Sure:

node skin Torso

  parent JC_HandA

  position 0.0 0.0 1.11

  orientation 1.0 0.0 0.0 0.0

  wirecolor 1.0 1.0 1.0

  alpha 1.0

  ambient 1.0 1.0 1.0

  diffuse 1.0 1.0 1.0

  specular 0.0 0.0 0.0

  shininess 0.0

  bitmap JC_HandA

  verts 564

Share this post


Link to post
Share on other sites

Checked the ascii. The shadow flag is set to 1 on all of the trimeshes it makes sense to render a shadow for.

 

See, the bones are used to render shadows instead of the skin meshes. Not sure why really, but it might have to do with being being easier to compute.

 

I wonder if it's possible that messing with the vertex weights on the bone meshes could impact the way shadows are rendered..? ¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

Yeah, I noticed the shadows were coming from the bones. I was wondering about that. Like I said, though, I was still getting shadows with 0.6. And I've done it before without ever losing shadows. So I don't think it's a result of my messing... or not exclusively my messing, at any rate.

 

I hadn't touched the bones when I tried running it through Taina's Replacer, so I could try that later. Might not have access to the files for the rest of the night though.

Share this post


Link to post
Share on other sites
  On 1/24/2016 at 10:54 PM, VarsityPuppet said:

bones are used to render shadows instead of the skin meshes. Not sure why really, but it might have to do with being being easier to compute.

Yes, it's to reduce overhead for the Xbox1 the game was designed to run on. Still, even on modern PCs the game will sometimes crash if you try to force shadows on a mesh with too many polys.

Share this post


Link to post
Share on other sites
  On 1/25/2016 at 3:06 AM, DarthParametric said:

Yes, it's to reduce overhead for the Xbox1 the game was designed to run on. Still, even on modern PCs the game will sometimes crash if you try to force shadows on a mesh with too many polys.

Yikes! Yeah, that totally makes sense. I think I remember trying that on some skin meshes back in the day, with varying results.

 

Anyways, Fair Strides fixed it and it seems that face normals are part of what help determine shadows... ¯\_(ツ)_/¯

 

Also, too bad we never have figured out how to get the models to work on the xbox :/

Share this post


Link to post
Share on other sites
  On 1/25/2016 at 4:23 AM, VarsityPuppet said:

Yikes! Yeah, that totally makes sense. I think I remember trying that on some skin meshes back in the day, with varying results.

 

Anyways, Fair Strides fixed it and it seems that face normals are part of what help determine shadows... ¯\_(ツ)_/¯

 

Also, too bad we never have figured out how to get the models to work on the xbox :/

 

Makes even more sense considering how blocky the "bones" are would help with giving the shadows shape while conserving polies.

 

Also, it was either the Face Normals (which I doubt) or the Plane Distance on the faces, which it looks like I might have zeroed out by accident.

 

As for the XBox models, did anyone ever do a filedump and check the .mdl files? I know that K1 and K2 both have different seemingly-random numbers taking up the first twelve bytes of a .mdl file, so it could be that these numbers differ between the PC and Xbox versions...

Share this post


Link to post
Share on other sites
  On 1/25/2016 at 1:53 PM, DarthParametric said:

Didn't Team Gizka pull some stuff that was only in the Xbox version for use in TSLRP? Did the TSLRCM team do anything in that regard?

HK Factory, I believe... and M4-78 I think as well..?

Share this post


Link to post
Share on other sites
  On 1/25/2016 at 12:48 AM, Fair Strides said:

We've fixed the issue (either the face normals or plane distances) and uploaded a fixed version (now it's MDLOps 0.7 Alpha 2).

 

Ah, that's great! Thanks for the update.

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.