Basically, this tutorial is about how you, as an exporter (although this tut is also very useful for modellers but not aimed at them) of either weapons, vehicles or staticobjects can assign multiple materials to the same object simply and effectively without having to deal with loads of different individual materials that can get messed up when you assign them or attach other objects with different materials.
For this Tutorial I'm going to be using the French AS 565MB Panther and the Zhi-9 Series. Before you begin this tutorial you should have some experience with exporting for BF2 and understand how BF2 and 3DsMax materials work.
The Advantages of Multi/Sub-Object Materials
Before I go into any detail on them I would like to just go over the advantages of this system in detail so you can see why you should learn how to use these materials as an exporter
- Easy Copying & Switching of Materials between Similar Models
- Multiple Materials with the same Names, Helps Massively for Shader Technique Assignment
- Unlimited Amount of Materials
- Avoiding Cloned Materials
With this system, you can make multiple Multi/Sub-Object Materials, which then you can interchange with ease between different models. This as you will see in this tut can make your life much easier as an exporter, and also allow you to view the "_woodland" textures with just one click of a button, rather than changing endless amounts of materials, then having to change them all back to export again.
2. Multiple Materials with the same Names, Helps Massively for Shader Technique Assignment
As I'll demonstrate in this tutorial, no longer will you need to worry about what material do you assign an "Alpha" or "Alpha_Test" to because for some odd reason the exporter doesn't sometimes like you using the "*||Alpha_Test" and ignores the "Alpha_Test" Shader Technique you've tried to apply to that material when it exports it, as now you can call multiple materials, in the same multi/sub-object material, "Alpha_Test"
3. Unlimited Amount of Materials
This is only really sometimes a problem for people working on a very complex object, or more likely a complex set of objects like a weapon series with loads of different components requiring different textures and shader techniques, its easy to run out of the 24 Material Slots you have available to you in the Max Material Window. As you can see in my "Separating 1st and 3rd Person Models/Textures for Handheld Weapons" tut I almost ran out of material slots for the SA80 series, which I made before I started using this system, and had to get rid of some of the materials I was using to help me make the models like the UV helper mat etc, not to mention it became a total cluster f*ck to find which material you needed and very hard to work with. 4. Avoiding Cloned Materials
By using this method, you have to assign each material with a "Material ID". Now this may seem like a slight con over the old system where you don't need to worry about this, but in the long run it pays off as you can see very clearly all the MatIDs your object uses, and with it, avoid any cloned mats. Cloned Materials are bad because not only are they harder to update, but it also means another draw calls, which means more of the players CPU needs to think about how it needs to draw the object, meaning more the CPU can potentially bottleneck, causing FPS lag even thou the GFX card isn't working flat out, simply because the CPU can't get the data the GPU needs to process in time the player wants it on his screen.
This also means that attaching two objects using the same multi/sub-object material to each other is much faster as it doesn't give you that window, asking to match materials to material ids etc, which is the main cause of cloned materials.
Part 1. Multi/Sub-Object Material Setup
Before I go any further, just to give you some background on what I'm working on and done so far is Haute has already done most of the Export work for these choppers, but hasn't set the materials up as Multi/Sub-Objects as he doesn't really know how to use them yet (one of the main reasons I'm writing this tut is for him ) and I've already setup the Zhi-9 with a Multi-Sub-Object Material, but instead of doing this the speedy way that I will for the Zhi-9WA and the Brazilian Pantera, I'm going to setup the French Panthers Multi/Sub-Object Material from scratch.
It should also be noted that there are a few things I still need to fix up with this export scene which I won't be including in this tut and I also still need to make the lods/cols, although will add a bit later on about how to use multi/sub-object mats for cols once I've done them too later on
Anyways here is the geom1, lod0 of the Panther without rotors and the 7 materials circled in red are the ones it currently uses assigned to different faces in the normal way and the green arrow points to the box I'm going to have my Panther Multi/Sub-Object Material The Materials it currently uses include:
- Fr_Panther_1p||ColorMapGloss
- Fr_Panther_3p||ColorMapGloss
- Fr_Panther_3p||Alpha_Test (although just called "Alpha_Test" currently)
- Glass||Alpha
- French_parts||ColorMapGloss
- French_parts||Alpha (although just called "Alpha" currently)
- Gauges (temp mat that I need to replace later on)
My Material names are all Prefixed with "FrP", Standing for French Panther, keeping it as short as possible since its only a tiny box you get to fill out and lots of other details you need in there, and the prefix ensures its the correct material your working with when your assigning it to faces though MatIDs and not got the wrong Multi/Sub-Object Material on the model
In all, here are all my mats:
- FrP 1p (main 1st person texture sheet)
- FrP 3p (main 3rd person texture sheet)
- FrP 3p Alpha (main 3rd person texture sheet but with an alpha shader technique)
- FrP Glass (Glass texture sheet with alpha shader technique)
- FrP MRB (MRB = "Main Rotor Blur", which is a 2D texture of the rotor blurred up when it spins)
- FrP TRB (TRB = "Trail Rotor Blur", same as the above but for the Tail Rotor)
- Guages (temp mat that I need to replace later on for the 1p gauge textures)
- FrP Parts (The extra model parts the French Panther has from the Z-9 series that are added to a new sheet just for the French Panther)
- FrP Parts Alpha (Same as the above, but with an alpha shader technique)
Now we have named them all we need to make, or copy over our materials into the Sub Object Materials.
First I'm going into how to make them which is basically the same you would normally do, with the only real difference being that your making it within a material
What we are aiming for is the same, "BF2 BundledMesh" material I have selected in this pic below, That is called "Fr_Panther_1p||ColorMapGloss" and for its colour texture has "fr_the_panther_1p_c.dds" and for its normal texture it has "fr_the_panther_1p_b.dds" assigned to it, with no shadow texture. So if we go back to our Multi/Sub-Object Material and click on the Materiel ID 1 box, next to "FrP 1p" which currently says "Material #2176 (Standard)" in it, your then dropped into that sub material, which note in the top right under the material boxes, it gives the MatID (1) and the name we have given to this Mat ID of "FrP 1p"
Since most of our materials are already made up in other slots outside of our multi/sub-object material, we can just copy them into our Multi/Sub-Object Material. There are a few ways this can be done depending on the situation. The first for a normal material slot you need to drag and drop the material you want into the sub slot you want, while having your multi/sub-object material selected. In this case, I want to copy my Fr Panther 3p material into the "FrP 3p", MatID 2 slot like so, which after doing that, asks you if you want to copy the material as an instance or as a copy, in this case, we want to just do a copy as we will delete the old material after we've fully set these up. Note how everything about the material is copied from the materials name, to the type of the material and the texture paths etc, meaning as long as its setup correctly, no more setup is required by us:
Part 2. Material ID Assignment
This might be a bit harder for people to grasp at first from the old system but once you've got the hang of it you won't want to go back as while the initial setup is a bit tiresome, the later rewards are easily worth it
Now anyways, selecting all the parts of your model, I'm just going to do my geom1, lod0 mesh for now, assign your Multi/Sub-Object that you want on to your selecting, in my case, the French Panther MSO Material by hitting the "Assign Material to Section Button" and don't worry, this won't screw up any of your assignments you've done so far (not beyond repair anyways) if your working with an old model you haven't setup with MSO materials from the very start Now in the case of the Panther, it now looks all screwed up, which it is because we haven't yet assigned the Material IDs to the correct Materials on the mesh which we will do next Lets first start with fixing the bodies MatIDs by first selecting it, then going into face selection mode then scrolling down the right hand side in the modifier bar until you come to the "Polygon Properties" section, which then you've got a bit about Materials. This is what we are interested in and at the bottom is a drop down box, which if we click it, we can see all the assigned materials to the model. Now if we select each one in turn from that drop down list, the faces that are assigned to that MatID will be selected and you can easily see what is what:
To sort these out we need to do a little bit of musical chairs so I'm first going to Assign 4 to 9 which opens up 2 to go to 4, which then opens up 1 to go to 2, then finally 3 to 8 and we are all done with the correct MatIDs assigned to the correct faces, for this part anyways In fact we are not quite done yet, for some reason the air filters are assigned to MatID2, where they should be MatID3 since they have little transparent holes in them that only work if the Alpha Material is assigned to them: So I'm going to select these faces, then going to assign them the current MatID (3) by typing in 3 into the "Set ID:" box like so: Then if we change that material to show its normal map, we can see its working separately from the main 3p mat: Now its just a matter of doing the rest of the parts: Now I know these following parts only use one material, the 3rd person body material and because I know this for sure, I can quickly fix the Material IDs for all of them in one go by first selecting all the objects, then applying a "Material" modifier to all these objects, I can set them all to all use the same material, for all of their faces, in this case, Material 2, then just convert all these objects to Editable Poly afterwards to apply these changes fully and bringing them back into their editable state:
Part 3. Transparent Materials
Now this technically has nothing to do with the Multi/Sub-Object Material, you can do this even without using them but since hardly any exporters know about this very useful feature I'm going to include it in this tutorial here.
Basically you can have materials, like glass, that are transparent ingame using the "Alpha" Shader Technique, also transparent in 3DsMax and working perfectly well with the export script.
For this I'm going to use the FrP Glass (MatID 4) Material and make it transparent both in 3DsMax and ingame once its exported using the same material. To do this, simply change your Material from a "BF2 BundledMesh" Material to a normal "Standard" Material, then expanding the maps tab, check Diffuse Color, click the "None" box next to it, select Bitmap from the list at the top, then pick out your transparent texture you want, then click the "Go to Parent" button to go back up to the list of maps you can pick again, check Opacity and click the box next to it, select bitmap again and then select the texture that has the transparency map in it, in this case, the same texture as before, then for Opacity you want to switch the "Mono Channel Output" from RGB Intensity to Alpha like so, so it uses the textures alpha channel for this map:
It is very important that the Shader Technique is still the Materials name keep in mind otherwise when its exported, it wont be exported as a transparent texture. You can also assign a normal map in this manner by putting the "_b.dds" texture into the bump slot under a bitmap. If you try to put a "Normal Bump" material and set that to use the "_b.dds" texture in its place however, like you would for making max render the normal map correctly in a render, the exporter will not recognise that and will not export the path to the normal map. And here it is exported with the above materials in the editor and you can see the normal map working off the spec reflection of the air filter as well as the transparent glass This technique is also very useful for Rotor Blur Textures which means that you won't be constantly seeing a massive black plane above your chopper when they are in view
Part 4. Switching Between Different Multi/Sub-Object Materials
Now one of the big advantages with MSO Materials is the ability to quickly switch texture sets between objects without having to change or re-apply loads of individual textures to do the same thing.
When your working with multiple objects of pretty much the same thing, like I am here with this Zhi-9/Panther Chopper Series, its REALLY important to have all the Material IDs match each other between different Multi/Sub-Object Materials. For example if you compare my Zhi-9 and my French Panther Multi/Sub Object Materials, you can see that both have their 1p textures on MatID 1, 3p on 2, 3p Alpha on 3, Glass on 4, MRB on 5, TRB on 6 and Gauges on 7, with the French Panther having a few extra materials for 8 and 9 for its extra bits:
Here are the Zhi-9's rotors, as you can tell by the Green Rotor Head, its using the Zhi-9 textures, but more imporantly is what you can't see and what is a massive common mistake, like the tail rotor looks excatly the same for both the Zhi-9 and French Panther, which ever texture its using, and the common mistake is for someone to forget to apply the correct material to them, meaning that a load of massive texture sheets are being needlessly loaded ingame, costing the client memory and no one will ever notice (other than perhaps the poor FPS and the CTDs from players running out of memory etc) unless they look deep into the code. Working with MSO Materials while it is still possible to make this mistake, is harder to because the process, once the MSO Materials and MatIDs are all setup, is so simple its hard to make a mistake.
So basically now I'm going to clone the Zhi-9's rotors, showing you my method of doing this by first selecting both of the rotors like so: Then going to Tools>Rename Objects: Uncheck the default "Base Name", check suffix and then in its box put in "--" without the quotes: This then gives us a barrier between the numbering system max likes to do when cloning its objects so if you now clone them instead of it renaming "lod0" to something like "lod05", it will simply be "lod0--01" like so, also don't forget when you do your copy, do them as a copy:
Part 5. Adding/Removing Sub Materials
Now that I need to do the Zhi-9WA, and it pretty much uses all the same textures as the Zhi-9, other than it has one extra "Zhi-9WA Parts" texture with all the extra/modified bits on it like the French Panther has for all its extra parts, I need to add that to the Zhi-9 Multi/Sub-Object Material since there is no point in making a clone of it when they all use the same textures, except one extra one which can be left off the normal Zhi-9 by just not assigning that material ID to any of the faces.
Now since this material only has 7 slots currently and all of them are in use, I need to add another one for the Z-9WA parts material. But before I do that I'll go over all the options of managing your sub materials.
Above all your sub materials you've got 3 buttons. "Set Number", "Add" and "Delete" First going to go into Add, which if you push it, will add another material to the very bottom of the list like so, note the new material 8 at the bottom: Now the Delete button also dose pretty much what it says on the tin, with it deleting w/e material you have selected. I've added another material (9) below 8 but I want to delete 8. To do this you need to select it, by clicking on the sphere icon with the texture plastered over it if it has a texture set to it, and when its selected it will have a little white box around it like so, once selected, hit delete and it will delete it, leaving 9 and the rest of them in this in this case:
Part 6. Cloning Multi/Sub-Object Materials
This is what I would have done to make the French Panthers Multi/Sub-Object Material, with cloning the Zhi-9 one I had already done but I made it from scratch for the purpose of making the previous parts of this tutorials. However now I've done that, for the Brazilian HM-1 Pantera I'm going to clone the French Panther's Multi/Sub-Object Material which should speed things up
To do this, all you need to do is drag your material you want to copy into an empty slot like so, then rename it, and then rename all its MatIDs and then changing all the texture paths that need changing:
Part 7. Viewing _Woodland & other Texture Sets
Once you've setup your main Multi/Sub-Object Materials for your object, you can then easily clone that as per Part 6 to make different texture setups for your object for the purpose of viewing them in 3DsMax easily. For this I'm going to setup the Brazilian Panther with a "_woodland" texture set by cloning its MSO Material and then just changing its textures to use any of the new _woodland textures, which in this case are just for the 3p materials and the Brazilian Parts mat, like so:
Part 8. Using Multi/Sub-Object Mats for Collision Mats
Using Multi/Sub-Object Materials for Collision Materials that you apply to your col mesh uses all the same basic principles you should have now learnt from above, and all you need to do is setup a MSO mat with all the col mats you want in it, apply it to your col mesh and setup all your materials though MatIDs, like so: