bead-v

KOTORmax bug reporting thread

Recommended Posts

Hey, all!

I recently reinstalled 3Ds Max and KotorMax. But I ran into a little snag. Whenever I hit export I get this error message.
I've looked through an old PM chain between me and Bead-V, cause I had the feeling I've encountered this before... Feel like a noob now 😅

I checked the KotorMax.ini file. UseMax is 1, so... Sanity looks weird though?
 

[init]
dock=1
basepointer=1
sanity=111110111111111
verbose=0
visible=1
usemax=1
exportwok=0
exportcolors=0
dotascii=1
lowercase=1
position=[0,100]
lastexport=""

 

KotorMax_Bug.jpg

Share this post


Link to post
Share on other sites

The sanity value is fine, although interestingly mine has usemax=0 (although looking at the script, this is bypassed via a lookup of the Max version number).

Edit: The sanity values come from the Preferences settings:
Sanity.jpg.7c66e019833411a9ec988ee13977f277.jpg

Share this post


Link to post
Share on other sites

I ran into this issue with 3ds Max 2023:

Spoiler

czpZvrl.png

I think it has to do with the PhysicalMaterial type that was introduced in 3ds Max 2017 and lacks a diffuse field. Maybe they changed MultiMaterial to use PhysicalMaterial by default.

Whatever the case, this error prevents any models with walkmeshes from importing. I was able to get them to import with the following correction to KOTORmax/kotormax_scripts/odyssey_fn_general.ms:

       newMaterial = multimaterial name:matName numsubs:SurfaceMatName.count

       for i in 1 to SurfaceMatName.count do
       (
         newMaterial.names[i] = SurfaceMatName[i]
         newMaterial[i] = standard name: SurfaceMatName[i] diffuse: kx_SurfaceMat[i]
       )

This seems to work, although I must confess I know next to nothing about MAXScript and I'm not sure that StandardMaterial is the correct material type that it was before. Still, it seems to be at least a step in the right direction.

I've attached the edited script.

odyssey_fn_general.ms

Share this post


Link to post
Share on other sites

For those having errors when loading placeable PWKs (possibly also door DWKs?), it appears the problem is line 417 in \Scripts\KOTORmax\kotormax_scripts\odyssey_fn_import.ms:

kx_enableMapChannel newObj 0 true

which gives the error about wanting two arguments but getting three when processing the walkmesh. Changing it to:

kx_enableMapChannel newObj 0

fixes the issue. Pre-edited copy attached for those that don't want to edit it themselves.

odyssey_fn_import.ms

Share this post


Link to post
Share on other sites

There is a small bug or oversight with the 'bumpmappable' flag in KOTORmax: if multiple meshes share a texture, and we enable/disable the 'bumpmappable' flag for one mesh, it is automatically enabled/disabled for others with the same texture. This becomes a problem when working with models that have meshes with alpha < 1 and use the same texture for all meshes, since mesh transparency does not work with the normal map.

In MDLEdit, the 'bumpmappable' flag is also tied to the texture, rather than to individual meshes (as can be seen in the Textures menu).

The 'tangent space (bumpmappable)' mesh flag in Blender works correctly and can be set individually for each mesh, even if they share the same material/texture. If we use MDLEdit to convert a Blender .mdl model to .ascii and then load it into KOTORmax, the flags set for each mesh will persist until we interact with them.


Unrelated issue: When exporting a model with .pwk from KOTORmax, .pwk becomes non-solid (player can walk through placeable object). Import the same model into Blender, don't change anything, export, and the .pwk will magically become solid (impassable) again. Tested on many models. Here is custom g_wing model (from 501ond in TSL) with a non-solid .pwk.

g_wing_custom.zip

Share this post


Link to post
Share on other sites
8 minutes ago, LoneWanderer said:

There is a small bug or oversight with the 'bumpmappable' flag in KOTORmax: if multiple meshes share a texture, and we enable/disable the 'bumpmappable' flag for one mesh, it is automatically enabled/disabled for others with the same texture. This becomes a problem when working with models that have meshes with alpha < 1 and use the same texture for all meshes, since mesh transparency does not work with the normal map.

In MDLEdit, the 'bumpmappable' flag is also tied to the texture, rather than to individual meshes (as can be seen in the Textures menu).

The 'tangent space (bumpmappable)' mesh flag in Blender works correctly and can be set individually for each mesh, even if they share the same material/texture. If we use MDLEdit to convert a Blender .mdl model to .ascii and then load it into KOTORmax, the flags set for each mesh will persist until we interact with them.


Unrelated issue: When exporting a model with .pwk from KOTORmax, .pwk becomes non-solid (player can walk through placeable object). Import the same model into Blender, don't change anything, export, and the .pwk will magically become solid (impassable) again. Tested on many models. Here is custom g_wing model (from 501ond in TSL) with a non-solid .pwk.

g_wing_custom.zip 56.64 kB · 0 downloads

If you edit the ascii which KotORMax exports in Notepad, you can set the bumpmappable flag value for whichever meshes you'd like. Have you tried this? Or does MDLEdit revert the changes when you compile?

 

To your second point, which process are you following for creating your walkmeshes? I've created multiple custom placeables with new walkmeshes and they're all solid.

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, Marius Fett said:

If you edit the ascii which KotORMax exports in Notepad, you can set the bumpmappable flag value for whichever meshes you'd like. Have you tried this? Or does MDLEdit revert the changes when you compile?

I was already suggested this on Discord, but I completely forgot to check it out. Thanks for reminding me! I think if we manually edit the flag in Notepad, MDLEdit will compile the model without any issues. After all, both KotORMax and MDLEdit import and export models from Blender with 'bumpmappable' flag intact. On inner level they understand that 'bumpmappable' is a property of the mesh. It's just that for some reason in their GUI, the 'bumpmappable' flag is bound to the texture.

As for .pwk: All I have to do is import the model (.mdl.ascii + .pwk.ascii) and then export it (I usually export through 'Odyssey Base Params' section on the right, but also tested exporting once via the 'MDL Exporting' section on the left). Then compile the model using MDLEdit. Even without edting anything in KMax, .pwk becomes non-solid.

Spoiler

model_pwk_issue.jpg.97cde77e325db9723b3a15e9157bec6a.jpg

When creating new .pwk in Max my steps are:
1.Create a shape from lines.
2.Select "Turn to Mesh" Modifier.
3.Add "OdysseyWalkmesh" Modifier.
4.Make it a child of OdysseyBase.
5.Select "Placeable (pwk)" in Walkmesh Type field.

 

Edit: I think I'm using the updated odyssey_fn_import.ms script from DarthParametric post above because I found my old Discord post where I wrote about the error 'Odyssey Importer ScriptError when reading pwk file' and was linked to his post. Since I no longer have this error, I most likely installed the script.

Edited by LoneWanderer
Added info about odyssey_fn_import.ms script

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.