FSDeveloper Community

Go Back   FSDeveloper Community > Microsoft Flight Simulator development > Scenery Design - 3D Objects > 3D Objects General

3D Objects General Use this forum to discuss 3D objects related questions that do not fit in any of the other categories about specific tools.

Reply
 
Thread Tools Display Modes
  #1  
Old 13 Jan 2008, 18:03
Marginal's Avatar
Marginal Marginal is offline
  unitedkingdom
Location: London
Join Date: Oct 2006
Posts: 41
Blender <-> FSX MDL

Here are some scripts to import and export FSX MDL models to and from Blender. Basic documentation is included.

The following FSX features are curently not supported:
  • Animations
  • Attach Points
  • Platforms
  • Some material settings
but I hope to get most of these working in the future.

Please let me know if you have any questions, problems or if you're missing a feature
(or if you can help me understand how animations are encoded in an MDL file )
Attached Files
File Type: zip Blender2FSX_010.zip (23.4 KB, 7425 views)

Last edited by Marginal; 13 Jan 2008 at 18:07.
Reply With Quote
  #2  
Old 13 Jan 2008, 23:04
n4gix n4gix is offline
  unitedstates
Location: Hammond, Indiana
Join Date: Sep 2006
Posts: 8,512
While I'm certain that some will applaud the export capabilities, be prepared for some possible grief over the importer...

I cannot for the life of me imagine why any modeler would need to "import" their compiled model back into Blender (or any other 3d modeling program for that matter).
__________________
Bill Leaming
3d Modeler Max/GMax
C & XML Gauge Programmer
Eaglesoft Development Group
http://eaglesoftdg.com

Intel® Core™ i7-3770k 4.2GHz - Crucial 16GB DDR3 - Dual Radeon HD770 1GB DDR5 (Crossfire) - Eco II Watercooling - Win7 64bit
Intel® Core™ i7-2600k 3.4GHz - Crucial 4GB DDR3 - NVIDIA GeForce GTX550Ti 1GB - Win7 64bit
Intel® Core™ i7-860 2.8GHz - Crucial 8GB DDR3 - NVIDIA GeForce GTS240 1GB - Win8 64bit
NOTE: Unless explicitly stated otherwise, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...
Reply With Quote
  #3  
Old 14 Jan 2008, 14:31
empeck's Avatar
empeck empeck is offline
  poland
Join Date: Mar 2007
Posts: 29
I'm keeping fingers crossed for progress on the exporter. We do need a new freeware solution to make FSX compatible aircrafts and sceneries.

Thanks,

Mike
__________________
Cheers,
Mike

A2A Simulations | my twitter

Last edited by empeck; 14 Jan 2008 at 14:49.
Reply With Quote
  #4  
Old 14 Jan 2008, 15:15
arno's Avatar
arno arno is offline
  netherlands
Location: Amsterdam
Join Date: May 2004
Posts: 18,761
Send a message via Skype™ to arno
Hi,

Thanks, very interesting. I just started to read more about Blender with the idea of looking for some exporting tools later.

May I ask why you decided to go for direct MDL export? I think the preferred way is to write the X file and let XtoMDL make the MDL file. This is also easier as XtoMDL can do a lot of optimizations for you.

And I agree with Bill on the MDL import functionality. That is something we should be really careful with (especially in loading it into a modelling tool), as it would allow people to steal and modify other peoples work a lot easier.
__________________
Arno
If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done.

FSDeveloper Administrator | Former Microsoft FS MVP
Quick links: My tools | Wiki | Download center | Blog
Reply With Quote
  #5  
Old 14 Jan 2008, 15:24
n4gix n4gix is offline
  unitedstates
Location: Hammond, Indiana
Join Date: Sep 2006
Posts: 8,512
Quote:
Originally Posted by arno View Post
May I ask why you decided to go for direct MDL export? I think the preferred way is to write the X file and let XtoMDL make the MDL file. This is also easier as XtoMDL can do a lot of optimizations for you.
Not to mention that by doing so, one could not use MakeMDL.parts.xml file (for FS9), or the modeldef.xml file (for FSX)...

...without which NO animations would be possible for FSX models...
__________________
Bill Leaming
3d Modeler Max/GMax
C & XML Gauge Programmer
Eaglesoft Development Group
http://eaglesoftdg.com

