Jimiz Posted October 15, 2005 Report Share Posted October 15, 2005 This is tutorial for importing a weapon from Gmax to BF2. Parrot sketch is not included. Ok, a few words before I begin. I am by no means an expert and that will show. Yet, I am willing to risk that as I very strongly oppose hoarding knowledge and as it seems that many have problems with this stuff, so I thought to share what little knowledge I've gained on the area. I hope that atleast someone will find the information provided here helpful. I am sure that there are more efficent and delicate ways of achieving all this and I want you to know that during the course of this tutorial I'm going to just smash everything in place with bruteness that will probably leave the more seasoned modellers gasping in horror due my lack of finesse. But it works, and I'm content And still before we begin I want to emphasize that I don't feel that I'm the architecht here, I'm merely piecing together what others have done before me and therefore I wish to acknowledge the huge groundwork laid out by all those before me. Among many others, I want to especially thank the creators of this knife tutorial and [bFP]Kev for his hierarchy tips. For this tutorial, you will need the following programs: -Retail Battlefield 2 -BF2Editor -Gmax 1.2 -Gmax tools for BF2 -Irfanview The aim is to achieve all this with using free programs only, as personally I really can't afford to spend several hundreds of dollars in software that I'd use only as a hobby. **** Edit: I knew I had forgotten something; alas! the example model, grab it here BF2tut2.rar (38kb) This should make your first atempts on exporting easier as you can truly follow the tutorial step-by-step **** Chapter I - The groundwork -This tutorial doesn't actually create a new weapon from scratch, more accurately spoken, it replaces an old one. Because of this, it's important to think a little ahead: if you replace a bullup type a weapon (like the L85A1) with a weapon that's got the "classic" clip placement, animations will look a bit dodgy. This is because this particular tutorial will have nothing to do with actual weapon animations, but depends on the vanilla ones. -You naturally need a model and some textures for it. I've created a model for this tutorial that uses the L85's textures so for that, I went to /battlefield 2/mods/BF2/objects_client.zip -> /weapons/handheld/usrif_sa80 and extracted the whole folder including sounds. Make sure all the parts of the mesh are Editable meshes. -Then I opened up the usrif_sa80_c.dds with irfanview and saved the file as .tga and did my uvmapping stuff in gmax with that. Chapter II - Creating hierarchy -Open up Gmax with the BF2 tools -Now we need to start creating the hierarchy, first select the main body of the weapon and name it mesh1_Fp__GenericFireArm, select your clip and name it 1, select your trigger and name it 2, select your flap/bolt and name it 3. If your gun has got a fire selector, name it 4. At this point you're scene shouldn't have anything else, if there is, just attach them to the main mesh. Pressing "Select by name" at this point should produce results astonishingly like this: -Now, select 1, 2 and 3 and then click on "Select and link", then click "Select by name", select mesh1_Fp__GenericFireArm and click Link. Something a little like this: -Congratulations, you've now created your very first hierarchy! REMEMBER TO UNCHECK "Select and link" at this point! -If you click "Select by name" again and then check the "Display subtree" option, you should now see 1,2 and 3 below mesh1_Fp__GenericFireArm a little bit indented. That means that they are now children of the main mesh. -Now, create a Dummy and name it root_bundledMesh_WEAPONNAME. In my case that is root_bundledMesh_usrif_sa80 as my weapon is going to replace the L85. -Create two more dummies and name them geom0_1p and lod0 -Select geom0_1p, click "Select and link" -> "Select by name" -> root_bundledMesh_usrif_sa80 -> "Link" thus making it a child of the root_bundledMesh -Now select lod0 and make it a child of geom0_1p -Select mesh1_Fp__GenericFireArm and make it a child of lod0 After these steps, you're hierarchy should look like this: -Ok, now's the time for a little magic trick. -Select geom0_1p then on the top bar go to "BF2 -> BF 2 utilities" then on the left menu choose "Clone /w childs (copy)" and hit "Run util" -Now go to "Select by name" again. The hierarchy might look a bit messy right now, but don't get afraid, keep your head cool and select either one of the geom0_1p (there should be two of them now) entries and rename it to geom1_3p. Tada! Now your hierarchy should not look much dissimliar to this: -So, on we go! Time to create another Dummy, call it lod1 and make it a child of geom1_3p -Select either one of the mesh1_Fp__GenericFireArm meshes, use the BF2 utilities again Clone /w childs (Copy) then again, select the clone and make it a child of lod1 -Under lod1, attach 1,2 and 3 to the mesh1_Fp__GenericFireArm, making them a single mesh. -Hide the other two meshes, leaving only the one under lod1 visible. Now do your best to crop it down as this is the mesh that is visible from longer ranges so there's no point in keeping it very high poly. A good tool here is "Optimize", don't be shy with the settings, it's enough if you retain just the general shape and colour. -When you're happy with the results, unhide all the rest. Hierachy should look like this now: -On we go! Now, create a dummy, again and name it lod1 again, then make it a child of geom0_1p -Create a plane and name it something like Scope, then make it a child of the lod1 you just created. (I've intentionally left this like this as I'm not too good with scopes myself atm :oops: Don't worry, you can come back to this later.) -Now our hierarchy is done! -Your hierachy should look exactly like this: Chapter III - The actual export -So, now we've got hierarchy stuff done so we're ready for the export -First we need to get the paths right. Unless someone hasn't gotten it yet, you need a mod, just a blank MyMod will do just fine. -Goto "BF2 -> BF2 exporter" and click "Run setup" and set the paths to your satisfaction, for reference, here's my setup: -When you hit export, a file called "usrif_sa80.bundledmesh will be created in /battlefield 2/mods/YourMod/Objects/Weapons/Handheld/usrif_sa80/meshes -Then just hit export and open up the BF2editor. Go to animation editor, on the left-hand drop-down menu select BF2 -> Objects -> Weapons -> Handheld -> Usrif_sa80" and then drag and drop the entry over the soldier model (your mod has to have all parent mod content loaded for this to work. -It is very likely that at this point your model will look a bit like mine; oversized, ill-oriented and untextured. But not to worry, that is to be expected. -Okeydokey, now you've got your gun in the editor. In theory you could now just pack up the mod and launch it and the gun would be there, but taken into consideration it's current state, that would be just utterly pointless, don't you agree? Good, then we'll move on to The-Most-Annoying-Thing-You've-Ever-Done. Chapter IV - Desperation -So we've estabilished that the model is quite severely fracked up at the moment. Obviously we have to do something about it and in my personal opinion, the steps that follow are the most infuriating thing about the whole process and it is highly probable that the following manouvers will leave you seething in fury and smashing small household items around you. That's the case with me atleast, though I bet you a wooden nickle that there are much more effiecent ways of achieving this but due to my own inexperience, I am unable to present them here. Anyhow after this highly encouragin prologue, into the fire we go! -Still in BF2editor, go to the Object editor and load your gun there with the familiar drag 'n drop manouver. You can now probably see that the sub-objects are in the wrong place and that everything is quite messed up. Leave the editor there and go back to gmax -Now we need to re-link the sub-objects ie. triggers, flaps and magazines to the lod0's and then select all three meshes and their sub-objects like this: -Then you need to Step 1. - go to the "Hierarchy" - tab, select "Affect pivot only" Step 2. - right click "Move" and set "Absolute: World" to X,Y,Z = 0,0,0 Step 3. - click "Reset transform" under the hierarchy tab -Now re-link the hierarchy, the sub-objects back to their places like they were before: -Now select again all the three meshes and subobjects -Now, double-check that you've still got "Affect pivot only" selected on the right-hand "Hierarchy tab" -Now right click "Rotate" and set X,Y,Z = 0,0,0. This is important: the model should not move a bit, if it does, you're doing something wrong -It's time to export again, check that the paths are the same and hit export, don't close gmax, but switch back to BF2editor (which you should've left open, remember?) Object editor, now hit "Reload geometry" on the right-hand menu. The model should now have the correct orientation and all the sub-objects should be in their right places. -Go to the Animation editor again, drag and drop and make sure that the orientation is right ie. the barrel is pointing in the right direction and that everything else in place too (albeit a little off-scale) Testing animations in this phaze may produce rather amusing results Chapter V - Tweakin' -Now starts the tedious part, as far as I know, there's really no quick way through all this, you just have to kinda play it by ear. -This is the part in which we scale the model into the right size and change it's position so it fits the soldiers hands. -First we'll scale the model in to the right size, for this, you need to once again re-link the sub-objects to the lod0's like we did a while back: -With "Affect pivot" still selected, scale down the model and then hit "Reset: Scale" on the right. You have to estimate here. You can export the gun to the editor with the sub-objects "ill-parented" so you can do comparisons on the sizes, but you cannot see it in the animation editor. Remember, you always have to re-link the sub-objects, if you just try to scale down the model with the normal hierarchy, only the main meshes will be scaled down while the sub-objects remain the same size, not pretty, mind you So the drill here is: +Re-link sub-objects to lod0's (gmax) +Scale (gmax) +Reset scale (gmax) +Re-link sub-objects to the main meshes(gmax) +Export (gmax) +Reload geometry (BF2editor) +Check the mesh's size compared to the soldier model in animation editor (BF2editor) +Go back to square one if need be. (as is highly possible) Ok, so after some trial and error, we've got the scale about right: -Now we see that it's a bit misplaced, we need to move it a little back and down, so back to Gmax -Select all three meshes, make sure the sub-objects are in the right place in the hierarchy (under the main meshes). Now with "Affect pivot only" still selected, zoom up and close to the model so you see this bunch of colorful arrows. -With the move-tool, move the arrows, not the model, according to your needs, something like this: As you can see, I have to do the exactly opposite corrections. Then just export again, reload geom in the BF2editor go to the animation editor to see the results: All right! Almost there! Chapter VI - Finishing up -Now, Let's have some textures! -Remember when I told you that I unzipped the original "usrif_sa80" folder from the objects_client.zip? And when I told you the folders & files created by the exporting? Now we're going to put those two pieces of information in use. -Copy the "textures" folder containing usrif_sa80_c.dds and usrif_sa80_b.dds and the "Sounds" folder from the zip to /battlefield 2/mods/YourMod/Objects/Weapons/Handheld/usrif_sa80 -Back to Gmax. Open up material navigator and delete whatever materials there might have been. -Select all three meshes and sub-objects and the scope -Go to material editor. Click "New" and select "BF2 bundledmesh" -Now, you have manually type in the location of the .dds textures you just copied, for example, my paths are COLOR: D:Battlefield 2modsSOTFobjectsWeaponsHandheldusrif_sa80texturesusrif_sa80_c.dds NORMAL D:Battlefield 2modsSOTFobjectsWeaponsHandheldusrif_sa80texturesusrif_sa80_b.dds Then just click "Apply" and export. -In BF2editor, -> Reload geometry and the textures should now be visible: Great, huh? -Ok, we're almost there, the only remaining thing to do is to go in to BF2editor and click "Mod -> Package mod" and select "Package active" -Load up the game and after all that agony and swearing, it's all just sunshine and rainbows now That's about it, then. Naturally there are some minor things still, like, *uhm* the scope. But you can still do the modifications quite easily: modify in gmax -> export to editor -> package mod again. I'm sure that I've forgotten something and that there is something else amiss with the tutorial, but such is life, I'll do the corrections as they pop up. All rights reserved, please don't kill me, happy halloween, kthanxbye. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.