The info in this tutorial stretches across the RDN wiki, several forums and the readme file, so it is by no means soley my work. Actually I would say it is Totmacher's work given the splendid amount of time and info he has given us.
point of information: I really do suggest setting up a specific 'mod' folder with your own unique name. I made the mistake of assuming the 'My_Mod' folders provided are where we were suppose to place our modded files. It is just an example and the first thing the 'readme' file tells you to do is, make your own mod files. So when you see any instance of 'My_Mod' think of your folder name instead. Consider this; if you want to share your mod with someone, It will have to have it's own specific name. Furthermore, are you only going to do one mod?
References: It would be wise to thoroughly read these constantly, especially forums where Totmacher posts responses. The readme file located in the modtools folder. Do what it says, ‘Read Me’!
Tools: Here are some useful items.
First off you need to have the folder structure in place to even accomplish this task. Here is Totmacher’s point;
“Yes, all of the projects are folder based. At first, it's very finicky, but it will become second nature before too long. If you are using My_Mod as test ground (I would recommend following the README to setup a different folder structure) then put your sample models under (assuming a default install location): "C:\Program Files\THQ\Dawn of War\ModTools\DataSrc\My_Mod\ART\EBPs\". You can add further folders to organize your models by race, environment, etc.. Take a peek at what we did for the 4 races in My_Mod.”
I have found about 80% of my problems come from the file sturcture not being setup properly. After having referenced the folder structure of the files provided by Relic and following them exactly, here is what I have.
The previously mentioned folders should already exist, the following folders will need to be made by you, based on your needs.
So without the explanations the folder structure looks like this for the mesh:
point of information: the model must be saved with the name ref.max. The exporter, or at least when I used it, did not recognize anything until I made this change.
And for the textures:
point of information: the texture, safely, should only be 512x512. This is not to say a larger texture can not be used, just expect performance hits from larger textures. This was from information given by Totmacher on the relicnews forums.
There are a lot of good tutorials out there for modeling in 3DS Max. Check out 3DBuzz.com, they have interactive video tutorials for all the major 3D programs. This portion is going to be brief only hitting the major points of setting up your model for export.
point of information: You can actually skip turning your mesh to 3 sided polygons. As long as the mesh is set with an 'Editable Mesh' modifier, it should export. I will leave these instructions here for posterity.
If you have a group of items, like 5 trees, which are going to be in this one model ref.max file, I suggest you attach them together. You will want to link them together first. Linking is like a fancy gouping, allowing you to work with several meshes while keeping their place in respect to all the other meshes. With Linking you select all but one mesh, press the link button, then drag from one of the selected items to the non-selected item. The non-selected item should flash, indicated everything is linked. For attaching, select your item, usually I use the one I didn't select in the linking process, and use the 'Edit Mesh' Modifier. This item will stay selected.
You will see that instead of having seperately selectable items, all are selectable. They are now effectively one mesh. Finally collapse the modifier stack. This probably won't matter but it's good workflow. As I mentioned previously, the one item you attached everything to is going to be where the center pivot point for the ME is located. You will want to think about how your model will work with other models and line up with them. Adjust this appropriately. There are two ways of doing this:
I assume you know how to model and texture, if not, find a different tutorial to help you with that. Okay, so you’ve got your Static model made? Ah for heavens sakes just make a box, apply the turn to poly modifier limiting it to 3 sides. You’ve textured it yes? Make sure you are using a tga file. You’ve saved the model and texture in the appropriate folders like I mentioned above? If this isn't good enough download the model provided in the tools above. Ok take a break, smoke, drink, whatever…
Before you try exporting, I know you haven’t tried that yet, I recommend re-mapping the textures. It only takes a few seconds and stops you from having to re-export your model in case the texture doesn't show up correctly. Totmacher does stipulate this process was only for the models provided by Relic in the mod tools. Here is the direction given by the ‘readme’ file which I know you read.
As 3DS MAX saves full path names to all referenced textures and your installation folder will be different that our directory structure, you will have to re-map texture paths to have the models load properly on your machine.
To re-map texture paths perform the following steps for each model:
Now you are set to export the mesh for the OE (Object Editor Tool). This is from Totmacher directly in one of the forum posts. I’ve just bulleted it for easier Reference.
The Exporter also created files in your mod's folder for the WHM files used by the game's engine.
point of information: You may have to press the Refresh button to get the name to show up in the exporter. Also a good point from Totmacher is, “DO NOT export using File->Export — our models are distributed as a series of files that get merged into a single file. Go to the Utilities Panel, Select MAX Script, and then use the Warhammer Model Export script.”
Very important point of information: The exported SGM model was not saved in the datasrc folder directory, you will need to back out and check the datageneric folder directory to find your SGM file. See the image below!
Fallen asleep yet? You are almost done, if all you are doing is a static mesh. This final bit of information will get your static mesh model into the ME and into the game. I've found, like the other tools, the AE is very particular about it's file system. Following the 'readme' once again, you will have needed to extract several SGA archives into your mod's folder.
point of information: The readme implies extracting the archives to the 'my_mod' folder; while correct, it is a little misleading. The archives should be extracted to ...my_mod\data. This one point took me over 4 hours to resolve, fortunately my brain had stopped hurting before that. Once you have copied the my_mod.attrib file, renamed and edited it like the 'readme' says, it becomes obvious this was a slight error. I would also suggest unpacking the W40k_Whm-High.sga (or Medium or Low, which ever you use for your settings) archive to your mod as well. Before doing this, when I ran my mod, the built troops only appeared as purple boxes saying 'bad model'. Quite funny considering I played this way with the boxes running around the screen.
Now before going further do this: Navigate to the SGM file which you just created from the Max Script. Remember it will be in the datageneric folder. Copy it and paste it into the corresponding folder in your mod's directory. So if your SGM file were here: ...dawnofwar\modtools\datasrc\my_mod\art\ebps\environments\staticmeshes\rock1.SGM, copy it here: ...dawnofwar\my_mod\data\art\ebps\environments\statimeshes\rock1.SGM. Why do this you ask? Well, since the attribute file will be pointing to your mod, it isn't going to find the SGM file to finish out the rest of this tutorial. Even if you had datageneric and datasrc folders in your mod's root, you would still have to copy and paste it to the regular data folder. This may be completely wrong but it has worked flawlessly for me. This is another reason to have a nicely organized folder structure, so you are not moving multitudes of files individually. I've enabled a strike through on this paragraph as It has been affirmed as unneccessary. Basically you are just creating the lua files you need for your model in the AE and these will point to the WHM files of your models. However, it is still important to keep the files structure the same for the lua's and the whm's!
Here is Totmacher's explanation on how to use the AE;
When you open a file in the AE — this is just a little text file that points the tool at the game attribute file folder to load the files from. You read the readme right? (This was directed at me because of my poor assumption at the beginning)
Here is Totmacher's reason why using the AE is necessary;
As for the ME: It relies on a model being setup in the Attribute Editor for basic info like the path finding size, etc.
"So, for example if you had My_Mod\Data\Art\EBPs\Races\Tyranids\Structures\Spore_Tower.sgm, then type Races\Tyranids\Structures\Spore_Tower"; I bulleted Totmacher's last statement here to make it easier to read and funny thing is, it really is that simple. This is what you should have ended up with:
Once all of this is done you should be able to open the ME, select placeable objects and navigate to your new model to place it in your map. If you are doing animated meshes, you've got some work to do yet.
point of information: If you are making your map and saving it in your mod's folder everything will be OK. If you are making your map in the w40k folder you will not find your meshes in the ME! This is another stumbling block I had to figure out. The only speculation I have is: 'Will a map, containing my meshes, be usable by someone without my mod?" I have tested this, the answer is No! The work around, is to basically provide your lua and whm files to the person wanting to use them in their maps. Copy the (...Data/Attrib/ebps/environment/staticmeshes folder) and the (...Data_Whm/High/art/ebps/staticmeshes) folder to their mod's root folder. Viola! They now have the static meshes you created! (Now some smart fellow is going to say,"Rymafyr, why does the Data folder have an environment folder and Data_Whm folder does not"? I really don't know why I did this or how but it's working and I'm gonna leave it this way. I suspect the exporter places the WHM files in the ebps
folder by default.)
If all you are creating is a static mesh item to use in a map you will not need this step. According to Totmacher, «...once you have a model exported from MAX, you will only need to load it into the OE if you have animations that need to be hooked up via motions/actions. Otherwise (for static level dressing) you can skip this step completely». However if you want to see if the model will be visible in the game, this would be the quickest way to see the result.
Now everything should have loaded fine; what's that, you don’t see anything in the center viewport? The camera controls for this view port are the same as for Dawn of War. Zoom out and you should see your model. If everything went well it should also be textured. You can easily lose your model scrolling around so be careful, usually I just reload the file when that happens.
Now, as I have said, I have no idea what to do with the OE at this point but one thing is for certain, the OE created the EBP file when you opened the SGM file. For all I know you can close the OE at this point as I haven’t found any use for it with static meshes yet.
This process is completely unneccessary for most casual modders and static meshes. Totmacher states, Assuming you have exported the model successfully using the exporter script, you will not need to run the burner tool on the SGM or the EBP. This tool was included for advanced modders. For example, lets say you export all of your models out of max, and then change parameters in the _default.burn file. Instead of re-exporting everything from max again, you can just reburn the data with the burner tools to get the data optimized against the new values. Per the Readme:
This is a command line tool to take datageneric files and “burn” them (i.e. optimize them for the game engine) and output them to the appropriate folders.
Specifically, this tool works with:
Sample usage of this tool is in the "Burn_SGMs.bat" file.
What I did was open that "Burn_SGMs.bat" file and edit the line pointing to the wildcard SGM file and actually path it directly to the file I wanted to burn. If you have several files to burn you will want to wild card the folder instead, making the highlighted line below look like this: (datatgeneric\my_mod\art\ebps\environment\staticmesh\*.SGM). Now at this point so much was going on in my computer, a program had not release its hold on the SGM file so when I ran the batch file I got an error. I rebooted my machine and all was well.
:Begin @echo off set BURNLOGFILE=Burn.log.txt echo Burning files, please wait... BurnerTool.exe –r !!datageneric\my_mod\art\ebps\environment\staticmesh\itemwhatever.SGM!! -lf=%BURNLOGFILE% if errorlevel 1 goto BurnError goto Success :BurnError echo Failed to burn files. echo The logfile "%BURNLOGFILE%" may contain information to help you resolve the problem. goto End :Success echo Files burned successfully. del %BURNLOGFILE% goto End :End pause
This will create a whole new series of files and directories, if successful, in the My_Mod folder under the root Dawn of War directory. When you look through these files you will see WHM and WHE files created. If you were to unpack any of the …W40k\W40kData-*.sga compressed files you would see the same structure and model formats.