Intel® Core™ i7-3770k 4.2GHz - Crucial 16GB DDR3 - Dual Radeon HD770 1GB DDR5 (Crossfire) - Eco II Watercooling - Win7 64bit
Intel® Core™ i7-2600k 3.4GHz - Crucial 4GB DDR3 - NVIDIA GeForce GTX550Ti 1GB - Win7 64bit
Intel® Core™ i7-860 2.8GHz - Crucial 8GB DDR3 - NVIDIA GeForce GTS240 1GB - Win8 64bit
NOTE: Unless explicitly stated otherwise, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...
Reply With Quote
  #6  
Old 14 Jan 2008, 16:54
jdberg's Avatar
jdberg jdberg is offline
  germany
Location: Darmstadt
Join Date: Jun 2004
Posts: 253
A blender exporter for FSX and FS9 would be great, because we actually also convert the sceneries for X-Plane and this would no longer be necessary. Blender is THE prefered tool for X-Plane.

Jörg
__________________
www.flightport.de
Reply With Quote
  #7  
Old 14 Jan 2008, 20:17
Marginal's Avatar
Marginal Marginal is offline
  unitedkingdom
Location: London
Join Date: Oct 2006
Posts: 41
Quote:
Originally Posted by arno View Post
May I ask why you decided to go for direct MDL export? I think the preferred way is to write the X file and let XtoMDL make the MDL file. This is also easier as XtoMDL can do a lot of optimizations for you.
Actually the exporter does save a .x file, and then invokes XToMdl on it. I was tempted to write the .MDL file directly (so removing the requirement to have the FSX SDK installed) but I haven't. So the user can hack the saved .x file and re-run XToMdl on it if they need to.

The reason that I invoke XToMdl directly rather than just leaving this step up to the user is that I suspect that most users find running command-line tools difficult, don't know how to hack the .x file, and have no wish to hack the .x file.

Quote:
Originally Posted by empeck View Post
I'd prefer blender -> .x -> xtomdl -> mdl route too.
It would be easier to make custom animations.
I intend to add support for animations. But what do you mean by "custom" animations - are there animations that you can't create using gmax and for which you have to hack the .x file?

Quote:
Originally Posted by n4gix View Post
I cannot for the life of me imagine why any modeler would need to "import" their compiled model back into Blender
If you're a modeller interested in using Blender you need some way of getting your existing models out of gamx and into Blender. You're unlikely to want to junk all your existing models and re-create them from scratch in Blender[*].

I would have written a Blender gmax importer or a gmax exporter, except for the fact that the gmax file format is undocumented and gmax appears to be deliberately crippled to discourage people from importing or exporting. So importing the .MDL file appears to be the only practical option.

I don't condone copyright infringement, but I'd point out that if people want to rip off your models they can already do so - they can use your textures and aircraft or scenery MDLs. Adding the ability to load an MDL into Blender doesn't significantly change this situation in my opinion.

Quote:
Originally Posted by jdberg View Post
A blender exporter for FSX and FS9 would be great, because we actually also convert the sceneries for X-Plane and this would no longer be necessary.
I'm the author of the Blender import/export scripts for X-Plane.


*: As an aside, I learned about the importance of providing users with ways to migrate their content from existing apps from reading an account of how Jeff Raikes, who ran the Microsoft Applications team in I think the early 90s, took on WordPerfect. In short, if you want to supplant an existing product then you have to provide ways for users to get their content out of the existing product and into your product. Ideally, and perhaps non-obviously, you should also provide users with a way of getting their content out of your product and into the existing product so that they feel that they can safely try your product without getting locked in.

Last edited by Marginal; 14 Jan 2008 at 20:42.
Reply With Quote
  #8  
Old 14 Jan 2008, 21:41
n4gix n4gix is offline
  unitedstates
Location: Hammond, Indiana
Join Date: Sep 2006
Posts: 8,512
Quote:
Originally Posted by Marginal View Post
I intend to add support for animations. But what do you mean by "custom" animations - are there animations that you can't create using gmax and for which you have to hack the .x file?
Many animations in FS9 and ALL animations in FSX are defined in XML scripts, which is then parsed by MakeMDL.exe for FS9, and XtoMDL.exe for FSX.

Complicating matters is that the XML Schema used for FS9 is very different to the XML Schema developed for FSX, so you would have to branch your script depending on which platform the user is exporting for...

...or have two different scripts at a minimum.

In addition, an FSX model requires an ProjectName.xamim file, which together with the ProjectName.x file are parsed by XtoMDL.exe to compile the finished .mdl file.

