Small guide to getting your aircraft ingame - PeterD - 12.02.2009
Since the tools available have reached a stage in which you can pretty much add new planes from scratch into the game directly imported from 3ds Max, I thought I'd share what I've learned in the past few days. This little guide will cover aircraft replacement only, no new slot how-to as I have not investigated it much and it is beyond 3d development anyway.
Step 1: Get the tools
Tools you absolutely need are
- A 3d model (.msh) exporter. I will recommend FatDuck's script (The link is inoperative) since it is cake to use and I had issues with the other tools available (Maraz's 3ds Max plugin won't work in 3ds max 2009 and Dr Jones extractor (The link is inoperative), while it does work, will be most useful for the hierarchy structure only). More info on Fatduck' script here (The link is inoperative).
- Dr Jones' Mesh Converter (The link is inoperative). Without this your other option is using Wordpad to check the hier.him file and guess the hierarchy, so not an option really. Check its development thread to see what changes were made etc.
- MatrixParams by Kumpel (The link is inoperative). Absolutely MUST-HAVE. If the program asks for a missing DLL, grab the DLL from dll-files.com and install it in system32. Then use regsvr32.exe dllfilename.DLL. People using 64bit OS, the dll goes into WOW64 directory. Vista/Win7 users, you have to invoke the console with admin privileges (right click on console icon, run as administrator). Google anything you didn't understand . This tool will be necessary to give any object its correct rotation (scaling aswell although it should not be needed)
- SFS Extractor by QTim. Quite obvious, you'll need to extract the original aircraft data somewhere in order to take a look inside.
- 3ds MAX. I'm using 2009 trial 64bit and Windows 7 beta 64bit and everything listed above works well. The trial is FREE for 30 days.
- RAF_Magpie's guide to HIER.HIM (The link is inoperative). Absolutely MUST-READ. I'm skipping hier.him explanations because really that doc has all the info you need.
- 3DSMAX IL-2 3D Modelling Tutorials. Also a must read, even if not all the concepts apply
So with all those tools, you are ready to start doing things. Pick an aircraft you want to replace, extract it with SFS Extractor and create a folder in your main MODS folder called MyMod
File structure should be: IL2
folder/MODS/MyMod/3do/Plane//
Step 2: painting your model correctly
For this you will use DrJones tool and open the .msh file (CF_D0.msh for example). Write down the materials' names, for example:
- [Materials]
- Glass2
Gloss1D0o
Matt1D0o
Overlay1
Overlay4
Overlay7
In bold letters is the main material. If you are using a MSO (Multi-Sub object) material, it'd be a good idea to give it ID 1 to save some time. Read the modelling in 3dsmax tutorial to get the material parameters right. If you are not using MSO materials, just call your material Gloss1D0o. At some point though it'll be converted to MSO if you have glass and metal in the same object.
Step 3: preparing your 3d model to be exported to .MSH parts
The aircraft is made of parts, and all the parts are assembled in the hier.him file. Using Dr_Jones' tool to read the hier.him file you'll instantly see which part is the 'root', ie: the main fuselage part. That's a good place to start, although it may be quite tedious at first. Assuming the aircraft you want to replace has a similar length and wingspan than the aircraft you are making, this is how you do it:
- Make sure your 3d model has the correct scale. In MAX (2009)generic units, 1 unit = 1 meter in IL2. This is somewhat an assumption, but not baseless. The unit conversion is 1:1 (1 unit in max = 1 unit in IL2, this is a FACT) and the F-86 I imported ingame had roughly 10.8 units (length) which was very close to the P-80 model it replaced, and also matches the P-80 length in meters.
- Make sure your 3d model is looking south (when looking at it from the TOP viewport). IE: nose should be pointing to -y axis.
- Make sure the 3d model's pivot is as close as possible to the aircraft center of gravity. Once it is, align your object to [x=0,y=0,z=0] (to continue with RAF_Magpie's nomenclature, xyz = position, XYZ = rotation). This is not a must, but it simplifies a lot the rest of the process.
- Make sure the 3d model's pivot is correctly alligned to the world axes. If it isn't, use reset transform and collapse the mesh.
- Write down the parts you will need for the piece you are going to export. For example, if the main fuselage part is called CF_D0 (look at it in DR_Jones' tool) it will have:
- LOD children. Different Levels Of Detail for D0 (D0=undamaged mesh)
- Shadow children. Different shadows for each LOD (for D0= undamaged mesh)
- Collision children. Different collision parts for D0 such as xcf or xxmgun1, etc.
- Hooks. Different hooks as _MGUN01, _ClipXX, etc.
You NEED to have all those pieces made before you attempt to export anything. Every piece must match the name of the original piece.
EXCEPTIONS: Since I've only used FatDuck's script, I will use his naming rules. Here's an example:
- My fuselage is called CF_D0. It has 3 LOD meshes and 3 shadow meshes. In Dr_Jones' exporter the LODS are called:
- L1 CF_D0
- L2 CF_D0
- L3 CF_D0
The shadow meshes are called:- CF_D0 SH
- L1 CF_D0 SH
- L2 CF_D0 SH
This is how you have to name it in 3dsmax using FatDuck's exporter:- LODs:
- LOD1CF_D0
- LOD2CF_D0
- LOD3CF_D0
Shadows:- SHWCF_D0
- SHWLOD1CF_D0
- SHWLOD2CF_D0
Hooks are treated using dummy objects. IE:
_Clip5 should be a dummy called
_Clip5
Once all the subobjects (LODs, shadows, collision, hooks) for the part you want to export (ie: CF_D0) are named correctly, select all of them and link them to CF_D0 (main fuselage part, if that's the part you are tring to export). The obvious tip is: link all the children to the parent piece; CF_D0 has all those children, so they all need to be linked. If you are going to export Canopy1 then link only Canopy1 subobjects to Canopy1 mesh!. I hope it's clear.
You may wonder why there's no mention of D1, D2, D3 objects, the reason is that those are separate 3d objects, ie: they are not "embedded" inside the _D0 part. Take a look at the mod folder and check how many different 3d parts (.msh files) there are. Each .msh file will have its LODs, shadow, collision and hooks inside (some may not). So basically, for each D1, D2, Dn and .msh in general, you simply have to repeat this process.
So assuming you did everything right and the objects are properly linked and correctly named, the mesh is ready to be exported.
This is a quick guide to naming conversion:
- Lod models. Prefix LODn (where n=number)
Shadow models: Prefix SHW
Shadow models on LOD models: SHWLODn
Hooks: prefix "_" (just give it the same name as DrJones' tool shows, ie: _Clip32 is a dummy should be called _Clip32 in MAX)
Collision objects: "x" or "xx"again just give it the same name: xNAMEHERE or xxNAMEHERE depending on what DrJones' tool shows.
Step 4: Exporting the model (using FatDuck's script)
Easiest part by far. FatDuck's script needs to be installed in 3dmaxdir/scripts/startup/
+ Buggy Buggy IL2 Exporter V2.52a.ms
+ createSubGroupGameMesh.mse
The bitmap goes into 3dsmaxdir/scripts/
Go to Utilities -> Maxscript to launch it or add your own button in the toolbar.
Click on EXPORT IL2 MESH (.txt) and select the EDITABLE MESH you want to export.
You'll see the listener (bottom left) is showing some random numbers. Once it reads ";eof" it means it's done. Just open the listener and save as .msh somewhere, in the desktop for example.
If you got an error doing the process, it means you did something wrong. Check FatDuck's thread on the script if you need more info.
If you didn't get an error, all you have to do is replace your new .msh file with the one in MyMod/3do/Plane/. Throw in a skin in your il2 skins folder to check how it looks if you want.
If you did everything right, the scale should be ok and the placement should be more or less correct if you just exported CF_D0 (or the aircraft's main fuselage part AKA the root model).
For any other part you try to export, you'll get strange placements and the piece will posibly be rotated. Enter hier.him and Kumpel's matrix params.
Step 5: Fixing the rotation of your newly imported piece
If your model is centered in [0,0,0], less work to do. Each object that is a child of the main root part has a rotation value, a scaling value and an offset value. Read RAF_Magpie's guide if you don't know what I mean. If your aircraft was centered in 0,0,0 just measure the distance in x,y,z from your piece's pivot to [0,0,0]. As the unit conversion is 1:1, if your WingLIn mesh (wing root) is at 0.685 units in x , -1.1246 in y and -0.267 units in z from [0,0,0], the offset you have to put into the hier.him section of that piece is exactly that: 0.685 -1.1246 -0.267. If your object should not have any rotation nor scaling, just use Kumpel's tool, it should output 1 0 0 0 1 0 0 0 1. Use wordpad to edit the hier.him file (I use notepad but that's just me)
For surface controls, IMO, the best way to get them ingame and have them working at the first try is to:- Make sure the rotating pivot is set according to 3dsmax modelling tutorial. If your pivot is not correctly set, it's your fault and your fault only!
- Clone the piece in question you want to export in 3dsmax. Once it's cloned, select the piece you want to export and align it to the main fuselage part. Make sure you are using "align orientation" for the 3 axes, ie: the whole piece should be rotated once it's alligned, and should be centered in [0,0,0].
- Measure the distance from [0,0,0] to the cloned object for each axis; for this you can use your prefered method, I personally use the Tapes. 3 tapes, one for each axis. Write down the distances (that's your offset, ie the last 3 numbers in the hier.him section of rotation/scaling/offset). Now select the world rotation axis and right click on the rotate icon with the cloned object selected. It should have 3 numbers in XYZ. Put the negatives of those in Kumpel's matrix tool, click calculate, and voila, there you have your 9 magic numbers.
- Replace in hier.him and you are good to go.
Questions about this guide (not about modelling in 3ds max) are welcome. Hope it'll be useful!
- RAF_Magpie - 12.02.2009
Moved to correct location. Good idea for putting up a guide.
- asheshouse - 12.02.2009
Excellent.
I was hoping somebody would post something like this.
- PeterD - 12.02.2009
RAF_Magpie Wrote:Moved to correct location. Good idea for putting up a guide.
Woops, my bad, I totally forgot about this section.
- luther01 - 15.04.2009
Thanks PeterD, very helpful guide (well done with the Sabre)