Original Topic: Creating Your First Static In Max / Gmax - Official BF Editor Forums
'mschoeldgen[Xww2 wrote:']
by mschoeldgen from eXperience World War II
I extracted this quick and dirty tutorial from a post i made a few months ago. It should give you at least hints on how to setup your material manager and manage a successful export of your first static object to BF2/2142:
Lets create a simple box . Prepare a folder in /objects/staticobjects/myBox and put a texture in there, preferably some wood or metal. Lets do this all in your mod.
Here i have provided a small DDS wood texture in case you don't have one handy:
http://www.schoeldgen.de/bf1942/tutorials/myBox.dds
I assume you have setup your BF2 Tools for Max according to this thread :
Bf2 Tools For 3ds Max - Setup - Official BF Editor Forums
Launch Max and open the Material Manager and make one material using the BF2Staticmesh2 shader by pressing the 'Standard' button and selecting the 'BF2StaticMesh2' entry from the following list. Press 'Base' in the first line of the new Material and point the Base texture slot to the above mentioned texture. Leave the Detail slot empty for now , it can later be filled at will, but you'll need a second UVMap for it. Here's a view of the Material Manager with the setup for this simple box:
Note that the scale for Max models is metric. Either use the metric setup and use 0.1 for the units or use GenericUnits, where 10 units make 1 meter ingame.
Create a box with the Max primitives and assign the material to it (leave the box selected and from within the Material manager press 'assign material to selection' ) . Convert the box to 'Editable Mesh' and give all faces the Material ID 1. Now all faces should have the texture on it.
Leave the box selected and run the 'Static/Building' wizard from the BF2 utilities.
Your box doesn't have a collisionmesh yet, we need to add it. Select the '__Anchor' object (its a dummy helper) and clone it with max' standard function, renaming the clone to 'nonvis_' .
Now clone your original box , rename it to 'col0' and parent it under the nonvis_ dummy. ( This is done with the 'select and Link' button in max, more about that in this thread :
3ds/gmax Hierarchy Collection (56k Warning) - Official BF Editor Forums )
Now clone the 'col0' box to a 'col1' and a 'col2' box, all are parented under the same 'nonvis_' dummy. Here's a view using the Select window of the complete hierachy:
You're now ready to export this simple model. You should export it into your mod into the same folder you created above : Enter '/staticobjects/' (without the quotes ) into the export path. A new folder 'myBox' will be created inside /objects/staticobjects and it will be called after your object. It contains a subfolder /meshes with the staticmesh file, a samples file for lightmapping with the editor and a collisionmesh.
Its now ready to be examined in the BF2 Editor. Your first task should be to map materials to it. Open the box in object editor by browsing the resource window and doubleclicking the box. Now find the 'Default' tweaker where you find an entry called 'Map Materials' . Open it and assign a wood material to your box. Save the object.
Place it on a test map , pack your mod and go ingame. There you go
Hope this helps some of you'Part 2' wrote:Creating a static Part II:
In this follow-up we'll add a Detail channel to our box from Part I of this tutorial. A Detail channel has higher resolution and we can add a normal map to our object. For this purpose i've provided 2 new textures:
http://www.schoeldgen.de/bf1942/tutorials/dirty_white_c.dds which is a small whitish texture and
http://www.schoeldgen.de/bf1942/tutorials/myBox_b.dds which is the texture for the NDetail slot, our 'bump/normal' map.
The Detail channel also provides for glossiness in its alpha channel. I've updated the texture from Part I for an alpha channel and you should probably download the new texture here:
http://www.schoeldgen.de/bf1942/tutorials/myBox.dds
Download all textures and put them in the folder of our object. Optionally you could place all textures into a subfolder or a dedicated /textures folder for all your staticobjects. The exact location really doesn't matter much as long as it is within the /objects folder.
Ok, after making sure of the location of the textures lets start by loading the 'myBox' scene into Max and open the Material Manager. What we want to do now is to move our wooden texture to the detail channel and add a new color texture, the 'dirty_white_c.dds' you just downloaded. Color and Detail channel are multiplied so a white color texture will not affect the Detail texture very much but only adds a little dirt to it. You could also use the dedicated 'dirt' channel but for a simple object its really not necessary. DICE mostly used the COlor channel for basic coloring and the Detail channel for the structure. If you take a closer look at existing textures you'll often find black & white detail textures to blend into the colors imposed by the Base channel.
Press 'Base' and browse to the 'dirty_white_c.dds' texture. Note how the box in the viewport turns all white when we replace the original texture. Now press the 'Detail' button and browse to the 'myBox.dds' texture. Hmm, after assigning it nothing in the viewport has changed ? Thats because the 'BF2StaticMesh2' shader can only display one map channel at a time. To switch to anther channel you can press the little number on the right of the texture in Material Manager. Initially it is set to display channel 1 but you can press the little '2' in the Detail texture row to switch over to display the detail channel. Before closing the Material Manager lets quickly add our bump texture by pressing the 'NDetail' button and assigning 'myBox_b.dds' to this texture slot. Note the little '2' in the row - this means that the NDetail texture will also map on channel 2 so both 'detail' and 'normal-detail' will use channel 2.
If you tried to switch to channel 2 already you will have noticed that the box turns into an ugly brown or something, the wood texture seems to have gone. But don't worry thats only because our object has no uvmap on channel 2 yet. Thats what the material manager should look like after assigning all our textures:
Close the material manager with channel 2 selected and select your box mesh if not done already. Add a new 'UVW Map' modifier, switch it to 'Box' and look for the 'Map channel' setting in its rollout. Enter a '2' into the channel and notice how the box gets its structure again.
Collapse the UVW Map modifier on the mesh.
Everything looks good, lets export the box once again. We don't need to change anything in the code but we can use the editor to look at our improved box. Note how some depth is added by using the detail channel with its bump map.
Things you can try:
* Change the tint of the color texture and notice how it affects the overall toning of the object.
* use other textures for the detail channel, like brickstones or a metal surface. Try to adjust your color texture so that the object looks natural.