Max/GMax simply exports animation tracks; i.e., a key-frame matrix. The conditions and all other driving information comes from the XML scripts.

For example, here is an nnn.xanim for an object with a "rudder" animation file. This file would have to be generated by your Python script (or whatever handler you pass control to). It combines data from the model's animation matrix with data from the modeldef.xml file:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<AnimLib version="9.1">
  <Anim name="rudder_percent_key" guid="5433b2a0-0fd9-4192-8f7d-0ba36bf7191d" length="100.000000"
        type="Sim" typeParam="AutoPlay" typeParam2="rudder_percent_key">
    <AnimStream name="Rotation" id="0" partName="rudder" length="100.000000">
      <Keyframe time="0.000000" type="Quaternion" data="0.000000;0.000000;0.000000;1.000000"/>
      <Keyframe time="50.000000" type="Quaternion" data="0.000000;0.000000;0.174253;0.984701"/>
      <Keyframe time="100.000000" type="Quaternion" data="0.000000;0.000000;0.344016;0.938964"/>
    </AnimStream>
  </Anim>
</AnimLib>
Here is the associated code from the modeldef.xml file for the named animation:

Code:
<Animation name="rudder_percent_key" guid="5433b2a0-0fd9-4192-8f7d-0ba36bf7191d" length="100" type="Sim" typeParam2="rudder_percent_key" typeParam="AutoPlay" />

    <PartInfo>
        <Name>rudder_percent_key</Name>
        <AnimLength>100</AnimLength>
        <Animation>
            <Parameter>
                <Sim>
                    <Variable>RUDDER DEFLECTION PCT</Variable>
                    <Units>percent</Units>
                    <Bias>50</Bias>
                </Sim>
            </Parameter>
        </Animation>
    </PartInfo>
If you like, I can easily generate sample .x files for either FS9 or FSX (or both) for any type of animation...

...to be truly successful, your script(s) would need to replicate the .X file and .XANIM files perfectly.
__________________
Bill Leaming
3d Modeler Max/GMax
C & XML Gauge Programmer
Eaglesoft Development Group
http://eaglesoftdg.com

Intel® Core™ i7-3770k 4.2GHz - Crucial 16GB DDR3 - Dual Radeon HD770 1GB DDR5 (Crossfire) - Eco II Watercooling - Win7 64bit
Intel® Core™ i7-2600k 3.4GHz - Crucial 4GB DDR3 - NVIDIA GeForce GTX550Ti 1GB - Win7 64bit
Intel® Core™ i7-860 2.8GHz - Crucial 8GB DDR3 - NVIDIA GeForce GTS240 1GB - Win8 64bit
NOTE: Unless explicitly stated otherwise, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

Last edited by n4gix; 14 Jan 2008 at 21:57.
Reply With Quote
  #9  
Old 15 Jan 2008, 12:44
arno's Avatar
arno arno is offline
  netherlands
Location: Amsterdam
Join Date: May 2004
Posts: 18,761
Send a message via Skype™ to arno
Hi,

Quote:
Originally Posted by Marginal View Post
Actually the exporter does save a .x file, and then invokes XToMdl on it. I was tempted to write the .MDL file directly (so removing the requirement to have the FSX SDK installed) but I haven't. So the user can hack the saved .x file and re-run XToMdl on it if they need to.
That is great to hear. I agree that most users will be happy that they don't have to compile the X file manual, so that is a good feature.

Quote:
Originally Posted by Marginal View Post
If you're a modeller interested in using Blender you need some way of getting your existing models out of gamx and into Blender. You're unlikely to want to junk all your existing models and re-create them from scratch in Blender[*].

I don't condone copyright infringement, but I'd point out that if people want to rip off your models they can already do so - they can use your textures and aircraft or scenery MDLs. Adding the ability to load an MDL into Blender doesn't significantly change this situation in my opinion.
I agree that in the future we would need an upgrade path to be able to edit our own work. But personally I am not sure if importing the MDL files directly is the best way. For my ModelConverterX tool I have also worked on a MDL importer, but I have not released it (yet) for these reasons.

In my opinion the copyright trouble when somebody can actually edit my model, is a lot bigger than when they just use the texture or MDL file as is.

But this is indeed a tricky point, maybe it would be a good idea to start a separate discussion about this topic.

