• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Streamlining XtoMDL Across Multiple Platforms

Paul Domingue

Resource contributor
Messages
1,532
Country
us-california
Streamlining XtoMDL Across Multiple Platforms

This is an update on my simple compiling system across multiple SDKs for 3ds Max users*. I should also point out that I have never attempted to produce anything for FSXSE so I will leave that for other people to figure out.

What follows is a very simple way of compiling models across all versions of the ESP based flight simulators with the exception of SE as mentioned above. This will allow you to compile native versions for every version from FSX to P3D v4 with just a click of the mouse. The procedure is based on a system first proffered to me by Bill Leaming.

This explanation may seem complicated but the end results are far from complicated.

Let's begin with a look at the supported versions of Max in all versions of P3D. Note; that even though you will want to compile models for FSX, the FSX SDK is no longer needed. Not everyone will have purchased all versions of P3D but all versions of the SDKs are available as free downloads. You want to begin by downloading and installing all four P3D SDKs. By the end of this tutorial you will end up with only one P3D SDK v4.x installed the rest will be uninstalled. We need to copy some files in the earlier versions of the SDKs to make this work.

They can be downloaded from here. http://www.prepar3d.com/support/sdk/

Supported versions of Max **

P3Dv1.4
7, 9, 2009, 2011, 2012
P3Dv2.x
7, 9, 2009, 2011, 2012, 2012x64, 2014x64, 2015x64
P3Dv3.x
7, 9, 2009, 2011, 2012, 2012x64, 2014x64, 2015x64, 2017x64
P3Dv4.x
2012, 2012x64, 2014x64, 2015x64, 2017x64

*I will also examine gMax and Blender and see if I can incorporate them as well.

**Unfortunately one of the most used versions of 3ds Max, Max 9, is no longer supported in P3D's v4.x release. Those still using it can work with v3.x down. I am looking at a work around to enable Max 9 in the v4.x SDK. I will post my results if successful.

Setup

1. Install all four versions of the P3D SDK, v1.4, v2.x, v3.x and v4.x

2. Create a temporary folder.

