RDNWiki: DoWMaxExport ...

RDN Wiki Home | Page Index | Recent Changes | Recently Commented | Users | Registration | Login:  Password:  


Getting a Static Mesh Model into Dawn of War

by Rymafyr

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.

File Structure

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.

Setting Up Your Model for Export

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.

  1. Select all your meshes
  2. Use the 'Turn to Poly' modifier
  3. In the Parameters for that modifier:
    1. check the box which says 'Limit Polygon Size'
    2. set the drop down box to 3

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.

  1. With this item selected press the 'Attach' button in the parameters window
  2. Click the 'Attach List' button, you will see a dialog window open.
  3. Choose all the remaining items by pressing the 'All' button, then press the 'Attach' button.

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:

  1. Under the 'Hierarchy Tab' select 'Pivot', then 'Affect Pivot Only' and 'Center to Object'.
  2. Linking before Attaching the meshes to one another avoids the necessity of realigning the pivot point in the first example, if you set up the link on the mesh you wanted centered.

Exporting Your Mesh

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:

  1. Load the model’s reference/ref.max file
  2. Select the utilities panel.
  3. Click the “More…” button
  4. Select bitmap/photometric path editor
  5. Click OK 

  1. In the resulting “Path Editor” rollup panel click “Edit Resources…”
  2. Select the textures to remap, and then click the “…” button at the bottom of the dialog, making sure the path is pointing to your texture.
  3. Click “Set Path” and you are finished!

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.

  1. Load a MAX file for the model you want.
  2. Then open the Warhammer exporting script in the Utilities->Max Script panel. This will popup another dialog in the utilities panel with the name of the model, a “force export all” check box (not sure of the exact name of the top of my head), a refresh button, and an export button.
  3. Click the export button and sit back – it can take a while to export your model as your loading in loads of max files, and then burning 3 optimized models as well as texture maps and team color patterns.”

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!

Attribute Editor

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)

  1. Read the readme, specifically for the section on the extracting the game data for the AE.
  2. Once you have done this (in your Mod Folder, right) copy and edit the my_mod.attrib file to point to your mod. Then load that file. After a “little bit” the tool will be populated with all of the game attribute files. Then you can access the section I mentioned”, by Totmacher.

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”.

Adding a Static Mesh to the Game

  1. Open the Attribute Editor, select the “entity_blueprint” section and add a new blueprint for your model.
  2. Then, in the “entity_blueprint_ext” section, in the right hand window, select the animator field and type in the name of your model (excluding the Data\Art\EBPs bit).

"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.)

Importing the Model into the OE

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.

  1. Go to File, and select New 
  2. In the Dialog box navigate to where the SGM file was created probably: …\dawnofwar\modtools\datageneric\my_mod\art\ebps\environments\staticmesh\itemwhatever.SGM *Note the SGM file inherited the folder name from the datasrc directory, instead of being called ref.SGM*
  3. Open the SGM file.

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.

Burning the SGM File

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:

Burner Tool
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.

  1. So edit the Burn_SGMs.bat file

@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

echo Failed to burn files.
echo The logfile "%BURNLOGFILE%" may contain information to help you resolve the problem.
goto End

echo Files burned successfully.


goto End

  1. Edit the line with the path to point to your SGM file

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.




End of Page

Referring pages: DOWTutorials

There are 11 files on this page. [Display files/form]
There is no comment on this page. [Display comments/form]