I have been thinking about other import option that would "prove" the user actually has the source. For FS2004 MDL files you can think of importing the ASM files (I haven't seen MDL decompilers yet). Unfortunately for FSX I did not find something that could be imported and only made if you have the sources.
__________________
Arno
If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done.

FSDeveloper Administrator | Former Microsoft FS MVP
Quick links: My tools | Wiki | Download center | Blog
Reply With Quote
  #10  
Old 20 Feb 2008, 03:09
BHawthorne BHawthorne is offline
 
Join Date: Feb 2008
Posts: 3
Smile

Thanks for developing this conversion tool. I think this is a valuable tool toward making Blender a primary modeling utility for MSFS X for me. A few of you have mentioned concern over unethical use of the utility. I believe that it shouldn't be a deterrent to come up with utilities like this. I look at it this way..."locks keep honest people honest". It's the dishonest people that you need to worry about, not the 99% of honest people. I believe that the community is savvy enough to realize whenever someone might do a knock-off plane and call them out. There is no need to be obscure about model format or conversion utilities in that situation. It's my belief that knowledge shouldn't be hidden -- rather people should be open and helpful with what they know. Conversion utilities like this fall into that category imho. Anyways, thanks much for coming up with this converter.

Last edited by BHawthorne; 20 Feb 2008 at 03:20.
Reply With Quote
  #11  
Old 20 Feb 2008, 12:46
n4gix n4gix is offline
  unitedstates
Location: Hammond, Indiana
Join Date: Sep 2006
Posts: 8,512
I think that no one has any concern whatever about the export script at all.

As for the "import script" that will take a .mdl and dissect it for use in Blender, my own testing has proven that to be a non-issue as well, simply because the resulting mish-mash-of-mesh is -for all practical purposes- pretty much useless for "casual theft" of someone's IP.
__________________
Bill Leaming
3d Modeler Max/GMax
C & XML Gauge Programmer
Eaglesoft Development Group
http://eaglesoftdg.com

Intel® Core™ i7-3770k 4.2GHz - Crucial 16GB DDR3 - Dual Radeon HD770 1GB DDR5 (Crossfire) - Eco II Watercooling - Win7 64bit
Intel® Core™ i7-2600k 3.4GHz - Crucial 4GB DDR3 - NVIDIA GeForce GTX550Ti 1GB - Win7 64bit
Intel® Core™ i7-860 2.8GHz - Crucial 8GB DDR3 - NVIDIA GeForce GTS240 1GB - Win8 64bit
NOTE: Unless explicitly stated otherwise, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...
Reply With Quote
  #12  
Old 20 Feb 2008, 17:11
BHawthorne BHawthorne is offline
 
Join Date: Feb 2008
Posts: 3
Quote:
Originally Posted by n4gix View Post
I think that no one has any concern whatever about the export script at all.

As for the "import script" that will take a .mdl and dissect it for use in Blender, my own testing has proven that to be a non-issue as well, simply because the resulting mish-mash-of-mesh is -for all practical purposes- pretty much useless for "casual theft" of someone's IP.
That being true, it's still useful for casual reverse engineering of measurements. If someone wanted to get the base measurements for specific cockpit panels and make their own cad drawing/simpit based on that, you fall into a gray area. That in mind, it's still tons of work to pull that off even. It would just take the measurement aspect out of the work, not the making a model from scratch part. I've pondered the concept of simpit builders using this to get semi-accurate measurements (once scaled) for simpits that don't have well established dimensions. Imagine the inadvertent help something like that would provide to them for their one-off projects. Technically, that could be considered as derivative model stealing though. In that situation it would have implications outside of a virtual model into people actually using it for reference in actual physical home-brew simulators. I suppose if you legally purchased the aircraft add-on and wanted to use the model to make a simpit, to fly the model in, that might be interesting. I don't know if anyone has thought of the ethical implications of using the utility to achieve simpits, or if there are any real ethical implications for personal one-off use in this way.

Last edited by BHawthorne; 20 Feb 2008 at 17:23.
Reply With Quote
  #13  
Old 20 Feb 2008, 23:57
n4gix n4gix is offline
  unitedstates
Location: Hammond, Indiana
Join Date: Sep 2006
Posts: 8,512
Frankly, the import .mdl is a wonderful diagnostic tool for helping one build uber-efficient FSX models, precisely because everything is imported "per drawcall!"

I've been using it (along with another utility program with which I'm acquainted) to optimize one of my models.

So far I've managed to reduce it from 223 drawcalls (FS9 MakeMDL compiled) to a mere FIVE drawcalls (XtoMDL compiled)...
__________________
Bill Leaming
3d Modeler Max/GMax
C & XML Gauge Programmer
Eaglesoft Development Group
http://eaglesoftdg.com

