1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Showing model (MDL file) with AC textures?

Discussion in 'Tools programming' started by garfield_x, 6/3/07.

  1. garfield_x

    garfield_x

    Joined:
    30/11/06
    Messages:
    72
    Country:
    netherlands
    Hi

    Is someone familiar or knows where to find some information to show an image of the aircraft model with the texture in a screen/window as is done by FSRepaint?

    I want to include such a viewer in one of my programs (if possible )

    Any help is welcome.
  2. arno

    arno Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    28/5/04
    Messages:
    21,285
    Country:
    netherlands
    Hi Peter,

    For my MDL Tweaker tool I have build a parser that can read the MDL files and show a preview of them in a window. But this code only works for Fs2004 scenery MDL files at the moment.

    For FsX there is no different between aircraft and scenery anymore, but my MDL reading code is certainly not finished yet :).
  3. garfield_x

    garfield_x

    Joined:
    30/11/06
    Messages:
    72
    Country:
    netherlands
    Thx for the reply.

    Where did you got the information about these things?
    I did a lot of search with google on MDL files etc. I found out that it actually are RIFF files, but i could not find any information on how to process these files for displaying.

    I've looked at the DirectX SDK, but also no information.
  4. arno

    arno Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    28/5/04
    Messages:
    21,285
    Country:
    netherlands
    Hi Peter,

    Basically I figured it out myself what the MDL file contains. I have made an article about this on the Wiki. For the FsX format we are now working on a similar article, but it is certianly not complete yet.
  5. theisomizer

    theisomizer

    Joined:
    15/1/07
    Messages:
    157
    Country:
    us-texas
    Yes, and I have a lot more I have figured out myself (FSX format) that I need to add. It's hard to find time to update the wiki but I will be releasing an API soon that can read the FSX MDL (with extensive documentation and some C++ source code). So hopefully once that happens I can update some of the wiki stuff.

    Sean
  6. garfield_x

    garfield_x

    Joined:
    30/11/06
    Messages:
    72
    Country:
    netherlands
    That would be nice.

    To me it si just a small addon to my ACA program, so it must not take a lot of time for me.
  7. theisomizer

    theisomizer

    Joined:
    15/1/07
    Messages:
    157
    Country:
    us-texas
    Yes, it should be fairly straightforward. In your program you will just need to make an external call to my API dll, and my program will then decode all of the sections of the file into memory for your application to use.

    I'll have an interim (Bug free yet incomplete) build ready in a week or so, and I'll make an announcement here when its ready.

    Cheers,
    Sean
  8. zippyo

    zippyo

    Joined:
    2/4/07
    Messages:
    15
    Hello fellow MDL freaks!

    Arno I've been reading your wiki format description on MDLX datatyped RIFF files and for once something like this might even make sense to me. Not a programmer just a hardcore FS mesh junkie. Well I've been lovin' the poking you've done to it so I started coding my own little gem in DELPHI to parse the fsx MDL files. got a few different methods to parse the file and I even brute forced a little GL viewer to render the whole chaos as a 'single' mesh. ALL vertices from VERT all indices from INDE arrayed all up in sequence. NO PART info from the LOD tables yet(in progress). I don't even have to start listing the questionable practices in the least with that approach....but it renders at least one part ok, which is a rather big leap for me.
    Well You coding in C languages is not as clear but the info is awesome! I'll read up on C syntax to make sense of it.
    I sure could enjoy some detailed discussions an the fundamentals of the different VertexBuffers and why all the Different VERT(chunks) sections why not just one like INDE, and how they all get a PART defined.

    thanx

    Peter
  9. arno

    arno Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    28/5/04
    Messages:
    21,285
    Country:
    netherlands
    Hi Peter,

    It is certainly very interesting to understand why things have been implemented like they are. I don't understand all this myself yet, but while playing with the new MDL format that is certainly something to learn. If we can have some good discussions about that on the forum, that would be great of course.
  10. zippyo

    zippyo

    Joined:
    2/4/07
    Messages:
    15
    I got the parsing for the partslist in the bag. Last LOD only for high res mesh.
    Eagerly waiting for anyone to share thoughts on this parts issue....lots of 'em.
    From FSX 747 I loaded 303 chunks not including the other LODE chunks or anything from ANIB. might expand options to pick LODE chunk to read and send to GL renderer later, but must sort out the meshes first. So before I fill my arrays with silly stuff I hope someone sheds a little more light on it.....

    Peter
    Last edited: 12/4/07
  11. zippyo

    zippyo

    Joined:
    2/4/07
    Messages:
    15
    [​IMG]

    Well not a lot of discussion in past days:confused:
    Tested my theory with the mesh rendering and it looks ok for now.
    but with NO parts splitting the following triangles seem to be bound within the first mesh, so must get dirty with the offsets and counts. Prying at it with a crowbar seems to be getting me forward slower than perhaps a scalpel would.

    Maybe some more ellaborate discussions?

    zip
  12. theisomizer

    theisomizer

    Joined:
    15/1/07
    Messages:
    157
    Country:
    us-texas
    Zip/Peter,

    Welcome to the forums, and sorry for any lack of discussion. I think I speak for all of us when I say that it isn't a lack of interest that keeps us from posting, only a lack of time.

    Anyways, I read both of your posts but don't quite understand what your question is. What are the problems are you having with the PART sections?

    Personally I am pretty familiar with the MDL format, and I know several others here on the forum are as well. I hope we can help answer your question.

    Yours,
    Sean
  13. zippyo

    zippyo

    Joined:
    2/4/07
    Messages:
    15
    Greets Sean,

    Having said I'm not a programmer probably means different things to people, but it's just that. So I was asking for more of this intense research to surface. Aircraft Engineering background fuels most of my interests, and Arno's description was enough for me to get interested. I model Aircraft for personal pleasures but the more you learn the more you want. I managed to get a few methods workin on converting my MDL (FS9), back to source with tex but no anim. So FSX is out now the format description is out so I guess I wanted to make a newbie thread out of this discussion. like a live tutorial for others interested including myself.
    My question was about the Vertexbuffers and the reason for multiple VERT sections, having compared it to INDE. and the PART reference offsets into which of those. TANS???? TRAN-transform matrices? Do I need them for anything in static mesh only? Or just for animation data?
    Anything You guys got I'll take so I can curl up and READ and try.....

    Zip
  14. theisomizer

    theisomizer

    Joined:
    15/1/07
    Messages:
    157
    Country:
    us-texas
    Zip,

    Ok, I see what you are saying. Believe it or not I come from a similar background you do, and you remind me of myself a few years ago. I am an aerospace engineer myself and so are several others of us, including arno. Although I wouldn't say I am a beginner at programming, I am certainly far from being an expert and still have a lot to learn. We all do. So I can relate.

    Anyways, the documentation publicly available on the MDL format is very sparse. I have been meaning to update it with some of my knowledge for a long time, but never got around to it. I guess now I have a reason to.

    I have the next four days off for the easter holidays, and I will write a nice MDL tutorial during this time. I owe it to the FS community for all the help they've given me. Think of it as a "MDL for Dummies". I think it should help answer most of your questions and should give you a jump start on your MDL Reading tool.

    I am working on the following MDL resources, in chronological order:

    1. Updated Wiki page with more MDL information
    2. Above mentioned beginner's MDL tutorial
    3. Eventually a pdf file with the complete MDL specification
    4. Some more tutorials
    5. Some source code <C++ at first, but might port it to other languages> to assist in reading/rendering/converting the MDL format
    6. An open source app that actually will read/render/convert the MDL format

    Eventually I hope to have a complete system that can convert the MDL back to gmax source code. It would probably consist of an app that would dump the MDL back to a .X file (or possibly the intermediate XML format). Then a maxscript that would load the file back into gmax. But I am still far from this.

    Anyways, until I have this tutorial together, here is what I recommend you do:

    1. Read up on the C-based language syntax. Delphi certainly is not a bad language, and I am not telling you to switch to C. Trust me, I had been writing Pascal many years before I started C. But most of us FS guys work in C-based stuff, so it will help you to understand the syntax. I'd say C++ is a good place to start as it is a nice mix between lower level C & higher level C#.

    2. Download the DirectX SDK. I know you are using OGL, but the DXSDK has some great info on 3D graphics in general. And FS stores much of its information in a DX like format, since it has to send it straight to the DX engine.

    3. Download .net Reflector or some equivalent program and explore some of the MDL tools. I suggest taking a look at xtomdl.exe and mdlscan.exe.

    4. Explore the XML intermediate format of the MDL file. Try compiling a model with the /KEEP option and explore the generated XML file. It is the closest representation of the MDL file there is, and contains all of the same info the MDL does only in a human readable format. It is an invaluable resource.

    I'll answer some of your more specific MDL questions in the tutorial. Have fun and good luck until then,

    Sean
  15. zippyo

    zippyo

    Joined:
    2/4/07
    Messages:
    15
    ....mmmmm.....
    This is what I was Prying at! This will start a new era. The knowledge base provided on the net, enables people llike myself to do the things that were black voodoo done by guru coders back just a few years. eg gauges programming. XML now allows me to do complete custom panel from the ground up with (not sure), almost as much functionality if not as good. And the code to it is done in the same household. Trying to keep away from C as long as feasible, so I can get Delphi under my belt. Also I parctice my hand in disassembly, reversing and assembly coding as well. All in my 'spare' time, so rather slow. Info that You and Arno made available is what feeds the mind of people like me who need a little more than the will itself. I know I'm in way over my head but this makes me wanna learn more all the time!

    Thanx fellows for holding the light for us

    Zip
    Last edited: 7/4/07
  16. zippyo

    zippyo

    Joined:
    2/4/07
    Messages:
    15
    got all excited so I enumerated all the mesh chunks ready to read in memorystreams. It seems ready to go. I'm readying a new loop to make my model class contain all the sub-meshes for the Draw proc. I have the mescount so I might have another go at it to draw more than 1 object.
    [​IMG]


    zip
    Last edited: 12/4/07
  17. zippyo

    zippyo

    Joined:
    2/4/07
    Messages:
    15
    Greets simmers...

    Still pounding away at my keyboard.(Eagerly awaiting the tuts for dummies) Made some changes in UI (must say GLScene makes it very easy), to piggyback a Renderer onto my parser instead of a separate loader app. Gonna try and size the box to BBOX dimensions and take it from there step by step.

    HAPPY EASTER !



    zip
    Last edited: 12/4/07
  18. zippyo

    zippyo

    Joined:
    2/4/07
    Messages:
    15
    ...and the blind bat is still flyin'...
    I shoved 3 textured boxes into max8 and built mdl. still using the same code that I used to visualize the cessna and it shows all 3. Scene root has 3 children (are these not parts?). But if I attach 2 together it'll optimize it and I get messed up mesh. Not even really sure of its importance but I'd like to be for the hell of it. Anyone who finds my 'comic relief' worthy is welcome to add to my 'in'sanity.

    PS: @theisomizer: Reflector is a crafty little gadget, sure I'll invest some time there. Also would love to know the purpose of MdlScan....

    zip

    [​IMG]
    Last edited: 12/4/07
  19. zippyo

    zippyo

    Joined:
    2/4/07
    Messages:
    15
    by the look of it just call me the 'thread killa' ...

    [​IMG]

    compliments of Reflector
    almost there...:stirthepo
    Last edited: 12/4/07
  20. theisomizer

    theisomizer

    Joined:
    15/1/07
    Messages:
    157
    Country:
    us-texas
    Hey zip,

    Glad to see you are coming along. On the Cessna model it looks like you have come pretty far. Now if we can just fix the rest we'll be in good shape!:wizard:

    Anyways, I went through and de-hexed the stuff from reflector. Here's what I got: (Sorry it's in C++ but it's the comments that count)

    Code:
    namespace Microsoft
    {
        namespace FlightSimulator
        {
            public __value enum RIFF_KEY_TYPE
            {
                // Fields
    		DICT_SIGNATURE = 0x54434944,//--------------------------------- DICT
    		FS9_ANIMATION_COMMANDS_SIGNATURE = 0x43494e41,//=============== ANIC
    		FS9_ANIMATION_PARAMETERS_SIGNATURE = 0x50494e41,//------------- ANIP
    		FS9_ANIMATIONS_SIGNATURE = 0x4d494e41,//======================= ANIM
    		FS9_ATTACH_POINT_SIGNATURE = 0x41545441,//--------------------- ATTA
    		FS9_ATTACHED_OBJECT_DATA = 0x4f545441,//======================= ATTO
    		FS9_BGL_ENTRY_SIGNATURE = 0x204c4742,//------------------------ BGL 
    		FS9_BOUNDING_BOX_SIGNATURE = 0x584f4242,//===================== BBOX
    		FS9_CRASH_SIGNATURE = 0x53415243,//---------------------------- CRAS
    		FS9_CREATOR_SIGNATURE = 0x54465349,//========================== ISFT
    		FS9_DICTIONARY_SIGNATURE = 0x54434944,//----------------------- DICT
    		FS9_EXTERIOR_MODEL = 0x45545845,//============================= EXTE
    		FS9_INTERIOR_MODEL = 0x45544e49,//----------------------------- INTE
    		FS9_LOD_SIGNATURE = 0x20444f4c,//============================== LOD 
    		FS9_MATERIALS_SIGNATURE = 0x4554414d,//------------------------ MATE
    		FS9_MODEL_HEADER = 0x20394d48,//=============================== HM9 
    		FS9_MOUSE_RECT_SIGNATURE = 0x53554f4d,//----------------------- MOUS
    		FS9_PLATFORMS_SIGNATURE = 0x54414c50,//======================== PLAT
    		FS9_SCENE_GRAPH_SIGNATURE = 0x4e454353,//---------------------- SCEN
    		FS9_SHADOW_MODEL = 0x44414853,//=============================== SHAD
    		FS9_STATIC_TRANSFORM_SIGNATURE = 0x4e415254,//----------------- TRAN
    		FS9_TEXTURES_SIGNATURE = 0x54584554,//========================= TEXT
    		FS9_VERTICES_SIGNATURE = 0x54524556,//------------------------- VERT
    		FSX_ANIM_BLOCK_SIGNATURE = 0x42494e41,//======================= ANIB
    		FSX_ANIM_LINK_SIGNATURE = 0x4c414753,//------------------------ SGAL
    		FSX_ANIM_TRANSFORM_SIGNATURE = 0x54494e41,//=================== ANIT
    		FSX_ANIMATION_MAP_SIGNATURE = 0x50414d41,//-------------------- AMAP
    		FSX_ANIMATION_PARAMETERS_SIGNATURE = 0x50494e41,//============= ANIP
    		FSX_ATTACHED_OBJECT_DATA = 0x4f545441,//----------------------- ATTO
    		FSX_AUTOGEN_AUTOGEN_2 = 0x324e4741,//========================== AGN2
    		FSX_AUTOGEN_FILE_KEY = 0x584e4741,//--------------------------- AGNX
    		FSX_AUTOGEN_GENERIC_BUILDING_DEFINITIONS = 0x44444247,//======= GBDD
    		FSX_AUTOGEN_GENERIC_BUILDING_PLACEMENTS = 0x444c4247,//-------- GBLD
    		FSX_AUTOGEN_GENERIC_BUILDING_TEXTURE = 0x45544247,//=========== GBTE
    		FSX_AUTOGEN_POLYGON_REGION_DATA = 0x47455250,//---------------- PREG
    		FSX_AUTOGEN_POLYLINE_BUILDING_DATA = 0x444c4250,//============= PBLD
    		FSX_AUTOGEN_POLYLINE_VECTOR_DATA = 0x43455650,//--------------- PVEC
    		FSX_AUTOGEN_ROW_HOUSE = 0x48574f52,//========================== ROWH
    		FSX_AUTOGEN_VEGETATION_FS9_RECTANGLE_DATA = 0x4f524756,//------ VGRO
    		FSX_AUTOGEN_VEGETATION_FS9_RECTANGLE_DEFINITION = 0x44524756,// VGRD
    		FSX_AUTOGEN_VEGETATION_GUID_RECTANGLE_DATA = 0x47524756,//----- VGRG
    		FSX_AUTOGEN_VERSION = 0x53524556,//============================ VERS
    		FSX_BONE_MAP_SIGNATURE = 0x50414d42,//------------------------- BMAP
    		FSX_BOUNDING_BOX_SIGNATURE = 0x584f4242,//===================== BBOX
    		FSX_HEADER_SIGNATURE = 0x484c444d,//--------------------------- MDLH
    		FSX_IK_CHAIN_LIST = 0x4c434b49,//============================== IKCL
    		FSX_IK_JOINT_CONSTRAINT = 0x434a4b49,//------------------------ IKJC
    		FSX_IK_JOINT_CONSTRAINT_REF = 0x434a4753,//==================== SGJC
    		FSX_INDEX_BUFFER_SIGNATURE = 0x45444e49,//--------------------- INDE
    		FSX_LOD_ENTRY_SIGNATURE = 0x45444f4c,//======================== LODE
    		FSX_LOD_TABLE_SIGNATURE = 0x54444f4c,//------------------------ LODT
    		FSX_MATERIALS_SIGNATURE = 0x4554414d,//======================== MATE
    		FSX_MODEL_DATA = 0x444c444d,//--------------------------------- MDLD
    		FSX_MODEL_FRIENDLY_NAME_SIGNATURE = 0x4e4c444d,//============== MDLN
    		FSX_MODEL_GUID_SIGNATURE = 0x474c444d,//----------------------- MDLG
    		FSX_NOVISIBILITY_SIM = 0x534e4956,//=========================== VINS
    		FSX_NOVISIBILITY_SIMCODE = 0x434e4956,//----------------------- VINC
    		FSX_PART_LIST_SIGNATURE = 0x4c524150,//======================== PARL
    		FSX_PART_MODEL_VERT_INDEX = 0x4d495650,//---------------------- PVIM
    		FSX_PART_SHADOW_VERT_INDEX = 0x53495650,//===================== PVIS
    		FSX_PART_SIGNATURE = 0x54524150,//----------------------------- PART
    		FSX_PLATFORM_LIST_SIGNATURE = 0x4c414c50,//==================== PLAL
    		FSX_PLATFORM_SIGNATURE = 0x54414c50,//------------------------- PLAT
    		FSX_RADIUS_SIGNATURE = 0x49444152,//=========================== RADI
    		FSX_REFERENCE_POINT_LIST_SIGNATURE = 0x4c464552,//------------- REFL
    		FSX_REFERENCE_POINT_SIGNATURE = 0x50464552,//================== REFP
    		FSX_SCENE_GRAPH_BONE_REF = 0x52424753,//----------------------- SGBR
    		FSX_SCENE_GRAPH_SIGNATURE = 0x4e454353,//====================== SCEN
    		FSX_SHADOW_MESH = 0x4d414853,//-------------------------------- SHAM
    		FSX_SKIN_SIGNATURE = 0x4e494b53,//============================= SKIN
    		FSX_STATIC_TRANSFORM_SIGNATURE = 0x4e415254,//----------------- TRAN
    		FSX_TANSPACE_SIGNATURE = 0x534e4154,//========================= TANS
    		FSX_TEXTURES_SIGNATURE = 0x54584554,//------------------------- TEXT
    		FSX_VERTEX_BUFFER_SIGNATURE = 0x42524556,//==================== VERB
    		FSX_VERTICES_SIGNATURE = 0x54524556,//------------------------- VERT
    		FSX_VISIBILITY_LINK_SIGNATURE = 0x4c564753,//================== SGVL
    		FSX_VISIBILITY_LIST_SIGNATURE = 0x4c534956,//------------------ VISL
    		FSX_VISIBILITY_SIM = 0x53534956,//============================= VISS
    		FSX_VISIBILITY_SIMCODE = 0x43534956,//------------------------- VISC
    		HEAD_SIGNATURE = 0x484c444d,//================================= MDLH
    		MDL8_SIGNATURE = 0x384c444d,//--------------------------------- MDL8
    		MDL9_SIGNATURE = 0x394c444d,//================================= MDL9
    		MDLX_SIGNATURE = 0x584c444d,//--------------------------------- MDLX
    		RIFF_SIGNATURE = 0x46464952,//================================= RIFF
    		UNKNOWN_SIGNATURE = 0,//--------------------------------------- 
    		VIEW_SIGNATURE = 0x204c4742//================================== BGL 
            };
        }
    }
    
    I'm still working on the tutorial but it's coming slower than I thought. It should really be worth the time, though, as it getting to be really informative. This info should make a great addition to the tut.

    I wish you continued success, and I'll try to post on the forums more in the next few days. :D

    Sean

Share This Page