Quanon 263 Posted April 24, 2022 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="" Quote Share this post Link to post Share on other sites
DarthParametric 3,794 Posted April 24, 2022 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: Quote Share this post Link to post Share on other sites
JCarter426 1,220 Posted July 12, 2022 I ran into this issue with 3ds Max 2023: Spoiler 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 Quote Share this post Link to post Share on other sites
DarthParametric 3,794 Posted August 21, 2023 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 Quote Share this post Link to post Share on other sites
LoneWanderer 103 Posted October 7 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 Quote Share this post Link to post Share on other sites
Marius Fett 196 Posted October 7 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. Quote Share this post Link to post Share on other sites
LoneWanderer 103 Posted October 7 (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 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 October 7 by LoneWanderer Added info about odyssey_fn_import.ms script Quote Share this post Link to post Share on other sites