Intel® Core™ i7-3770k 4.2GHz - Crucial 16GB DDR3 - Dual Radeon HD770 1GB DDR5 (Crossfire) - Eco II Watercooling - Win7 64bit
Intel® Core™ i7-2600k 3.4GHz - Crucial 4GB DDR3 - NVIDIA GeForce GTX550Ti 1GB - Win7 64bit
Intel® Core™ i7-860 2.8GHz - Crucial 8GB DDR3 - NVIDIA GeForce GTS240 1GB - Win8 64bit
NOTE: Unless explicitly stated otherwise, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...
Reply With Quote
  #14  
Old 13 Apr 2008, 13:26
Jorge Antunes Jorge Antunes is offline
  portugal
Join Date: Sep 2006
Posts: 14
Hio, any news on the blender exporter?
Reply With Quote
  #15  
Old 13 Sep 2009, 16:44
fael097's Avatar
fael097 fael097 is offline
  barbados
Join Date: Jan 2008
Posts: 63
man, blender2fsx is just what i needed, thank you SO MUCH!
but i have just a question: how to manually install it? since the installer doesn't seems to work on windows 7.
also, do i need python installed? cuz blender can't detect python installation.
thanks again.
Reply With Quote
  #16  
Old 10 Oct 2009, 15:16
liser liser is offline
  spain
Join Date: Jul 2009
Posts: 24
hi!

is there someone in here???

Well, I've been looking all over the net and it seems that Blender2FSX isn't working well.



Just wanted to confirm that.

Marginal! are you still working on this???

I've spent hours working on a model for an airport project that i'm starting, textured it, and it's not working.
Actually I could export the model with a simple material and see it in FSX, but if it's textured it doesn't work.

Blender is great software and working in gmax is painful! (IMHO) so, if I don't find how to work between blender and fsx I think i'll give up.

I hope there's a reply soon.

Thanks!

Last edited by liser; 10 Oct 2009 at 15:20. Reason: forgot somethin to write, sorry!
Reply With Quote
  #17  
Old 10 Oct 2009, 19:22
n4gix n4gix is offline
  unitedstates
Location: Hammond, Indiana
Join Date: Sep 2006
Posts: 8,512
GMax is nowhere near as painful as trying to get the Blender2FSX stuff working...
__________________
Bill Leaming
3d Modeler Max/GMax
C & XML Gauge Programmer
Eaglesoft Development Group
http://eaglesoftdg.com

Intel® Core™ i7-3770k 4.2GHz - Crucial 16GB DDR3 - Dual Radeon HD770 1GB DDR5 (Crossfire) - Eco II Watercooling - Win7 64bit
Intel® Core™ i7-2600k 3.4GHz - Crucial 4GB DDR3 - NVIDIA GeForce GTX550Ti 1GB - Win7 64bit
Intel® Core™ i7-860 2.8GHz - Crucial 8GB DDR3 - NVIDIA GeForce GTS240 1GB - Win8 64bit
NOTE: Unless explicitly stated otherwise, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

Last edited by n4gix; 14 Dec 2009 at 12:15.
Reply With Quote
  #18  
Old 14 Dec 2009, 10:16
liser liser is offline
  spain
Join Date: Jul 2009
Posts: 24
is this dead??
Isn't there any workaround from blender to fsx???
Reply With Quote
  #19  
Old 14 Dec 2009, 10:20
FelixFFDS FelixFFDS is offline
  puertorico
Location: Orlando, FL
Join Date: Sep 2006
Posts: 1,614
Quote:
Originally Posted by liser View Post
is this dead??
Isn't there any workaround from blender to fsx???
Blender -> 3DS -> gmax-> FSX

will be the easiest way....
__________________
Felix / FFDS
Reply With Quote
Reply

Tags
blender, blender2fsx

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MDL Tweaker does not work with FsX MDL file arno MDL Tweaker 0 18 Mar 2007 04:46
What do I do after the mdl extraction? jimmis GMax and 3DS Max 12 11 Jan 2007 05:13
BGL_LIGHTS and MDL Tweaker gadgets GMax and 3DS Max 2 05 Jan 2007 20:57
Comparing MDL Files scruffyduck General 6 20 Dec 2005 16:03
MDL Hex editing? flightsimstudios General 1 12 Mar 2005 15:05


All times are GMT -4. The time now is 07:50.

Kirsch designed by Andrew & Austin


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.