3. locate one of the 3ds Max Plugins folders in v1.4 SDK (any one will do even if it's not your version of 3ds Max) and copy the folder and all its content to the temporary folder. Rename the Plugins folder to P3Dv1. Do the same for v2.x and v3.x SDKs renaming the Plugins folders P3Dv2 and P3Dv3. Do not do this for the v4.x SDK.

At this point you can uninstall v1.4, v2.x and v3.x SDKs if you wish, they will no longer be needed. Do not uninstall v.4.x SDK. This will be your working SDK.

4. Copy the command string below into a plain text editor such as Notepad or Notepad++.

Code:
xtomdl.exe /xanim /dict:"D:\Program Files\Lockheed Martin\Prepar3D v4 SDK 4.0.23.21468\Modeling\3ds Max\bin\modeldef.xml" /xmlsample %1 >"%~p1\%~n1_buildlog.txt"

5. Edit the path statement in between the quotation marks so it points to the modeldef.xml in the bin folder of the v4.x SDK on your system. Do not alter anything else. Note; you can alter the XtoMDL switches before the path statement if needed but this one will serve for aircraft models.

6. Once edited save the command line using the extension .cmd. Use (save as) because your going to save 4 copies with different names. Name them something that reflects the four versions of the SDK. Note that v1.4 SDK is used to compile for FSX as well as P3D. This is how I named them,

Compile_FSX_P3Dv1_MDL.cmd
Compile_P3Dv2_MDL.cmd
Compile_P3Dv3_MDL.cmd
Compile_P3Dv4_MDL.cmd

The P3DvX part of the name corresponds to the renamed folders in the temporary folder we created.

7. Place the first three v1, v2 and v3 .cmd files into the corresponding folders in the temporary folder. So .cmd file P3Dv1 goes into renamed Plugins folder P3Dv1 in the temporary folder, etc.

For .cmd file P3Dv4, place it in the Plugins folder for your version of 3ds Max listed in the P3D v4.x SDK modeling section.

8. Place the three folders in the temporary folder to some appropriate location. This how mine are situated.



9. Go into each folder and the v4.x SDK plugins folder and create a shortcut for each of the four .cmd files. It is very important that you do not change the locations of the .cmd files after you create the shortcuts. If you do move them you will have to create new shortcuts. Gather all four shortcuts and place them in the temporary folder for convenience. Edit the shortcut names to reflect only the file header name. It's not necessary but it cleans things up a bit.

10. Open a new file explorer window and in the path line window type shell:sendto and the Send to folder will open. Drag and drop all four .cmd shortcuts into this window. Close it.



The hard part is done.

If you have not already done it, connect 3ds Max to the v4.x SDK as described in the SDK help file. http://www.prepar3d.com/SDKv4/LearningCenter.php

Export and Compile

In 3ds Max, Export your model to .X, we will call it mymodel.X. I have a folder in my model working folder named Export. All my .X files go there. You can place your exported files anywhere you find appropriate, the compiler won't care.

Select mymodel.X and right click the mouse to bring up the context menu. Select Send to and select the compiler for the native type of MDL you want.



The command line will instruct the XtoMDL compiler to use the same modeldef.xml file that 3ds Max used when exporting the .X file and it will create the mymodel.MDL and a file called mymodel_buildlog.txt placing them in the same location as the original mymodel.X file.

Which compiler you choose will compile a MDL native to that version.

In addition to this simple method of compiling your models, you only have the one modeldef.xml to be concerned about which is in the v4.x SDK rather than across multiple versions of the SDKs.

That's it.

I have tested this method quite extensively and have not encountered a problem so far. If someone should have some difficulty please let me know. Usually it can be attributed to the initial setup or an error in the command line.

Paul
 
Last edited:
Good news for 3ds Max 9 users. With P3D v4.x no longer supporting Max 9 you still can compile a P3D v4.x native .MDL. Use the P3D v3.x SDK to export to .X and the P3D v4.x SDK to compile. After some testing I found that the resulting .MDL files are identical regardless of which SDK you used to export.
 
I expect that goes for Max 2008 too, since I'm contemplating a new rig. Thanks Paul!
 
I expect that goes for Max 2008 too, since I'm contemplating a new rig. Thanks Paul!
While there was a slight difference in the header of the two .X files v3 and v4, they both compiled to identical .MDL files through the P3D v4.x XtoMDL.exe. As far as I can tell, the only difference between versions of Max is how they connect to the Aces Tools. The exports are all the same.
 
Paul, the export modules have to be compiled against the Autodesk SDK for each Max version, just as modules that interface with SimConnect have to be compiled with the SDK for each version.sub-version of FSX:SE and P3D.

XtoMDL.exe on the other hand isn't tied so closely to the different versions.sub-versions of P3D. There may be some minor difference with later versions of the SDK, but if so they should be reflected in the change log for that version.

However, the XtoMDL compilers for P3Dv3.x and v4.x do have some unique differences, as L-M has to take into account the new functionalities that have been added to the sim engine.
 
Paul, the export modules have to be compiled against the Autodesk SDK for each Max version, just as modules that interface with SimConnect have to be compiled with the SDK for each version.sub-version of FSX:SE and P3D.

XtoMDL.exe on the other hand isn't tied so closely to the different versions.sub-versions of P3D. There may be some minor difference with later versions of the SDK, but if so they should be reflected in the change log for that version.

However, the XtoMDL compilers for P3Dv3.x and v4.x do have some unique differences, as L-M has to take into account the new functionalities that have been added to the sim engine.
Bill, what's your point? All versions of XtoMDL and their prerequisite files across the span of SDKs are employed in my setup. As far as unsupported versions of Max in v4.x the exported DirectX files are relatively the same between v3.x and 4.x.
 
Bill, what's your point?
Paul, my commentary was aimed to explain the "why" of this statement you made above for everyone's edification:
"As far as I can tell, the only difference between versions of Max is how they connect to the Aces Tools."

I'm sorry if there was any confusion. I thank you profusely for your detailed post describing such an excellent workflow, which I intend to use while setting up my new dev computer over the next few days.
 
Thanks for clearing that up @n4gix I was concerned that I might have missed something.
I'm curious about the DirectX files created on export. Is there any difference between the .X and .xanim exported through v.1.4 vs v4.x?
 
That's a good question, Paul. Once I'm set up again I'll export both and then use a tool such as ExamDiff* to see what may be different.

* http://www.prestosoft.com/edp_examdiff.asp
That's a neat little program. Thanks for pointing it out.
I did a comparison. P3D v1, v2 and v3 all are identical in that they use ESP 1.0 DirectX files. I then compared the export of v3 (ESP 1.0 DirectX) vs v4 which uses what is called (Prepar3D v4 DirectX). There is a quite a difference in material settings (everything else seems to have remained the same) which I will leave for more knowledgeable people to analyze. How this will affect versions of Max that can not go beyond the ESP 1.0 SDKs I do not know. With that I have to retract my previous related statement.
 
Some testing with interesting results.
I have successfully exported my Defiant using the Prepa3D v4 DirectX and compiled with all four versions of XtoMDL.

I decided to try my Duck, which has modelling problems that I have not attended to. I exported it using v4 DirectX then compiled for v3. The compilation failed. I then compiled the same .X file with v4 and it was successful. I don't have the P3D v4 sim so I can't test in that version.
Hummm...... I took the v4 .MDL files and dropped them into P3D v3, which I have, and to my astonishment I was flying. Everything seemed to be working properly and the textures were brilliant.
Does this mean that P3D v4 is backwardly compatible?
More testing needed.
 
Well, this is puzzling. I set up the new "old" sim machine as the new dev machine. Max2012 installed, Aces Tools installed, .x and .xanim files export just fine...

However, neither of the .cmd files are working as expected. No .mdl file is compiled, and the buildlog is NULL (0 bytes). When using either of the "SendTo" compiler options, there is a quick flash of the command box, then a NULL buildlog file is created. :banghead:

Compile_FSX_P3Dv1_MDL.cmd
Code:
xtomdl.exe /xanim /dict:"D:\Prepar3D v4 SDK 4.0.28.21686\Modeling\3ds Max\bin\modeldef.xml" %1 >"%~p1\%~n1_buildlog.txt"

Compile_P3Dv4_MDL.cmd
Code:
xtomdl.exe /xanim /dict:"D:\Prepar3D v4 SDK 4.0.28.21686\Modeling\3ds Max\bin\modeldef.xml" /xmlsample %1 >"%~p1\%~n1_buildlog.txt"
 
Yep. The P3Dv1.4 xtomdl.exe will compile just fine via the normal DOS Box command line, so obviously something else is going pear shaped.
 
While there was a slight difference in the header of the two .X files v3 and v4, they both compiled to identical .MDL files through the P3D v4.x XtoMDL.exe. As far as I can tell, the only difference between versions of Max is how they connect to the Aces Tools. The exports are all the same.
By using the P3D v3 plugin you don't have access to the new material settings in P3D v4 of course and also not to the second set of UV coordinates. But if you don't use these features using v3 to export and v4 to compile is fine.
 
Does this mean that P3D v4 is backwardly compatible?
More testing needed.

Yes, it is. Also to P3D v2. The mdl header hasn't changed so the mdl files are understood by all three versions. V4 has some new sections that the older versions won't understand of course.
 
Well, this is puzzling. I set up the new "old" sim machine as the new dev machine. Max2012 installed, Aces Tools installed, .x and .xanim files export just fine...

However, neither of the .cmd files are working as expected. No .mdl file is compiled, and the buildlog is NULL (0 bytes). When using either of the "SendTo" compiler options, there is a quick flash of the command box, then a NULL buildlog file is created. :banghead:

Compile_FSX_P3Dv1_MDL.cmd
Code:
xtomdl.exe /xanim /dict:"D:\Prepar3D v4 SDK 4.0.28.21686\Modeling\3ds Max\bin\modeldef.xml" %1 >"%~p1\%~n1_buildlog.txt"

Compile_P3Dv4_MDL.cmd
Code:
xtomdl.exe /xanim /dict:"D:\Prepar3D v4 SDK 4.0.28.21686\Modeling\3ds Max\bin\modeldef.xml" /xmlsample %1 >"%~p1\%~n1_buildlog.txt"
Your command lines are correct structurally and the fact that the NULL buildlog is created confirms this. This has happened to me as well (even before this update) but it was always due to an error in the model exported. This is what happened for me as mentioned above for one of my models. The one that would not compile under v3 but did under v4. Why v4 worked while v3 didn't I cant say, for now. I tested all four versions with another model and it was successful every time.
Have you tried it with other models?
Yes, it is. Also to P3D v2. The mdl header hasn't changed so the mdl files are understood by all three versions. V4 has some new sections that the older versions won't understand of course.
So a model exported and compiled with v4 will work properly in the v3 sim but lack some new material setting. Is that correct? I think the new material settings are primarily involved with shaders....?
 
Back
Top