project reality header
Go Back   Project Reality Forums > PR:BF2 Mod Forums > PR:BF2 Community Modding > Modding Tutorials
13 Oct 2019, 00:00:00 (PRT)
Register Developer Blogs Project Reality Members List Search Today's Posts Mark Forums Read
Modding Tutorials Information and tutorials related to modding BF2.

Reply
 
Thread Tools Display Modes
Old 2012-06-24, 19:36   #1
[R-DEV]​Rhino
PR:BF2 Developer
Supporting Member

Rhino's Avatar
Arrow Separating 1st & 3rd Person Models/Textures for Handheld Weapons

Hey all.

This is a tutorial I started last year, but something else came up that I had to start working on and as such, never got round to 100% finishing the tutorial, but its in a pretty good state to help a lot of you out. I do hope to 100% finish at some point in the future but for now, will have to skip thought the small missing parts etc and some things are not 100% correct either, like you shouldn't make a normal map for the final 3p lod etc as its now worth it

Cheers!

----------------------------

In this tutorial you will be learning how to separate 1st and 3rd person models for handheld weapons (although these techniques can be used on a lot more than just handheld weapons, like for example doing 1st and 3rd person cockpit models for vehicles too) using baking techniques which some of you may be familiar too if you have done any Subdivision modelling.

This is a new method we are implementing in order to improve performance of the mod by basically drastically cutting down on the amount of textures the player has to load and also how many polys the player needs to render, which we are estimating should reduce the current overhead of handheld weapons by around 75% with minimal visual impact.

To put this more simply, we are going to turn this L85A2 from this to this:

Insert Pic Here



For this tutorial I'm going to take the SA80 series (aka, L85A2 series) of rifles used by the British Armed Forces ingame and give them all nice new 3rd Person Models, crated off there 1st person models.




Step 1: Making sure your 1st Person Models are Final

Before you can really start this tutorial you need to ensure that your 1st Person models are 100% done, complete with Texture and no known modelling issues. Make sure you check with a Lead Developer that your model is indeed final and can go onto the next stage.

For the SA80 series I fixed up a few numerous issues with them, first of all replacing the old bullets in the Magazine with the new common bullets I've made that will be used by all 5.56mm and 7.62mm Rifles, ensure your model has these bullets in its magazine as well. I also fixed up a few UV errors, material errors and a few other things I wont bore you about as each model will have its own unique problems and its up to you to find and fix them, although you should ask for help on finding any issues from a Lead Developer as mentioned above to ensure there is no issues with your model.

Once it has been confirmed there are no issues, you can move onto step 2.




Step 2: Crating your 3rd Person, Low Poly Models

Before we going charging into this and start just modelling away, we need to step back and analyse the model to see what really needs to be done here.

First of all lets look at all the variations of this weapon:
  • L85A2 RIS ACOG
    • Bayonet
  • L85A2 RIS SUSAT
    • Bayonet
  • L85A2 SUSAT
    • Bayonet
  • L85A2 Irons
    • Bayonet
  • L85A2 ACOG with AG36 UGL
  • L85A2 Irons with AG36 UGL
  • L22A2 SUSAT
  • L86A2 SUSAT
  • L86A2 Irons


In total there are 13 different versions of this weapon, but we need to look deeper than that and find out what all the common components are. In all I count 14 main different components here that are mixed and matched to make up all the variations of each rifle.
  1. L85A2 Body
  2. L85A2 Barrel
  3. L85A2 Fore Grip
  4. L85A2 Pistol Grip
  5. L85A2 Magazine
  6. Iron Sights
  7. SUSAT 4x Scope
  8. ACOG 4x Scope
  9. SA80 Bayonet
  10. L22 Components
  11. M16A4 Vertical Grip (Goes on the L22 rail)
  12. RIS Components with its own Vertical Grip Tripod
  13. L86 Components, includes bipod and butt vertical grip
  14. AG36 Under-barrel Grenade Launcher (UGL)


(Total Triangle Count: 20,135 tris)
(Note: This is just an explosion diagram of all the parts, this is not how I actually have my scene setup)

Now that we have identified all the components of our weapon, we now need to look into making low poly models for each one. I'm going to start with the main one here which is the L85A2 Body.

First lets select the component and Detach it as a clone from the model (make sure you detach it as a clone, we dont want to start screwing up our 1p models) and call it something like "1p_L85A2_Body" where the 1p stands for 1st person model which is quite important to have as you dont want to start mixing up the 1p and 3p models now



Select your new "1p_L85A2_Body" or w/e you called it model and unhide selected so we can only see the component we want to work with.


Now there is two main methods, of making a low poly 3p model off a 1p model. The first way is to make a brand new model in the same proportions of the high poly (1p) model and the 2nd way is to clone the high poly (1p) model and work off of that, optimizing it until its at a good poly count, although you can use both methods when working on the same model.

For making the 3p model for this "1p_L85A2_Body" I'm going to go with the 1st way of doing it which is crating a new low poly model from scratch.

First of all I'm going to make a new box around the high poly model, then converting it into a editable poly and move the verts into position around it like so:


Next I'm going to make new edges using the connect tool so I can then mark out the model by moving the new verts into position like so:


Next I'm going to extrude the bottom face to make the mag wall then snap the verts onto the edges:


Then to make the butt of the rifle I'm going to connect these edges with 3 segments and move the new verts into position.


Then I'm going to chamfer the bottom edge to round off the bottom.


Then I'm going to remove all the unnecessary edges and verts to optimize the model like so:


Now I just need the sights mounting rail on the top of the rifle which I'm just going to detach off the 1p model as the one on the 1p is already low poly and it saves me from making it. Select the 1p model, select the rail faces/element , detach as a clone, then select the 3p model and attach it to that, then delete the unnecessary faces.


I'm now going to add some edges in at the back of the rifle to ensure the faces are all working well and not coming out and smooth the butt up with the top and bottom of the rifle as well so its all nice and smooth.


One last thing for us to do is make the holes though the rifle since we can't do them very effectively with just normals or even alphas as since they go right though the rifle and are pretty channelled, a normal would only give the right effect if you where not looking at the rifle pretty much side on and alphas would only give the right effect if you where looking the model side on, as such a 3D mesh is the only real way to do it. First I'm going to select the holes on the 1p model and detach them as a clone, then after selecting the new object, snapping the verts out to the side of the 3p model since its slightly wide than the 1p model.


Next we want to optermize these holes, first I'm going to collapse the side edeges of the holes and then going to remove the edged of the upper edges so then I can remove the verts, leaving just a 6 sided hole


Next I'm going to delete the old side faces on the 3p model, attach the holes model and then selecting the two borders of both the side of the 3p model body so we can bridge them.



Now the Bridging has left a few small error that we need to correct so removing the offending edges and then replace them with good ones


Another thing we need to make is the shell ejection port on the right side of the rifle. As the shell ejection port on the 1p model is just a simple box like we need to make I'm going to detach it off the 1p model as a clone, snap its verts so they are in line with the side of our rifle and then attach it to the 3p model, crating new faces around it.



Once you have done that, smooth up the side and then repeat the same thing for the other side.


Finally all we need to do is align the 3p model pivot with the 1p model to make it easy to work with in the future. The simplest way to do this is to Hierarchy tab, press in the button called "affect Pivot only" and then use the Align tool by selecting it, then selecting the 1p model and a new window will pop up, make sure you tick all transformation and rotation boxes and align pivot to pivot then the Pivots will be in sinc



Then we have our finished body model coming out at 226tris which is a 1,447 tris less than the 1p model. Might look really shitty now but when we bake the textures, normal maps, spec maps and AO maps all onto this low poly model its should be hard to tell the two models apart
Also make sure you name this model "3p_L85A2_Body" or something along thous lines so you dont loose it at any point.
Also note: we still need to make the cocking handle to cover the ejection port but I'm going to make that as a separate component since its going to be animated.



With the 3p L85A2 Body model done I'm now going to move onto anouther component, this time one which I'll make with the 2nd method I talked about at the begging of this step, so for this I'm going to pick the Pistil Grip and Trigger component

As we did with the L85A2 body, select the Pistol Grip from the main mesh, then detach it as a clone and all it "1p_L85A2_Pistol_Grip", then clone that model as a copy and call it "3p_L85A2_Pistol_Grip" and then unhide selected so your just left with the model you want to work with


First thing I'm going to do is delete this top face as its not necessary, is on the 1p model since it sticks out just a little but on the 3p as the body is slightly larger, it doesn't.
Note: Dont worry about any of the UVs getting messed up since we will be re-uving these later, although if you can preserve the UVs it might save you a bit of time later.


Next I'm going to select thes edges, remove them and then remove the verts that are left.


Next I'm going to select every other edge on this trigger guard and collapse them, then remove this bit of mesh above as its not needed.


Now I'm going to remove these edges on the back of the trigger, then remove the verts that are left.


Now on the front of the trigger we can collapse these edges:


And back to the Pistol Grip we can remove these edges, then remove these verts:


Can collapse this edge here:


and we can remove these edges and then remove the verts.


Then we are left with a nice pistol grip with 184 tris which is under 1/2 the tris of the 1p model which isn't anything like as much reduction as we did on the body but this model is pretty rounded model and we dont have many details which can be baked onto the normal etc. Also note that I dont need to snap the pivots as this model already has the pivot in the correct place since I detached it from the main model and worked strait off it.


Keep on making low poly models of all the components until you have finished and then you can move onto the next step, although you may prefer to make a component and then move onto the next step and get that component finished then come back to this step to do the next component but that's upto you

All my Low Poly Components:


(Total Triangle Count: 5,858 tris)
(Note: This is just an explosion diagram of all the parts, this is not how I actually have my scene setup)




Step 3: UVing your low poly 3p models

Now for UVing these objects you basically need to UV them in pretty much the same method you would UV a normal object but the only real difference is that your going to be UVing all these components onto the same sheet. How you go about this is up to you but what you need to end up with is all the components of this weapon series all UVed onto the same sheet, so all the L85 bits, L86, L22, AG36, all the scopes and other attachments need to be all on this single texture sheet.

I'm not going to go much into UVing methods so if you need to learn about UVing here is a pretty good tutorial: Creating a Weapon For Source download - Mod DB

There are a few thing you need to keep in mind when UVing objects for Baking which as a result you need to change a little bit on how you do your UVs.

The first thing is that you shouldn't have any overlaps on your UV as overlaps will come out really bad when baking as it will basically render the same/diffrent texture twice onto the same bit and even if the textures are excatly the same, the result will be diffrnet from if it wasn't overlapped, screwing up the baking. Different components mind you can be overlapped if the same and then you just have to fiddle around with them a little when you put all the baked textures together in photoshop but parts of the same mesh/component that are overlapped will come out really funny on the bake. Its possible to get around this either by hand painting or by only baking one bit by detaching it and baking it but this is only really worth it if your going to be saving a big chunk of space on your UV. So keep this in mind when your UVing and ask yourself if this this bit is really worth overlapping or not? Also keep in mind that one bit you might want to overlap might have a different texture on the main mesh and if so, the 1p and 3p models wont look the same which if its a large bit of the mesh could be a big issue.

The next big thing you need to keep in mind is that you can't stich bits of the model together with diffrent smoothing groups. If you have your UVs stiched together your normal (bump) maps will not come out right and there will be a big line/seem on the stiched part where two diffrent smothing groups meet.
Here's a quick example just encase your not sure what I'm on about using the butt of the SA80 rifle.
First of all the Smoothing groups, the top face uses smoothing group 3 (shown in blue) while the back (and underside) of the rifle uses smoothing group 2 (shown in red). As you can see the two smoothing groups meet at the very top of the back of the rifle.
Here is the stiched UV:

And in the render of the model after its been baked with a stiched UV, we can see a big black seam across where the two smoothing groups meet.

Now here the un-stiched UV:

And in the render of the model after its been baked with an un-stiched UV, we can see a big black seam across where the two smoothing groups meet.

Stiching UVs is something on a normal UV that is not having a texture baked to is something you should do at every oppitunity to make it as easy for the texture artist as possible to match up the textures on diffrent parts of the model. While this is some what still true for baking textures you should still stich up the UVs as much as possible, just dont stich up the UVs between two diffrent smoothing groups so make sure you know where your smoothing groups are and that you do not stich them up otherwise your normals are going to look totally rubbish and nothing like as good as they would otherwise. Even thou your UVs are not stiched, you can still put the faces that would be joined together much closer to each other than you would for a normal UV as any texture bleeding wont matter because the textures are the same on both sides, just make sure you have the right faces, the right way round next to each other. Simplest way to do this is to stich up your UVs then brake them at the points between two diffrent UVs.



I'm now going to start off by UVing each component separately and not grouping them all up into one object as this will make things much harder in the future when it comes to putting each component onto each variation of the series, I strongly advise you do the same.

..........

A few hrs later I've finished all my UVs for all my low poly component UVs.


(Note: This is just an explosion diagram of all the parts, this is now hot I actually have my scene setup)

Here are all of my UVs for each component, note I've only grouped them all up into one single object so you can see them in a single picture. Also note how each part is UVed to the same scale, which is because I've UVed all my object in normalized form and each object has the same scale settings and as such, the same pixel ratio which is what we want.


Now to pack my UVs I'm going to use the "multi Objects Unwrap" tool but I must warn you, you must use this tool with care as it can screw up your models so make sure you save plenty of backups and while UVing save your UVs (by going "File > Save UVs" in the UV Edit window) then if it or you dose screw up you can either revert to your backup before you started the UVs and/or you can load your saved UVs (as saving while using this tool is a very bad idea as it will save all the objects as one object and you can't undo them). Installation and Usage Instructions are on the page linked below.
Tool Info and Download Page: multi Objects Unwrap

After you have installed that script, select all your low poly components and launch the script, a window should pop up, leave the settings on default and click "unwrap UV's" button. This will take a little bit of time while it packs all your objects into one while memorising which bit is what and after a bit a window will pop up with the UVs of all the objects for you to edit.
NOTE: DO NOT CLOSE THIS "multiUnwrap" WINDOW AT ANY POINT! You need it left open in order to "set" your UVs when you have finished. If you close the window during the UV process before pushing the "set UV's" or "cancel" buttons after hitting the "Unwrap UV's" button, it will forget which part of the object is which and you will note be able to dismanatal it back into all its sperate components.



Proceed to Scale and Pack your UVs into a single texture sheet like so:



Once you have finished packing and scaling your UVs to fit into a texture sheet, go back to your "multiUnwrap" window and at the bottom, check the "convert to polys" option and then hit the "set UV's" button and it will convert your model back into multiple objects with there new UVs


Now if we take a look at just one component, for example the body of the rifle, and apply the Unwrap UVW modifier to it and take a look at our UVs, you will see that all that work we did has stuck


Here is all my UVs of all my low poly components put together




Step 4: Materials

If your working from an export scene like I am or even if your not, chances are your materials are not set-up correctly and we need to do some stuff to put them right.

First thing we need to do is apply an empty, "Standard" material slot to all our low poly models, nothing special just an empty slot and you don't need to do anything else for now just make sure all the low poly models you want using the same texture have the same material applied to them.

The next thing we need to do is apply the "Standard" 3DsMax material to all our high poly objects instead of our "BF2 BundleMesh" Material I currently have on all my models so that when we render the objects, 3DsMax will be able to pick up the render correctly.

Now I'm sure you all have set up normal "Standard" Max materials before but just encase I'll go into detail on doing this.

First of all I've saved my scene to a new copy called "L85A2export_Baking.max" so that all my material changes dont mess up the export scene of the weapon as for the baking itself, we shouldn't be doing anything here that we need to keep in the export scene and if you see any bugs that need fixing, fix them in both scenes but if your not working with an export scene like I am, you dont need to worry about this.

So I'm going to be replacing each material one by one with a Standard max material with the correct textures in the correct slots.

I'm first going to replace the "BF2 BundleMesh" materail with a Standard materail my "Body" Material slot. To do this click the big button next to the materials name which should be called something like "BF2 BundleMesh", a window will pop up, select "Standard" from it.



Now the first thing we need to do is set our Diffuse/Ambient colour to 100% black (ie, R0 G0 B0) so that our texture dosen't come out all whitewashed when we render it.


Next scroll down and expand the "Maps" tab, in there will be a list of "map" slots, check the "Diffuse Color" box and click on the button next to it. In the window that pops up, select Bitmap from the list and then browse to your "colour" (_c) texture and open it.


You then should be able to leave all the settings on default. Check the Offset is set to 0, Tiling is set to 1.0 etc and then click the "Go to Parent" button just above the "Bitmap" button. When your back to the Parent material, click the "Show Map In Viewport" button which is above the "Standard" button or left of the "Go to Parent" button and then you should be able to see the texture on your model.


Next lets set up our spec map. Check the "Specular Level" button under the "Diffuse Color" button and then click the box to the right of it. Select Bitmap and browse to your Colour (_c) texture (sometimes your spec map will be on the normal/bump texture but most of the time it will be on the colour, check the texture's alpha channel to confirm).


Now for the spec map we need to change a few settings in order for it to read the spec map from the texture's alpha channel. In the "Mono Channel Output:" section check the "Alpha" box. Under that there is a "RGB Channel Output:" section, check the "Alpha as Gray" box for that and then to the right of that there is an "Alpha Source" section, make sure "Image Alpha" is checked for that, should be by default but just make sure.


Click the "Go to Parent" button to go up to the main material and then lets add the Normal map. Check the "Bup" box and make sure the "Amount" box to the right of it is set to 100, (default is 30). Once its set to 100, click the box to the right of that and then instead of adding a Bitmap material we need to add a "Normal" material to it otherwise our normal map wont come out right. You will come to a new box with a few settings in it, just click the box next to "Normal" and then add a bitmap material like normal. Then browse to your normal/bump "_b" texture and open it. The settings for the Bitmap can then be left on there default settings but check the offset and tiling settings etc to make sure they are all good but if they where fine on the colour setting they should be fine on this.



Once you have done all that your material should be setup correct and although you wont be able to tell the difference in your viewport, when you do a render your model will come out looking all nice and pretty like

Also this part of the SA80 dose not have any transparent parts but this part of the ACOG dose.


All you need to do to get the object transparent is just to fill out the Opacity box with a Bitmap using the texture that has the alpha in it, and then set it up with the same settings as the Spec material and then have that material applied to the parts that have transparent faces.


Which then in your viewport and render will change the look of that bit from this:

To this:


Once you have done that for all the materials your renders should be looking very nice and pretty and then you can go onto baking.... cookies!





Step 5: Baking

Ok so I lied about us going to be baking cookies but we are going to be baking textures which are just as yummy!

Now for thous of you who have baked normals off high poly models will pretty much know the basics of this process as we are going to be doing the same thing but we are also going to be baking the diffuse, spec, transparency/alpha (if needed) and normal maps off our "high poly" (1st person) models

Now the first thing we need to do is add a Sky Light to our scene for the AO baking. Go to "Crate > Lights > Sky Light" and set its colour to 100% white (R256, G256, B256) and then drop it anywhere in your scene, somewhere out of the way.


Next go to "Render > Render Settings (F10)" and click on the "Advanced Lighting" tab and set the "Active Lighting" as Light Tracer.



Once you have done that, choose a component you want to start with, I'm going to pick the main body of my rifle. Unhide the high poly (1st person) model and your low poly (3rd person) model of that component (make sure they are both on top of each other as they should be) and hide all other models just leaving the 1st and 3rd person models of that component, as you only want to work with and bake one component at a time. (you can also hide the sky light, as long as its left in your scene, hidden or scene it will still be active unless you uncheck the "On" button).


Select your low poly (3rd person) mesh and go "Render > Render to Texture", a new window will pop up and you need to fill out these settings.
First in General Settings set your Output path to a place where you want all your texture bakes saved to. I would recommend making a folder in a place you can find easily and wont get lost.
Next make sure you do have your low poly model selected and then make sure your settings match mine, then press the "Pick" button and select the high poly (1p) model, then set the Projection Mapping to Projection and click the options button. Check the "Use Cage" button and uncheck the "Ray Miss Check" button, then click the Setup button. A new window will pop up, scroll down and check the "Enable Global Supersamples" and select "Max 2.5 Star".


Once you have done all that we can start adding in each texture map we want to be baked. First scroll down the the "Output" section and click the "Add..." button, a new window will pup up called "Add Texture Elements" with lots of different options listed. We want the "DiffuseMap" element for our first texture which is basically going to be our colour map. Select the "DiffuseMap" element and click the "Add Elements" button.


You will then see in your "Render To Texture" window that you now have a new "DeiffuseMap" element in your "Output" list. First thing we need to do is change its "Filename and Type", as although the Filename is fine, we want the texture saving as a .PNG. Click the "..." button to the right of this field and you should come to the folder you specified in the Output Path in the last bit just above this. Change the "Save as Type:" to a "PNG Image File (*.png)" and then click save. A window will pop up about saving options for the PNG file, make sure 24bit is selected and also the "Alpha Channel" bit at the bottom is also checked, very important we have that option checked and then click Ok.


Next thing we want to do is specify what size we want our texture baked at. You should always play it safe and bake/make the texture on a size above what its most likley going to be, so for this texture is probably going to end up as a 1024x1024 texture, if not its going to be a 2048x2048 texture if there is too much quality loss from being 1024^2 (which there probably will be) but it can't go above a 2048^2 so just render it at that. Click the "2048x2048" button or w/e size works best for you, or you can put in a custom size if needed.


There are nothing else from the default settings we need to change from the diffuse so once you have done that Click the "Add..." button again and this time lets select the SpecMap element.


Now you should have two elements listed in your output list. First make sure your object is still a ".png" in the File Name and Type box, it should be after saving the last element as a .png, if not, repeat the process of turning it into a .png. Also make sure you click the 2048x2048 texture size button or put in w/e size you need and leave the other options on default.


Click the Add button again and this time we are going to add the NormalsMap element, doing the same things as last time the only difference is in the "Selected Elements Unique Settings" check the box "Output into Normal Bump" box.


Next click the Add button again and this time lets add the "LightingMap" element. This bake we will use as our AO (Ambient Occlusion) map later on which I'll go into more detail later. Add, give it a size of 2048x2048 and then in the "Selected Element Unique Settings" box make sure that Shadows, Direct Light and Indirect Light are all checked. Leave the "Target Map Slot" empty as there isn't a slot for AO in there. This dose mean you wont be able to see the AO maps affect until you manually put it on the colour texture but that doesn't matter too much at this point as all the AO map is going to do is bring out the 3Dness of the model some more.

The last thing we need to do is in the very bottom right of the "Render to Texture" window is 4 check boxes, make sure "Baked:" is checked for both Views and Render which will basically mean that once the object is baked, these textures will automatically be placed on your model and will show up in both your viewport and in your renders




With all that done we can now minimise/close the "Render to Texture" Window and we will come back to it later (even if you close it, it will keep its settings providing your low poly (3p) model has its "Projection" modifier on it and the settings will still be there when you reopen the window (providing you have the low poly model selected)).
Do NOT click render yet, we need to set up the Cage first.

As I mentioned above, your low poly (3p) model should now have a new modifer on it called "Projection", which controls the projection mapping cage, This is important, because it sets up how the samples will hit the mesh and reflect the textures and the depth of the high poly object. Expand the Projection modifier and select the cage mode. set the cage to shaded mode so you can see it better and click the "Reset" button to reset the cage back fully onto the mesh.


Now just select and move the cage points just like when you build a mesh until every blue line is at least a bit above the high poly (1p) mesh. This is important because it sets the way and space samples will travel. You can also use the Push Amount/Percentage options but use these with care since they can screw up a bit. I can't really give you much more advice on how to do this as each model is different and requires a different cage its all amount trial and error until you get what you want and you will eventually get the hang of it. Here's my cage for my model:


Open up your "Render to Texture" window again (Render > Render to Texture (0)) and then hit the "Render" Button in the bottom left of the window. A window will pop up saying "Missing Map Targets" and listing the Lighting map as missing a target slot which we know about. Just ignore it, check the "Don't display this message again" box and then click Continue. Max will then start to bake your textures and this will probably take a bit of time since your baking a large texture, and multiple sheets all at the same time but takes no longer than 2mins for me.


Once your textures have finished baking you should see something like this on your render preview:


Here are my baked textures, from left to right: Diffuse, Spec, Normal, AO.


And if I do a render or two of just my low poly model with baked textures:


It looks pretty good but there are a few small issues. To start off with the bottom of the rifle for some reason hasn't baked quite right and its for some reason squished the texture into the middle, although hasn't done this on the top, back or front... Not entirely sure why its doing this but just need to try a few things until we find a cage setup that works better
Keep in mind that any changes you make to the cage may affect other bits of the baking.
The other issue is that the front of the rifle hasn't baked quite right as well and is missing some bits, just needs the cage coming out a bit more and it should be fine.


I fixed the front problem pretty easily just by brining the cage out towards the front some more like I said. But the issue with the bottom of the model is a really, really odd one I and a few other people haven't been able to work out what's causing it etc. As such what we are going to do is go round the problem by detaching the offending faces to a new object and then going to bake it separately. It aint a pretty solution but it will get the job done.

Hopefully I don't need to show you how to do this but what I'm going to do instead of directly detaching the faces as that would mean I would need to collapse the modifier, I'm going to clone the object as a copy and call the new object "3p_L85A2_Body_bottom" and then delete the faces we dont need and repeat the above process, going render to texture, setting up the settings and maps, setting up the cage then baking it. I will go into how to go about putting them together in photoshop a little later.


Now if you come into a situation where you need to bake transparent areas on your model I'm just going to run quickly though what you need to do for this although tbh your probably better off hand painting them on in photoshop as you can't bake them to very good quality like this. For my L86A2 I have lots of little holes running down the side of its rail bit around the barrel and for my low poly (3p) model I decided to do them as just a transparent bit though my mesh instead of doing them as polys, since they are so thin you would hardly be able to tell the difference between polys and alpha and alpha can leave a rounder result than a low poly mesh hole.


As such I need to bake the transparent maps unless I want to paint them on by hand in photoshop, so set up your render to texture settings as before with just one difference. As well as your Diffuse, Spec, Normal and Lighting map elements, also add an Alpha element and set its target map slot to Opacity and set its size pretty high, at least 2x the rez as your normal bakes if not 4x the size so for me, 4096x4096 or even 8192x8192. This is because its quality of the bake isn't very good and the higher rez you bake something, the better its quality and also when its compressed down into a smaller rez (like we will be doing) it will get even better


Set your cage up as you normally would (also you may like to note I've only got my refrence geom (1p model) showing while working with my cage and the working geom (3p model) hidden. To do this, on the right in the modifier bar there is a little "display toggle" bit and if you check the enable box, you can hide either your working or ref geom and you can press that button beneath the enable button to switch between the two ) and then you can bake your texture, it will take longer than it normally would as your baking a pretty high rez texture with it, it might even not be able to save the texture if its too much of a high rez, if so lower your rez to something your PC can handle and then once its done baking, you should be able to see in your viewport and render that parts of your texture should now be transparent on your low poly model


It needs some cleaning up in photoshop but lowering the rez etc should do most of that


Now all we need to do is bake all our other objects with the same basic methods, other than you don't need to setup the lighting and all the render settings twice over (although make sure you always uncheck the "Ray Miss Check" button in the options tab as otherwise you will end up with red bits on your bake)




Step 6: Compiling your Baked Textures

Now that you have baked all your objects its now time to put all these textures you have baked together

I in total have 107 texture sheets I need to put together:


First thing we should do here is backup all our bakes just encase we mess them up so back them all up in a nice safe place, even thou we have our scene saved with the cages still interacted (unless you have collapsed your projection modifier which you shouldn't have or didn't save the scene separately etc like I told you) we can always quite easily bake new textures off the 1p models by just opening up the scene and hitting the render button but its still best we back all this up

Next thing you probably might want to do here is to close max to free up some memory as photoshop is a big ram hogger and so is max and we are going to be doing some quite memory intensive stuff with PS so best to close the other program we aint using.

Now how you want to do this is very much up to you, I'm not much of a texture artist so I can't give much advice on what to do here but I'll still go though quickly the basics of what I'm going to do in order to turn all these bakes into usable textures

The first thing I'm going to do is organise all my bake types (diffuse, spec, normals, etc) into different folders by crating a folder for each type, then using window's search inside the "bakes" folder, and searching for the key word of each type (ie, diffuse, spec, etc) and then copy and pasting them into each folder like so.


Once you have done that to each type, open up Photoshop and go to "File > Scripts > Load Files into Stack..." Select Use Folder and hit the browse button and browse to your Diffuse Folder. Select it, hit ok then all your diffuse files should be listed, then hit Ok for the script to start packing all the files into one image


And when its finished you should end up with something like this


Next thing we need to do is rearrange our layers so that we have the right ones on the top if you have baked multiple bits of the same object, like I did for the L85A2 body, with baking the bottom bit separately for example and right now if we look at it, the extra bake I did is under the main layer meaning its not being shown, as such we need to move the "body bottom" layer on top of the main "body" layer.


Next thing we need to fix is the L86A2 Bipod feet, as I couldn't bake both the top and bottom at the same time due to the model being flat on the low poly model, I had to bake the top and bottom separately. As such on my bakes, on one of them I have both the top and bottom faces using the top texture and on the other I have both the top and bottom faces using the bottom texture.


As such I need to manually remove a bit of the sheet. so I can have both the top and bottom faces using there correct texture. Now I know from looking at the model/UVs that the left foot UV is the top face and the right is the bottom face. As such I'm going to select the right foot with a marquee, with the top texture on top and selected and delete that part of the texture off to remove the top texture on the bottom foot, leaving just the bottom texture there in its place.


Now I'm going to crate a new layer at the very bottom, call it "Background" and fill it with the most common colour on the sheet, in this case, Black.


And finally to keep everything organised, I'm going to crate a new group, give it a nice green colour and call it "Diffuse" and then chuck all my Diffuse layers in to it including the background layer


It might look about done now but there is still some work our diffuse layer needs which I'll go into a little bit later as for now we need to do basically the same thing to our spec, normal AO and alpha layers


Right lets do our Spec layer next, do as we did before by going to "File > Scripts > Load Files into Stack..." Select Use Folder and hit the browse button and browse to your Spec Folder, select it and then hit ok to start loading all the files into it. Then as we did before, make sure the right layers are on top and delete the top texture of the bottom bipod face, etc etc, then give it a black background and put it into a nice "Spec" group with giving it a nice colour as well.



Now with our Spec set up, lets put it into the same file as our Diffuse textures. Select the Group, right click on it and select "Duplicate Group..." from the list. A little window "duplicate" window will pop up, select the Destination into our file that contains our Diffuse textures, in my case the "SA80_3p_Textures.psd" file and then click Ok. Now when you switch back to your main sheet, you will find both the Diffuse and Spec groups in there


And basically the same thing again with the Normal map, with the only difference being instead of a black background, we want a R128 G128 B255 background which is the default colour for a normal map.




Same thing again with the AO map other than a white background this time.



Now for the Alpha maps, we first need to open up each one and resize it down to 2048x2048 and then save and then close them before we can stack them all into one file and duplicate them over to our main file which is just the same as the other maps although for this, we do not want to give it any background textures.



Now you need to edit your Alpha maps until you only have your transparent and non-transparent bits black and white, something a bit like this:


One more thing we need to do with our layers is first sort them so the AO is on top of the Diffuse layer, then change the AO layer to "Overlay" blending mode and then with both of your AO and Diffuse layers on (and the others off) you will notice that this will brighten and darken some bits of your diffuse texture, most likley but we can fix that by bringing down the layer's "Opacity" to somewhere around 25% and then it will give our models a very slight boost in light and shadow on some parts making it look more "3D" but dont overdo it as the models we baked off already most likley already have AO baked onto them so we are just adding on top of that with the differences between the 1p and 3p models


Now that we have our AO map brightening up our textures they dont match our 1p ones. As such, we need to take the brightness down a notch to even it out, with still keeping our AO shadows on our texture. First take your "Color Sampler Tool" (which is basically multiple eye drops and is located just under the eye dropper tool) and pick 4 locations around your texture to find out there RGB values which you can see in the Info tab.


Mark down your RGB values for each, mine are:
Quote:
1: 55 54 36
2: 30 32 27
3: 4 2 4
4: 30 30 27
Now turn your AO layer back on and you will see your RGB values change which is fine but we now need to correct that. Expand your diffuse group and add a new "Brightness/Contrast Adjustment Layer" to it and then set Brightness and Contrast settings to a value where it matches your old RGB values marked above for each point. This may take a little trial and error to do as you can't see your real RGB results until you have pressed ok on the brightness/contrast settings but its simple to tweak, just double click on the layer box to tweak it
Also set your contrast right down so your dark areas are less effected by the AO and brightness changes
For me I found a Brightness value of -75 and a Contrast value of -50 got my value pretty much where I wanted it, note in my last pic my RGB values of each point after the brightness and contrast setting is applied with the AO on is pretty close to what it was with it not there and the AO off



Now from here it's really up to you to tidy up what needs to be done by hand on your textures, what needs to be done is very much up to what problems there is but here's a few things you can do to tidy up your textures.

For starters I always like to give a blurred background to my models which really helps with the mipmap filtering. Make a new layer just in front of your background layer on your diffuse or w/e map, turning off all the other map layers and then with the blur tool, make sure the "Sample All Layers" box at the very top is checked and paint around blurring up everything which will then give a really nice background to all your models and more importantly, will "bleed" the texture outside of the main UV which will really help with the mipmaps.


Which then if we zoom right in and turn it on and off, we can see what its really doing


You will want to also do this to the other layers (other than the Alpha layer) but you might not want to do it on the Normal layer, it might screw things up a little so try it on and off and if you can't see a difference between it on and off (in a max render or better yet the BF2 editor), keep it on

Also if you need to include new baked textures into your scene, just open them up and duplicate them into the right place but DO NOT copy and paste them in as they will most likley not be pasted into the right spot and as such, will not match the UVs. When you duplicate they are in the exact same spot as they where before



Once you have finished editing your textures and they are pretty much final we can save them out as .dds files to be used ingame

Now I'm going to give you a quick crash course on .dds textures. There are really two main formats of DDS textures, DXT1 (no Alpha) and DXT5. DXT1 (no Alpha) is normally used when the texture just a plain RGB texture and it has no alpha channel. Its small and light and also dosen't have very good quality compression, even for a DDS texture so there will be a tiny bit of quality loss with it but the file size at the end will be very small. DXT5 is the texture map you use when you have an Alpha channel as well as the normal RGB channels so its used when you have a spec or alpha map in the same file as your normal layer. Now normally you wont have any "Alpha" channel that controls the transparency which in that case, you would have the Spec map as part of the "_c" (diffuse/colour map) texture but since we have an Alpha/Transparency map, the alpha/transparency texture gets saved into the alpha of the "_c" (diffuse/colour map texture) and the spec map saved into the alpha channel of the "_b" (normals/bump map) texture. IF the normal map / "_b" texture had no spec in it we would be saving it as a DXT1 (no alpha) .dds but since we have a spec map in it, we need to save it in DXT5.

I'm sure your really confused about you will just need to seek help on your situation as it really depends on what textures you have and how your using them to what format they are saved in.

Crash course over, since I have in total a Diffuse, Spec, Normal and Alpha maps I need to save (AO becomes part of the Diffuse and isn't its own map) then we need to start separating them out of our main file. First lets do the "_c" texture which is going to have our diffuse and alpha/transparency map in it.

First turn on only your AO and Diffuse groups and turn all the others off. Select the entire canvas (Ctrl + A) and then do a "Copy Merged" (Shift + Ctrl + C) which basically copies all visible layers as one layer, crate a new document (Ctrl + N), it should be 2048x2048 with a rez of 72 and give it a background contents of "White" (will make it easier on saving as you will not have to manually flatten the layers), call it something like "l85a2_3p_c" (make sure it has the "_c" at the end) and then click ok to crate the new doc. Then paste in your copied Diffuse/AO layers (Ctrl + V) and it then should look something like this


Now click the "Channels" tab in the bottom right, right of the "Layers" tab and in the very bottom right hand corner you will see a button called "Create New Channel", click it and it will crate a new channel called "Alpha 1".


Go back to your .psd master file, turn off the AO and Diffuse groups and turn on the Alpha group and then again select the entire canvas (Ctrl + A) and then do a "Copy Merged" (Shift + Ctrl + C), switch back over to your _c texture and paste your Transparency map into the Alpha 1 channel. Then when you turn on your RGB and Alpha 1 channel it should look something like this, highlighting the transparent bits as red


Now save your texture into the correct spot in your "pr_edit" folder as a dds texture like so (make sure the Alpha Channels box is checked if you have an alpha in your texture):


A little "NVIDA dds Format" saving window will pop up, from the top right drop down box, select "DXT5 ARGB 8 dpp | interpolated alpha", check the "Generate MIP maps" box and to the drop down box to the right of it make sure "All" is selected, then hit the "Save" button.


Will take a little bit to save but then your "_c" texture should be done and then we basically do the same thing again with the Normal and Spec layers


Go back to your master .psd file, turn on the Normals group, turning off all the rest, select the entire canvas (Ctrl + A) and then do a "Copy Merged" (Shift + Ctrl + C). Then crate a new file as before with the same settings just this time instead of a "_c", put a "_b" in its file name and then paste the normals into it. Crate a new alpha channel, switch back to the master .psd file, turn on the spec group, turning off the rest, do a copy merged and paste it into the Alpha 1 channel on your "_b", then save it up as a DXT5 with the same settings as before and your done




And here's my final textures, from left to right, Diffuse, Alpha, Normals, Spec.



And now with all our textures saved up correctly, if we go back into Max and setup our material to use our new textures
From left to right, Diffuse, Spec, Normal and Opacity.

And a nice Render of all the 3p models with full textures

(Total Triangle Count: 5,858 tris)




Step 7: BF2 Materials

Now we know that our textures are always looking nice and working well we need to setup our 3p models to use the correct BF2 materials so when they are exported they all are working well in BF2.

All in all for our 3p models we need 3 different materials.
Normal Colour, spec and normal material
Alpha material applied to the bits with transparent parts.
ENV Map material applied to reflective parts like scope lenses etc.

All are going to be using the same textures but just in slightly different ways.

First select an empty material (or even better yet, the material already used by all your 3p models (and no others)) and select "BF2 BundledMesh" material type for it.


Then crate the following materials, first one called something along the lines of "3p_l85a2" (with no || bit after it, no need with this material setup, but in others you need ||Colormapgloss etc, but not here) and browse the correct colour and normal textures. The 2nd called "3p_l85a2||Alpha" which we will use on our transparent faces and the 3rd called "3p_l85a2||Envmap" which we will use on our scope lenses


First fully apply the normal "3p_l85a2" material to all your 3p models, and then go ahead and apply all the "3p_l85a2||Envmap" material to all the scope lenses:


And then apply the "3p_l85a2||Alpha" material to all the faces with transparent bits on them



Now when you export it should all be good, but keep in mind the little bits (ie, shader techniques) after your material name all depend on your texture setup and what you want it to do. Not having any bit after our main material etc is because our spec is in our normal map which the default shader technique uses, "ColorMapGloss" uses the spec map out of the diffuse / _c texture's alpha for example so just keep this stuff in mind and any questions just ask





Step 8: Component LODs

To some of you this may seem way too early to be thinking about the Levels of Detail (LODs) but I find that if you do LODs at this point, you save a huge amount of time in the final stages

So lets start off with the easy stuff, the rifle body
Clone it as a copy and call it "LOD1_3p_L85A2_Body" (you might also want to call your main mesh "LOD0_3p_L85A2_Body" as will make things slightly easier later).


Hide unselected and then lets start optimizing it.
First if we take a look at the top rail, we will see its hardly being seen with any of the sights on it, only the front can be really seen at all when the ACOG is on it but if the Irons or SUSAT are on it, can't be seen at all pretty much. As such, its worth deleting it off our mesh, under it is a bake with normals of the rail so low gfx users can still see it, just not in 3D form and high gfx users shouldn't miss it from a distance


Now lets collapse these edges on the holes in our rifle to cut down on a few tris, although we can see it dosen't look quite as good a little cleaning up on the texture will make it look a little better thou not very necessary


And now we can collapse this 3D ejection port here to get rid of a few tris, dont forget to resmooth it


And we can collapse these edges on the butt of the rifle to get rid of a few more tris pretty easily


And that should be our LOD1 done at 158 tris which is 60tris off of our 1p model but still enough to make an impact since that's still over 1/4 the tri count off the 1p model



For our LOD2 model we can start off by cloning our LOD1 model as a copy and calling it "LOD2_3p_L85A2_Body".


And we can start off by deleting these faces, which then lets us remove the verts around it which in turn removes all the holes etc


And then we need to create new edges to ensure our polys are drawing correctly


Then we can remove all these edges on the butt with then allow us to remove these verts:


And now we can remove these edges and these verts, leaving us a flat butt although dont forget to resmooth it


and then we have a nice simple LOD2 model coming out at 36 tris, which is under 1/4 of the last lod


Also one more thing to note for your LOD2 mesh is that if your mesh has any Alpha, ENV or w/e materials on them (unless they are materials referring to anouther texture, although if you can, get rid of them as well), replace them with the main material so that you end up with the least amount of draw calls possible for your lod2, as any ENV reflection is not going to be seen in LOD2 and unless the alpha hole is huge where you can see sky though the other side, your not going to see it in your LOD2 as the mipmaps will close up all the small holes to a point where you can't see though them any more and as such, its just a wasted draw call that will put more pressure on the players CPU & GPU.


As for the texture, if we just delete the blur background behind our hole bits we can get a better finish on them, although not perfect I can't be asked to put more work into making a lod look better hehe.



Now we just need to do the same thing for all the other 3p components, making them all LOD1s and LOD2s but dont go over LOD2 unless you really need to but keep in mind you need to make all your big components LOD3s then and we will be making anouther final lod later on which I'll go into when the time comes.


And here is all my LODs now I'm finished

LOD0 Components: 5,858 tris



LOD1 Components: 3,921 tris



LOD2 Components: 1,044 tris





Step 9: Setting up the Components for Export

Now we have finished making all our components and there LODs, we need to start looking at getting them all exported with our rifles.

First thing we need to do is scale down our 3rd Person Weapon Models. Generally speaking, most 3rd person models are slightly smaller than there first person models. How ever some times the 1st and 3rd person models are excatly the same size, but most weapons are smaller to make them look right in 3rd person and in 1p so its best we keep to that. 3rd Person weapons are normally around 95% of the size of the 1st person model, but this value varies depending on the weapon itself. If your working with an existing export scene with both 1p and 3p models already setup (But not with the proper separate 3p models/textures like we are doing) measure the distance between two points on both the 1st and 3rd person models and then compare the size difference to work out the percentage difference of how much smaller the 3p model is. Note its important that you get it right since if you get it wrong, the existing animations wont match upto the your new models. If your working with a brand new model that has yet to be exported, its really down to trial and error to find out the right size, you would need to speak to [R-DEV]Chuc on more help on that if you can get hold of him although if you can't, I would suggest you save a backup of your scene and do a few test exports with the main basic components stuck together to form one main verity of your weapon and just do some trial and error until you find a good size. Once you have, note down the % size and revert back to your backup version.

For my SA80 series the 3rd person models are 93.66% the size of 1st person weapons.

Once you know the size difference between your 1p and 3p models, unhide all your 3p components and there LODs, select them all and then Group them up all into a single group, call it w/e you like I'm just going to call it the default name "Group01" as we are going to be grouping all these objects once we are done so the name isn't relevant.


Now that all our objects are grouped up, when we scale the group all the objects in the group will scale as if they where one single object around the group's pivot which is what we want. If we scaled each object on there own then they would all be scaled around there own pivot which would then lead to lots of complications unless all there pivots where in the same place.
But at the moment there is a small problem, as the pivot is in the very centre of all the objects and not in the centre of the scene/on our main model's pivot which where we want it.
Note: If I've not already said this before, your model should be centred to your scene so that the very centre of your 1p model is at 0,0,0 x,y,z location and all your 3p models for the moment should also be on top of it. If its not, make it so.
With your group selected, go to the Hierarchy tab and click on affect pivot only, then centre your group's pivot to the scene (0,0,0) / align it with the main component's pivot.


Once your pivot is in the right place, right click on the scale button to bring up the "Scale Transform Type-In" window and make sure your scale gizmo is in the centre of your scene and not in the centre of your group (sometimes its a little bitchy, if it dose just play around with the pivot, I had to undo and redo my pivot changes for the scale gizmo to realize it was different) and once it is, type in you scale value you worked out earlier (mines 93.66%) in the "Offset: World" box and then your X, Y and Z scales should all be changed to this value as well as your entire object made smaller around your pivot. Now if we unhide the 1p models quickly we should see the difference in size clearly


Once your 3p models are to the correct scale you can ungroup your group (by going to "Group > Ungroup", and hide your 1p models so they are all out the way) and then its time to arrange all our LODs.
Now I must admit, for exporting scenes I never do what I'm about to do which is to offset each LOD off the main model other than for handheld weapons. If its a vehicle, static object etc I always keep the LOD right on top of the main mesh as it makes working with a single vehicle much easier but since there are so many different variations of the same series of a hand weapon, it makes seance to do this but you should only do this once your models are final as any changes might get a little complicated.

Now lets start offsetting our models. Select all your 3rd person component models and all there LODs and then click the move tool, make sure your move type is View (and not Local or anything like that) and then click the "Absolute mode Transform Type-In" to turn it to "Offset Mode Transform Type-In" (ie, so its highlighted yellow and no longer a cross hair and two arrows off in two directions, like in the first pic) and then type in a value on the vertical axis (note which one it is, depending on your selected view it could be different from the Z axis like mine is) and type in a value to offset your model by a good mount from your model and make sure its some nice easy to remember round number so if you do forget it, its easy to find later on. For me I'm going to offset my models by a value of -5 units.


Once you have done that, select your LOD1 and LOD2 3p models (but not your LOD0 3p models, or the 1p models) and then do the same again, offsetting them by the same value as you did before. Then again select only your LOD2 3p meshes and offset them by the same value which will then leave you with 4 different groups of models, all one under the other in the order of there LODs, with your main 1p mesh in the centre. Also if you have any 3D Scopes in your scene then you will want to offset them above your main model by a + amount of the value you where offsetting your other models.



Now we have all our LODs nicely offset from each other so we can see each one clearly. But now its time to group all our different components and there LODs up so they are easy to work with.

First pick a component, I'm going to start with the ACOG since I like to work in alphabetical order and the ACOG is the first on the list. Select all the relevant ACOG meshes, the 1p model, 3p model + LODs and since the ACOG also has a 3D scope model, I'm going to select that as well. With all the relevant meshes selected, go to "Group > Group" and then call your group something like "Component_ACOG". (Don't give it a name of an already existing object like "1p_ACOG" or something as it will screw up the numbering system later which will make things very confusing if that happens.).


Some components, like the L22 ones you can group multiple types of components up together, as the M16A4 Very Grip, the L22 barrel and L22 base are all only used on the L22 variant and as such, its pretty pointless grouping them up separately (at least for this export scene, if this was the M16A4/M4 export scene then the Very Grip would need to be its own component as its used on many different variations with no base component). As such, I'm going to select all these 3 diffrent comoents and group them up into one group which I will call "Component_L22".


If a component has animated parts on it, like for example the AG36 animated moving parts which has the UGL barrel, leaf and a few other moving parts its a good idea that we get these sorta ready for export. Now if your working with a weapon that already has animations for it like I am, you need to make sure that all your parts are named correctly so that the existing animations work with the new models/export. As such, take a look at all the sub part component names and how they are all set up, then set your animated components up and name them in the same way. Changes are that they are all named by numbers which is the best way of doing it for reasons I wont go into as it could confuse you guys, but all the bits are probably animated from 1 to a end number of a maximum of 6 (I'm pretty sure that's the max amount of animated components anyways, might be wrong).

Now the chances are the 1p model is set up a little differently from the 3p model so check if there is any differences in the numbering of animated parts and if there is, your going to need to make a note of it.
For the AG36 the Parts are for the gemo0 (1st person meshes)
1 = Magazine
2 = Leaf
3 = Cocking Handle
4 = AG36 Barrel
5 = Grenade
6 = Grenade Casing (ie, what comes out before you reload a new nade in).
The LOD1: 1 bit is just the 3D scope's reticle which is seprate so the reticle can be animated separately from the scope.
gemo1 (3rd person meshes)
1 = Magazine
2 = Cocking Handle
3 = AG36 Trigger
4 = Leaf
5 = AG36 Barrel
As we can see, the order is totally different and as such, you need to set up your 3p models in a different numbering order from your 1p if you want the old animations to work on your new model/export.

If your not working with existing animations then you need to decide on the ordering of animated parts. I would recommend you start with the most common parts, like the Magazines, triggers, bolts/cocking leavers etc and then move onto the less common things like bi-pods etc. Remember that you want your most common animated parts to have the lowest number and the least common to have the highest, while also keeping in mind that some animated components will never be used together (like for my example, the L86 and AG36 animated parts will never be used together) and as such, you can use the same numbers on both.

Now we can't name our sub parts excatly what we want to right now as when we clone these objects, if they are named with a number on the end Max will change the number on the clone to a new number which will confuse things. As such, its best we just include the number of the part in the name somewhere, where its easy to see. As such, for my 1p models I'm going to put the number at the begging of the name but for my 3p meshes, since I dont want to screw up the LOD naming order I'm going to put the number just after the LOD number so its still easy to see but dosen't mess up the ordering. Once you have named all the bits, select them, go to your main view and click the "Select and Link" button in the top left hand corner and then select your parent mesh which in my case is the AG36 base model. Then if you select normal selection mode again, you will then be able to see your new hierarchy.




Same thing as above goes for the L85A2 body:


And once your done all your groups should look something like this


And if you open the Groups up (not ungroup) by going to "Groups > Open" you can see all the little bits nicely packed up in order






Step 10: Setting up the BF2 Exporter Script

efore you can go on to the next stage you need the BF2 Max Tools installed into 3DsMax9 (needs to be Max9, not Max 2009, not Max 2010, Max9, although Max8 (not Max 2008 ) is ok too but not as good as Max9) I would strongly advise you get the POE2 Max Tools as they are much better than the standard BF2 Max Tools, which I will be using in this tutorial and you can download them from here: PoE2 3dsMax Tools - Point of Existence Forum

When you have them installed (and 3DsMax restarted) go to BF2 > Export




The Export window will popup and in the top right hand corner of it will be a small button called "Run Setup", click that.


A new window will popup and in it, we need to define a bunch of settings. The output directory is to what modification all your exports get exported to, I would advise you to export to PR_EDIT but export to w/e mod you like, but export to the "bf2" or "pr" mod at your own risk. I have filled out in it: C:/Program Files (x86)/EA GAMES/Battlefield 2/mods/pr_edit/ Thou this will most likley be different on your PC since I'm on a 64bit system, hence the "Program Files (x86)" in the file path and you might have your BF2 installed onto a different hard drive than C: or in a different location. All in all, its best to just browse to the mod folder and select it by clicking the Browse button

In section 2 you need to list all the mods you might be using textures etc out of, so in my list I have:
Code:
/rawData/
/mods/bf2/
/mods/poe2/
/mods/pr/
/mods/pr_edit/
/mods/usidev/
/mods/eod_dev/
/mods/bfp2_edit/
Thou you can include as many mods as you like etc. The first 2 lines, /rawData/ and /mods/bf2/ are 100% critical, as well as a bunch of others if you are exporting to pr / pr_edit.

Your settings should look like this by then end:


Now your exporter is setup and everything should be good for exporting and with any luck you wont need to do this again, unless you reinstall etc





Step 11: Creating your Weapon Variants and Exporting them

Now that we have all our components and there LODs into separate groups we can now look at making all the different variations of our weapon series. As noted before in this tutorial, this is all the variations of the SA80 series I need to make.
  • L85A2 RIS ACOG
    • Bayonet
  • L85A2 RIS SUSAT
    • Bayonet
  • L85A2 SUSAT
    • Bayonet
  • L85A2 Irons
    • Bayonet
  • L85A2 ACOG with AG36 UGL
  • L85A2 Irons with AG36 UGL
  • L22A2 SUSAT
  • L86A2 SUSAT
  • L86A2 Irons

Now I'm going to start with the first one on the list, the "L85A2 RIS ACOG" and also its Bayonet version as well (best to do both the normal and bayonet versions in the same go). First we need to identify all the components the normal version (non bayonet version for now) uses. In all I can see it using the following components:
  • ACOG sight
  • L85A2 Barrel
  • L85A2 Body
  • L85A2 RIS

Select all the components you want to use and clone them as instances (you can clone them as copies but I like to keep everything as instances as if you update a component later, you dont need to update each one individually but having them as instances can present problems if you forget to make parts you want to change just for that version unique objects, its up to you which way you want to do this but I would recommend cloning them as instances) and then hide unselected and you should end up with something like this:


Now if there is a bayonet or any other sub type of this weapon I would recommend cloning all your components again (as instances) and then grouping all the new clones into a group called something along the lines of "L85A2 RIS ACOG Bayonet" like so.


Now with your bayonet group you have just made hidden, select all the component groups of this weapon variation and ungroup them and then it should look something like this:


Now we need to group up all our components of each LOD, leaving the animated, moving parts separate of course BUT first, before we can do this we need to make the main body component we are going to attach all the other components onto a unique object.
NOTE: This is very important you remember to make the body component a unique object before attaching other components to it otherwise the newly attached comments will affect the main base body component meaning you will need to revert to a backup when you make your next weapon variation.

The simplest way to make a group of instanced objects into unique objects is to select all the objects you want to make unique (in this case, the only one I want to make unique is the main body, all others should stay as instances so if any updates where done to the magazine for example, like add a 3D bullet to the top of the mag, it would do them to all the magazines on every weapon variation) and then right click and convert them into an edible poly again. This will basically collapse any modifiers the mesh had and will make it into a unique object again. The alternative is to select each component in turn and tell each one to be unique separately.


Once your main component you want to attach all the other components to is made into a unique object (check the "Editable Poly" in the top right in the modifier list isn't in italics, if it is then it is still a instanced object) you can then start attaching the components to them, one LOD at a time.
First select your 1st person, LOD0 main component and then click the little window next to the attach button called the "Attach List" button and select all the components you want to attach to it, click the attach button, an "Attach Options" window will pop up and make sure the "Match Material IDs to Material" and "Condense Material and IDs" and then press ok.
NOTE: Make sure you do not attach any animated, moving parts to the main component unless you do not want them animated/moving for this weapon variation.


And now it should look something like this once you have done, note I only have the main component selected and all the moving, animated parts are separate.


Do the same thing to all the LODs and then you should end up with something like this:


Once that's done its time to crate the Hierarchy so the weapon can be exported into the game. Select your 1st person main component (my one is called "1p_L85A2_Body01" and then go to "BF2 > Utilities" at the top of the screen, a new window called "PoE2 - Utilities" will pop up, in it will be a bunch of buttons. We want to click the "BundledMesh" button in the Wizards section, this will set up a basic starting Hierarchy for our export. Once you have pressed that button, close that utility window and if you press "h" you can see the basic layout of our export Hierarchy.


Now this Wizard clones the 1st person mesh to also be used as the 3p, LOD0 mesh so the first thing we need to do is select this mesh and then delete it, leaving just the "gemo1" and "lod0" bits of the "gemo1" (3rd person) part of the Hierarchy.


Now select your "root_" helper object and we want to rename the part after "root_bundledMesh_" to what we want the object's export name to be, which for this object is "gbrif_l85a2acog", which will make this helper's full name to "root_bundledMesh_gbrif_l85a2acog"


Now we need to add the 3D Scope to the "gemo0" (1st person) part of the Hierarchy. First thou we need to make a new "lod1" helper for it as 3D scopes etc are done via switching LODs in first person geometries, (on vehicles, different lods in the 1st person mesh can mean different cockpits, like for example on an APC, you might want two 1st person meshes, one for the driver and gunner with the outside view of the APC and you then might want anouther for the rear interior the passengers sit in, so the driver and gunner don't need to render the rear interior they can not see though there view ports, also the interior object will most likley have its own textures which the driver and gunner dont want to load if they can avoid it, which they wont be if they are in separate lods and the passengers dont want to render the outside of the APC they can not also see, so this increases performance for both parties.). Instead of crating a new helper from scratch, select the existing "lod0" helper and clone it as a copy and call it "lod1".


Now select your scope parent model and link it to the "lod1" helper we just made.



With the 3D scope done, time to move onto our 3p meshes. First lets attach our LOD0 3p mesh to the current "gemo1 > lod0" helper by selecting it, and then linking it to the "lod0" helper like so.


Now select the "lod0" helper under "gemo1" and clone it to form lods 1 and 2, and then link the the correct lods to the correct lod helpers, like so:



Which then should leave you with your Hierarchy looking something like this:


Now we need to rename all the parts so the exporter can read them correctly and know excatly what each bit is. First of all we want to name all the parents of every LOD "_GenericFireArm". This will tell the exporter that this is a handheld weapon its exporting and will set up the .con file accordingly (if you don't, you will need to update the .con file every time you export the weapon to tell its a "_GenericFireArm", if nothing is stated it will class it as a "_SimpleObject", like what staticobjects etc are classed as).


The next bit is to rename all the animated, moving parts to be just a single number for there name. Now if you remember back around the middle of this step we talked about this and gave each animated part a number, from 1 up, like the Magazine was "1", the trigger was "2" etc. All we need to do now is fully rename each object's name with that number we noted down in its name ("1_1p_L85A2_Magazine01", "2_1p_L85A2_Trigger01", etc), like so:


Do that for each and every LOD and once your finished your Hierarchy should look something like this:


Now our weapon variant should be set up for export so select any part of the Hierarchy and go to "BF2 > BF2 Exporter" at the top, a new "BF2 Exporter - Objects" window should pop up and there are a few things we need to set up here.
First of all we need to define the "Object's sub-folder path" which in our case should be "/weapons/handheld/".
Next in the Objects name which should already be defined since we set it up before and should read something along the lines of "gbrif_l85a2acog", if not, set it to something along thous lines (note, the name needs to be in lower case otherwise it can cause problems to Lunix servers etc).
Also make sure the "Prefix Sub-Paths During Export" box is checked and none of the others are, then you can hit the "Export Object" button and after a few seconds work, should export the files to the mod.


Now if we open up the Editor we can load up our rifle and if it its an existing weapon your replacing, should already have been mostly coded so you should be able to enter it and play around with it and check its animations are all working, like so (ignore that the holes aren't transparent on the RIS grip, its just a material problem )



Now this weapon variant may seem done, but trust me there is still a lot of work to do on it before it is well and truly finished but before we go ahead with finishing off this variant lets first set up our Bayonet version of this variant for export.
Unhide the "L85A2 RIS ACOG Bayonet" (or w/e you called it) group we made before and unhide all other objects just leaving our bayonet group. Then next ungroup this group, and the ungroup the groups inside this group.


Next we need to unhide the Bayonet component and then clone it as an instance, and then reselect the original bayonet and hide it again, leaving the one we just cloned (the 01 one) like so:



Next select your Bayonet component group and ungroup it, leaving all the separate LODs of each bayonet etc.


Now lets clean up the components for export. First lets delete the 3D scope since we dont need that for the bayonet version.


Next lets turn all our bases into Unique objects by converting them all into editable polys like so:


Then select your 1p main mesh and attach all the parts to it including the bits which would be animated on the normal version like the magazine, trigger etc as for the bayonet version they do not need to be animated as this weapon dosen't need to be reloaded, fired, etc but make sure not to attach the bayonet to the 1p model as that is animated. Also you will want to rename the Bayonet component to "1" as its the 1st (and only in this case) animated part.


Do the same for the 3p meshes except for them, attach the bayonet to the main mesh as that's not animated in 3p and you should end up with something like this:


Lets set up the Hierarchy. Like before select the parent 1p mesh and go to "BF2 > Utilities" and click on the BundledMesh in the Wizards section, then clone enough lods for the 3p mesh and attach the meshes to the correct lods, like so:


Then as before, name up all the parts correctly like so, naming the root object something along the lines of "root_bundledMesh_gbkni_l85a2acogbayonet"


Export it the same way as before and load it up ingame and it should all look good:



Now we need to just repeat the above for all the weapon variants, exporting each one as you go and checking in the editor for any errors etc, make sure you check there LODs too etc, (even I had to fix a few minor errors and I've had loads of experience of this) and when your done you should end up with something looking a bit like this






Step 12: Final LOD Creation (LOD3)

Right now we only have lods lod0, lod1 and lod2 for our 3rd person model but now we need to make a new final LODs which will be drawn right up to the maximum draw distance of our rifles so they need to be as simple as possible. These lods will basically be, double sided planes consisting of 4 tris and then will have each weapon variant baked on to them so we will basically be ending up with a 2D version of our rifle that will become our final LOD (lod3).

Lets start out by finding out the maximum size of all our components combined so unhide all your weapon variants and then drag out a plane around your 1p, lod0 meshes and make sure you set the Length and Width segments to 1.


Then convert it into an editable poly and then turn on vert snapping and select each side's verts and snap them to the furthest point out of all your components like so:



Now with vert snapping left on, drag a new plane over the top of your old plane and snap it to the corners like so:


Then increase the size of the new plane slightly to allow for some pixel bleed when we make the texture really small and giving it a roundish number while increase the width and height as evenly as you can with keeping a roundish number.


Now we know the size of our plane we need to work out how many variations of our weapon series we have, also including any other variations that may be made in the future. For the SA80 series we currently have 13 variations with possibly a few more being made in the future.

Now we know around about how many variations we need to make lod3 for we can work out the size of the lod3 atlas we need to make. For starters the width for an Assault Rifle and most other hand weapons should be with in 128 pixels and the height should be with in 64 pixels (with a possible few exceptions of course). A pistol for example would be much, much smaller, somewhere around 32x32 pixels. Now we know that the size of the plane is 9.7 x 4.2 units. Now some simple maths here, if we divide 128 by the width of our plane we can find out the pixel ratio, which in my case, 128 / 9.7 = 13.196. Now the pixel ratio (13.196) times by the height of the plane (4.2) will equal the pixel height of our plane on the texture. So 13.196 x 4.2 = 55.423.
So we know that our texture size for each side of our lod3 will be with in 128 x 55.423 pixels.
Now we know we have 13 variations + we need to have a few extra for possible ones in the futre (although not 100% nessary, if its the chocie between having a larger texture for possible future variants and having a smaller texture that will fit all your varients you have now just fine, go with the samlelr one unless you know for a fact your going to have more varients coming in quite soon. The atlas's size can easily be incrased and all the LODs re-UVed quite easily so it isn't to hard to change it later, just a little bit of extra work) and we also know the height of each side so to find out how big our texture needs to be we simply times the amount of weapon variants by the pixel height. 13 x 55.423 = 720.499. Now we can't have a 720.499 px image since that wouldn't work with BF2 since it requires its texture sizes to be a power of 2 (4, 8, 16, 32, 64, 128, etc). As such, we need to go with the next largest size closest to our value, which in our case, is 1024, which divided by our weapon variant pixel height (55.423) gives us space for 18.476 variants we can put into a texture of that height.
Now our true texture size will be double the width we have now since we need both the left and right sides of the rifle so the actual texture size is 256 x 1024 pixels and will be laid out something like this:


NOTE: There are lots of diffrent ways you can lay out your lod3 altas and it can even be slightly more optimized than what I'm doing here but I'm just trying to keep things simple here. Also the lod3 texture dosen't have to be on its own texture sheet, if possible its best to have it as part of the main 3p texture sheet with all the other components on it, which for something like a Pistol which dosen't have loads of variants would be a very good idea to have it as part of the main 3p sheet, tucked in the corner somewhere


Back to our lod3 mesh and now that we know the size of our lod3 texture atlas, go back to your plane and convert it into a edible poly and move its pivot into the centre of the scene (0,0,0)


Next rename the plane to something like "lod3_L01" with the L standing for Left, and move it to the left of your model by something like 1.5 units so its totally offset from your model, like so.


Next clone your plane as a copy and call it something like "lod3_R01" (with the R standing for Right) and move it to the right hand side of your weapon by the same amount of units (1.5) so you end up with a plane either side and then to your new Right plane, add the Normalize modifier on to it and make sure the "Flip Normals" button is checked (should be by default) as this will then flip your meshes faces to the opposite side they are on now, like so:


Collapse the normalize modifier on your right hand plane, select both of your L and R lod3 planes and then do a muliObjectUnwrap on them like we have done before in this tut.


Your UV window should look something like this to start off with.


Now first thing we should do is change our UV window to match the size of our texture sheet. Below your UV window click the Options button and it will expand out your UV editor window a little more and in the bottom left is a bit called "Bitmap Options" and in there, check the "Use Custom Bitmap Size" button and put in the size of your texture sheet you worked out above, in my case, 256 x 1024 and then you should have a better view of how your texture will look like so:


Lets sort out the width of our UV first. Go into your Grid and Snap settings (by right clicking on the snap button in the normal max window or go to ) and in the options tab set the Percent to 50 and turn on % snapping like so:


Now when you scale anything up or down, it will snap at 50% intervals. Scale your UV to the left from the top right hand corner while holding the shift key and with your scale snap on, it should snap directly to 1/2 the size it is now width wise, like so:


Now we want to separate out the two plane UVs so that the left hand plane UV is on the left side and the right hand plane UV is on the right side of the UV. Select your right hand plane UV (check in the view port) and then in the bottom left of the UV window there is that absolute and offset transform button, which is basiclaly the same as the one at the bottom centre of the normal window except this one only effects UVs. Click it (and once you click it, dont scroll with the mouse wheel, its a bit buggy and if you scroll in or out it will interpret that as an input offset and not as a normal zoom in or out) type in "0.5" into the "U" box, which will then offset your selected UV by .5 of the UVs width (50%) which will put it onto the other side of the UV like so. Once you have done that, make sure you unpush the offset button in the bottom left before you do anything else.


Now we need to work out how big each variant block is in relation to our UV map. We know from the calculations we did above that for the variant block pixel height I'm using of 55.423px and with the texture sheet height of 1024px, we have space for 18.476 variants (vertically). Now we need to work out how that translates to the UV sheet. Whatever the texture sheet size is, the UV sheets height and width is always 1. So to find out how much we need to move each block up we need to divide the UV height (1) by the total amount of variants we can fit onto the sheet, height wise (18.476). So 1 / 18.476 = 0.054
I like to work from the top down on my UV so to do that, we need to find out what are variant block height amount (which in my case is 0.054) from 1 is which in my case is 0.946 (1 - 0.054 = 0.946).

Now we know the variant block height in relation to our UV map, switch to the vert selection mode and select only the bottom verts of both the UVs, like so:


Now in the "type in transformation" bit at the bottom of the UV window, in the "V" bit type in your value for 1 - your variant block height, which in my case is 0.946


Go into the Grid and Snap settings and in the options tab, set the Percent snapping at 95%.


Go back to the UV window and select the Scale mode, then with % snapping turned on, scale each side down to 95% of its current size so there is a slight gap left between each UV and the edges, which will help to any avoid pixel bleeding



Now are LOD3 UVs are all set up correctly we can go back to our multiUnwrap window and click the "set UVs" button (Also check the convert to polys button at the bottom).



Now we have our main lod3 set up, lets select both the left and right meshes and clone them to form the next lod3 (02).


Do a multiunwrap on the new lod3 meshes and then select all the faces, check the button in the bottom left to turn it yellow to put it into "offset mode transform type in" and then type in a negative value of your varient UV height, which is my case is -0.054 and your UV will notch down just under where it was, then set the UVs (also check the convert to polys box, forgot to in my pic)



Continue cloning and shifting each new clone's UVs down by your variant height amount until you have all the variants you can possibly fit onto your sheet, in my case, 18 variants. Then if you do a multiUV on them all, you should see all the UVs nicely set out as we planned




Now we have all our final lods crated, save up your current scene and then we need to open up our "Baking" scene we made ages ago (my one was called "L85A2Export_Baking.max") which we set up earlier with all its materials and settings ready for baking. If not, you need to go back to Step 4, Materials and set up a new scene for baking again.

Once you have opened up your Baking scene, go to "File > Merge..." and select your main scene where you crated your final lod meshes in, and then select all your lod3s to be merged into your baking scene, like so:




Now with all our final lods in our baking scene, lets quickly review all our variants and lets give each one there own lod3 number, I'm going to keep it simple and just keep to the order I set out before.
NOTE: Make sure you note down what mesh uses what lod on a bit of paper or something, you will need to know for later)
  • L85A2 RIS ACOG - 01
    • Bayonet - 02
  • L85A2 RIS SUSAT - 03
    • Bayonet - 04
  • L85A2 SUSAT - 05
    • Bayonet - 06
  • L85A2 Irons - 07
    • Bayonet - 08
  • L85A2 ACOG with AG36 UGL - 09
  • L85A2 Irons with AG36 UGL - 10
  • L22A2 SUSAT - 11
  • L86A2 SUSAT - 12
  • L86A2 Irons - 13

I'm going to start from the top with the L85A2 RIS ACOG (01) variant. First thing to do is to hide all the 1p components other than the components needed for our variant, also hide all the lod3 meshes other than the "01" ones, like so:


Now select your "lod3_L01" mesh and like we did for the baking process, go to "Render > Render To Texture". You should review what we did back in Step 5, Baking for all the options etc you need to set up, with the only differences from before is when you "Pick" what objects you want to bake off, you should select all the 1p components that we are using unlike before where we just selected a single component at a time. The only other difference being that instead of giving your baked textures a 2048x2048 size, you need to give them a baking size that's relevant to your end sheet in the same ratio. I would also recommend that you bake these lod3 textures at a MUCH high resolution than your end result as its the only way to get any good quality textures out of these, so I'm going to bake my textures at 2048x8192 (where my final sheet size will be 256x1024 (which later I decided on 128x512, but still the same ratio so its all fine), so 8x as large, also note that your system might not have enough ram to bake that large of a texture, and even if you have enough ram, the 32bit version of max can only use so much ram so if your on a 64bit OS, might be worth baking the textures in a 64bit version of max which is perfectly fine and what I'm doing, just make sure you save the baking scene as a copy for the newer version of max to load, so you can still have an up to date scene to load with max9 if need be). Once you have done that, go back to your main mesh and in your cage options, just push the reset button and that's all you need to do for this cage, nothing more should be required. Then click the Render button, might take a bit to render at such a large texture and a bunch of complicated parts but it shouldn't take that long


Once you have done that, repeat exactly the same thing again just for the opposite side of your lod3 mesh.


Once you have done both the left and right sides, do the same for all the other variants, but instead using the relevant lod3 clone for the relevant variant
TIP: I've also just found out you can select both sides and pick each parts you need, then once you have done that for all of them you can then select all the lod3s and set up all the textures to bake for all of them in one go instead of doing them all one by one
But don't render all the lods together as the AO will get screwed up, casting shadows onto the parts you want from other meshes that aren't part of your variant.


I now have baked a total of 104 lod3 textures:


Its now time to compile all these textures together. Go back to "Step 6: Compiling your Baked Textures" and review what we did there and do exactly the same thing we did there with stacking all the textures into one file, but just apply it to the lod3 bakes
NOTE: In Step 6, stop just before you start make a blurred background and before you start saving the textures to the DDS format, or in other words, this part:
Quote:
Originally Posted by where to stop
Now from here it's really up to you to tidy up what needs to be done by hand on your textures, what needs to be done is very much up to what problems there is but here's a few things you can do to tidy up your textures.

For starters I always like to give a blurred background ......
Once you have all your layers loaded into photoshop and gone though Step 6 it should look something like this:
(I formatted my PC a bit before this point, why I'm now using Photoshop CS5 instead of CS3, but they are basically the same thing).


The next thing we need to do is to crated our Alpha layer, which we are going to crate from our diffuses map's transparency. First turn off your AO group and duplicate your Diffuse group and call it "Alpha" and then delete your brightness/contract adjustment in the Alpha Group like so:


Next select all the layers in the Alpha group and merge the layers into one layer


With your new merged layer selected, switch to the selection mode, then right click on your image and click on "load selection" and load the transparency channel of your selected layer.


Crate a new layer, select it and fill (ctrl + F5) the current selection with white (255,255,255) and then do an invert selection, and then fill that inverted selection with black (0,0,0) and then delete the old layer just leaving your new one like so.


Now save up your current .psd and back it up in a safe place, and then resize your image to what the final size is going to be (for me, 256x1024 {which later became 128x512, bust still the same ratio}).


Now I'm going to make Blurred backgrounds for each group (other than the alpha group) much like what we did before in Step 6:




NOTE: At this point after looking at my texture again I decided to make my texture size 128x512 instead of my previously stated, 256x1024.



Now its time to save our textures to DDS and you may want to review what we did again back in Step 6 as we are going to be doing exactly the same thing again, other than this time we are going to be saving our textures with NO MIPMAPs and also I'm going to save my "_b" texture as 64x256, but still having my "_c" texture at 128x512 just because the _b texture isn't as relevant to have the detail of the _c and as such, helps a little with the performance to have the "_b" 1/2 the size as the "_c".
(note: in the pic of the "_b" texture below, it dose have the spec in the alpha map I just have the alpha turned off in the view so the image aint 100% pink).




With the textures done, lets do the final touches to our export scene.
First select all your LODs and centre them to the scene by typing in 0,0,0 into the X,Y,Z Transformation Type-in box at the bottom, in Absolute mode (not offset).


Switch to "Offset Mode Transformation Type-in" and offset your lods by -20 units to put them 5 units below your lod2 meshes.


And then with all your lods selected, right click on the "Scale" button at the top and in the "Offset World" box, type in the same % you made your 3rd person meshes before from your 1p meshes (mine was 96.66%).


Set up a new material for your lod3s and call it something along the lines of "lod_3p_l85a2||alpha", and direct its colour and normal map textures to the ones you just made and then apply it to all your lod meshes


Now select all your lod2 helpers and all your lod2 meshes for all your weapon variants and clone them (dont worry about what name you clone them too we will fix that in a sec) and then hide unselected (so only your new clones are showing).


now select all your newly clone "lod" helpers (simplest way to select them all is to just type lod in at the top).


And with them selected, go to "Tools > Rename Objects...", then in the new window that pops up, check only the Base name box, and type in "lod3" into it then hit the Rename button and all your helpers will be renamed to lod3


next select all your "_GenericFireArm**" meshes and rename them to "_GenericFireArm" the same way we just did the lods.


Now with all our bits named correctly, select your very first lod3 mesh and then go into the face selection mode, select all the faces (Ctrl + A) and then hit the delete key to delete them all, leaving no faces at all.


Now select all the other models (with not selecting the one you just deleted all the faces off of) and then install and run the "Instance Replace" script (you will have to run the script manually by going "MAXScript > Run Script" and then selecting the "instance replace.ms" script or you can set it up on your menu bar like I have by going to customize, user interface and then plopping it in your menu).


A new window will pop up, click the "Pick_Master" button and select the "_GenericFireArm" you deleted all the faces off, then with all your other "_GenericFireArm" meshes selected, hit the "Make Instances" button and you will then end up with all your meshes having no tris/polys (may seem mad but what we want to ensure our lod has the correct scale etc set up as the rest of our meshes).



Now select all your lod3 "_GenericFireArm" meshes and apply your lod material to them:


With your all your lod3 "_GenericFireArm" meshes still selected, right click on your "Edible Poly" in your modifier tab and hit "Make Unique"


With that done, unhide all your "lod3_L/R**" Meshes and all your weapon variants:


Now select your one of your "lod3 > _GenericFireArm" meshes off one of your weapon variants (I'm going start at the top of the list and work my way down) and then I'm going to attach the relevant "lod3_L/R**" Meshes to it (which I have noted down from before, if you check back in the tut, you will see the L85A2 RIS with ACOG and Bayonet is "02" on the list, so I need to attach "lod3_L02" and "lod3_R02".



With your lod3 meshes attached to your "_GenericFireArm" mesh, go into vert selection mode, select all the verts and weld them up so you are just left with 4 Vetrs. Doing this how ever will screw up your smoothing groups so go into face selection mode, select all your faces and then do an auto smooth on them to fix them back up


Now to make 100% sure that the only material applied to this lod is the right one, reapply your lod material to the mesh:



Repeat that for all your weapon variants have there lod3 meshes attached to them.
By the end you should be left with a few "lod3_L/R**" Meshes which as of yet dont have any variants baked to them. Hide them away for later as in the future you might have a few more variants of this weapon that need to use these lods



When everything is set up, select one of your variants and go to "BF2 > BF2 Export" and if you want to export all your variants in one go, Check the "All Root Nodes" box above the "Export" button, this will then export every single weapon variant in this scene in one go, saving you from doing each one in turn



And now when we load it up in the editor and view our LOD3 on its own (by selecting it in the geom menu) we can see how it looks up close
Note: with your grid turned on the grid will show though your model, this is normal and wont happen ingame, just turn off your grid to view your LOD


And with that your final lods should be finished!





Step 13: Basic Coding

I'm only going to go into the basic coding in this tutorial which most coders miss since its not really there job, and leave the advanced coding like fire rates, projectile damages etc to the coders to do but in my case, since I'm already working with an existing rifle I already have all that "advanced coding", but the basic stuff like LOD switch distances, cull distances and effects still need some work, epically the LOD switch distances since I've made brand new 3p models / lods (and because they where never set up on the L85 series, perfect example of why you shouldn't leave this to the coders to do as it just wont get done since its not there job ).

I'm going to brake this section up into the following sub sections:
  • Crating your .tweak file
  • Removing the Collision Mesh
  • LOD Distances
  • Cull Distances
  • Effects
  • Final Notes
And yes I have pretty much copied the LOD/cull distances sections from my simple structure tutorial since the processes for statics and handheld weapons are the same.

NOTE: Do NOT at any stage save any changes with the BF2 Editor unless instructed to and if so, make sure you backup your .tweak as instructed! If you do save any changes with the BF2 Editor it will mess up a load of the code in your .tweak file! Always save any changes to your .tweak/.con files manually with a text editor like notepad, as instructed below. Only use the BF2 Editor as a preview tool for thous changes and with all the "Reload File Setting" boxes checked, any changes you make to a .tweak/.con (and even texture files etc) will be picked up by the editor and it will load them.


Crating your .tweak file

For this stage I'm going to be coding up the "gbrif_l85a2susatris" as my example weapon as this is a new weapon variant and as such, it doesn't start off with a .tweak file like this section is about. If your working on an existing weapon which is already coding, you can move onto the Cull Distances bit.

First thing we need to do is to crate our .tweak file and what I would recommend you do is find a weapon that's as close as possible to the weapon your making. For example, if your making a new pistol, I would copy the .tweak from a pistol that was as close to the one your doing, that fires the same, or close as possible bullet and works basically the same way. If there wasn't any other SA80s I could pick from I would probably pick an M16 to take my code from but since I already have other L85s already coded up, I'm going to pick gbrif_l85a2acog's .tweak file and paste it into my "gbrif_l85a2susatris" folder.


Now I need to rename the new tweak file to "gbrif_l85a2susatris.tweak" like so:


Open up your new "gbrif_l85a2susatris.tweak" file with your favourite text editor like notepad (I'm going to be using the Crimson Editor with BF2 Syntax files) and lets do a quick find and replace, with finding the old .tweaks name (gbrif_l85a2acog) and replacing it with its new name (gbrif_l85a2susatris) but watch what it replaces and make sure its nothing we need to keep like sound or animation paths (with the Chrmson editor, if you press "Find Next" instead of "Replace", you can go though each one it finds and tell it to replace it or not to replace, by pressing Y for Yes, N for No, S for Stop etc):



The only bit I didn't replace was an animation path, also note I did replace the paths for the selection icons, but that's because they will be made in the future and having the mod CTD because they are missing will just be a reminder that they need to be made if nothing else, only dont replace thous paths if the weapon is or at least looks exactly the same.


Once you have done that, make any other changes you need to make to make this .tweak work for your new rifle and then save it up and move onto the next step


Removing the Collision Mesh

If your working with PR v0.96 or above you will most likely be able to skip this next step as the tweak you just copied above or the .tweak you are working off which was already there will most likely already have the collision mesh removed as its something we are at the time I'm typing this tutorial (pre v0.96 release), planning on doing for v0.96 but you still may need to do this depending on which version your working of etc.

The main thing here is, we have decided to get rid of collision meshes off most of our handheld weapons as most don't use there col meshes. Its something that's left over from the beta versions of BF2 where when a player was killed, he would drop his weapon on the floor but since this doesn't happen in BF2, most of the weapons do not need col meshes. The only exceptions are weapons that are dropped on the ground, such as hand grenades, mines and parts of weapons that are dropped after reloading, such as the missile casing for the SRAW/Eryx. If your weapon is just a normal rifle/pistol or w/e that only stays in the players hands then you need to delete its ".collisionmesh" file (if it exists) from the "Meshes" folder and the following lines of code from the .con and .tweak files.
Note: the code may vary slightly but the same basic format.
.con
Code:
CollisionManager.createTemplate *object name*
Code:
ObjectTemplate.collisionMesh *object name*
ObjectTemplate.mapMaterial 0 *material name* 0
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
.tweak
Code:
ObjectTemplate.setCollisionMesh *object name*
ObjectTemplate.mapMaterial 0 *mat name* 0
ObjectTemplate.mapMaterial 1 *mat name* 0
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType Mesh



Once you have done that, save it up and move onto the next step


LOD Distances

This is one of the areas that is always forgotten about and its something that should also really be done by the Exporter since coders never get the the LOD distances and cull distances right, but you can't blame them since it shouldn't be there job either. As such, its really, really important that we get this bit right and then make sure it stays right.

NOTE: In this sub-section of the coding part I am using the "gbrif_l85a2acog" instead of the "gbrif_l85a2susatris" but this is just a small error on my part and since the two weapons are the same other than the scope, the distances LOD switching distances are the same for both. Also note in the coding part at the end of this sub-section I am doing the coding in the "gbrif_l85a2susatris" .tweak file.

First thing is to check out all your LODs and make sure there is no issue with any of them.
First of all in your recoures bar, scroll all the way down and you should see a "Geometry" tab, expand it and you will find a "geom" tab that you need to expand, followed by a "geom1" tab ("gemo0" is for the 1p models) which when you expand you will have a load of sub objects, each one being one of your LODs named from "lod_0" to your final lod w/e it may be (in my case, "lod_3").


As you select each one, you should notice the mesh in your viewport change and it show the LOD you have selected, as well as in your Object Info tool window it change its active lod to the one you have selected and its tri count go down to the tris of your lod, etc:


Checking my lods now and, lod0 looks fine at 1,712tris, lod1 looks good at 1,149, lod2 looks fine at 330tris and lod3 also looks good at 4 tris.
I would also like to note I did check the rest of my lods from all angle to make sure everything was ok and you should too with your model.



After you have checked each lod to make sure they all ok and fixed any issues, select the "geom_1" tab in the Resources window and if your right up close to your object it should now be showing you LOD0 again. If you also look down to your tweaker bar you will notice that near the bottom you have a bunch of settings called "LodDistance*" where the * is the LOD number, ie, if its 1 its lod1. To the right of these bits you will notice a value, these values are in meters and they basically define at what distance dose the engine switch the model to what lod. So right now with its default values, it switches to LOD1 at 50m, LOD2 at 100m and LOD3 at 150m. These values need to be changed, as right now, they are switching way to late, you can hardly see this weapon at 90m let alone showing lod3 beyond 150m.


With LODs you want them changing as fast as possible to the next LOD up, but visually you dont want the player to be able to notice the change and you also dont want the LOD change to happen to soon as it could inflict on gameplay was well, like the above. You also dont want the LOD to be changing too late as doing that will put unnecessary strain on the GFX card trying to render the object so you want it just at the right distance where your changing the lod as soon as you can, without being able to notice the change nor the change having a big impact on gameplay (although if you can't notice the change, its very unlikely there will be any impact on gameplay, although tbh its unlikely a handheld weapon's lod switch is going to have an impact on gameplay, this comment is more for statics, vehicles, etc).
Also one thing to note is these LOD distances dont include when your looking at a object though any optics like binoculars etc. When looking though Optics it will change to the best LOD suited for them based on the distances you define here so lets say if we set the LOD5 to 500m or something and the player was 600m away, if he looked at the shed though optics from 600m away, he would no longer be seeing lod5 but something like lod4 or even lod3 if the optics where very powerful. These distances are only for when the player is looking at a object though his own eyes, the engine will do all the optic work itself
Like with the Cull distance setting, its all trial and error to get this just right. Basically the way to do it is with one LOD at a time, starting with LOD1 and working your way up to the top until they are all good.
The way to do this is kinda like what we did with the cull distances with flying back and see where it stopped drawing, except here, we are flying back and forth and seeing if we can see any noticeable lod change and pushing the distance down as far as we can on each lod.

So make sure your "geom_1" tab is selected in your resources window so your not forcing any LOD to draw and the LODs are only going to draw at there set distances, and then fly back to just before your lod1 change so at the moment for me, lod1 changes at 50m so I'm going to fly back to 49m. Then I'm going to fly back past 50m and see if I can see any change. Also make sure that in your Object Info tool window that it says lod1 is drawing after you fly back past the distance, if it aint then you probaly dont have the "geom_1" tab selected in your resources window.


As we can see you can't see any change there which signifies the distance is either just right, or more likley that the distance could be lowered some what still (in fact, in this case it can be lowered drastically) so lets change the lod1 switch distance in the tweaker tab to 1m and see if we can see it then. Also when watching for changes, try and watch for bits you know are less detailed in the next lod from the last, like from lod0 to lod1, I know lod1 has a less rounded pistol grip so going to watch that bit, as well as some others.


With the lod1 switch distance at 1m I can just see quite clearly the lower poly pistol grip, as well as a few other bits so I'm going to up the amount to 5m to see how that works.


At 5m I can't see the lod0 to lod1 change, and after also testing some slightly lower values in the same way and also seeing some changes that, I'm so going to stick with 5m, then going to do the same for lod2, which I know its main differences are that its shell ejection port cover is missing, the trigger and its guard is missing and the model is generally has less detail. With it at its default switching distance of 100m for lod2 I can't see any changes so going to try 10m and see how that dose. 10m seems good so going to try 8m and see if that's any good. 8m seems a little too small so going to stick with 10m for LOD2


Did the others LODs in the same way and ended up with the following, which if your working on an assault rifle is what would be a good base to work off and probably what you should use:
LOD1: 5m
LOD2: 10m
LOD3: 20m

Once you have worked out all your LOD switching distances, make a note of them and then open up your weapons ".tweak" file again with a text editor and then we can manually put in our LOD switching distances. Your .tweak file will most likely not have its LOD switching distances defined so we need to add the lines of code for them etc. Each LOD switching distance is defined by this line of code:
Code:
GeometryTemplate.setSubGeometryLodDistance X Y Z
NOTE: The X, Y and Z at the end are representing numbers which define different functions.
"X" Stands for the Geometry type, where you can have up to 3 diffrent types of geometry. Gemo (Geometry) 0 being the "1st Person Model" in most cases, Gemo 1 being the "3rd Person Model" in most cases and Gemo 2 being the Wreck Model for vehicles. For a Handheld weapon you only have Gemo 0 and Gemo 1 (1st and 3rd person models) and no Gemo 2 (wreck model) since that isn't needed. If you recall you saw these Geoms in the Editor. Although note that these Geoms can mean and do different things depending on the object type and the objects coding.
"Y" Stands for the LOD number. Although this setting is a little bit more confusing than it seems since its not the LOD Number that it says it is in the editor. Instead its that number -1. So the distance you defined for LOD2 in the editor, would in this line of code be LOD "1".
"Z" Stands for the Distance in meters, which we worked out in the editor and noted down above.

Now we just need to work out our "X, Y & Z" from what we worked out in the editor.
Now for this weapon, all the "X" values are going to be "1" since we are only defining the LOD distances the Gemo 1, 3rd person models as the Gemo0, 1p models dont need lod distances defined, since they are always going to be the same distance from the player and the lods for Gemo 0 are only for the normal view and scoped in view and that's it.
Now for the "Y" values, we know they are the LOD numbers shown in the editor -1. As such, LOD1 = 0, LOD2 = 1, LOD3 = 2.
And for "Z", they are just the values we noted down so LOD1 = 5, LOD2 = 10, LOD3 = 20.

That all translates into the follow:
Code:
GeometryTemplate.setSubGeometryLodDistance 1 0 5
GeometryTemplate.setSubGeometryLodDistance 1 1 10
GeometryTemplate.setSubGeometryLodDistance 1 2 20
As such, we just need to paste that code in to the very top of our .tweak file just under the following line:
Code:
rem *** Generated with Bf2Editor.exe [created: 2005/4/4 13:40]
Like so:


Save that up and your that's all done. You can move onto the next section


Cull Distances

This is one of the areas most Exporters always miss and its something that should also really be done by the Exporter since coders never get the cull distances right, but can't blame them since it shouldn't be there job either. As such, its really important that we get this bit right and then make sure it stays right.

The first thing we need to do is define our objects Cull Distance. The Cull distance is basically the max distance from when an object stops drawing even if its in the players view distance. This is quite important since you dont want to be drawing something that is so far away and as such, so small, you can't even see it, but then again, you dont want to get its distance too low and having the model vanishing when it should be able to be still seen very easily. This will not only look like sh*t, but will also have a huge impact on game play, where for a building, a player may think he has a clear shot of anouther player, but in fact that other player is sitting behind an object that is between you and him. In terms of handheld weapons, its important gameplay wise for you to be able to see the other players weapon at a distance as not only will it look crap if the guy is holding nothing in his hands, but from a gameplay point of view, you want to know what weapon he has in his hands so you know what action you need to take to counter it.
As such, like I said its important we get this value just right, so it dosen't have an impact on gameplay but at the same time, you don't want your gfx card working on overdrive, drawing objects that are so small in your view since they are so far away, you can't even see them.
The size of the object is the thing that mostly determines how far your object needs to draw for, before being culled, so for a big apartment building, you will want that object drawing for a huge distance, something like 2kms but for a small sack of rice or something you would only want drawing for a few hindered meters or something. For a handheld weapon like ours, you will probably want it only drawing for something around 100m but big handheld weapons like AT, AA, MGs etc will probaly need to be drawn for longer ranges, and smaller handheld weapons like pistols, hand grenades etc for much smaller distances.

First thing we need to do is turn off the Fog so it dosen't obstruct our view, so go to "Render > Toggle Draw Fog" and make sure it hasn't got a tick by it, if it dose, click it and it should take the tick off (turning the fog off).


Next we need to turn off the "Draw Marker" and "Draw Grid" buttons, which are located in the Editor tab to the right and make sure the buttons are not pressed in, if they are, press them to turn them off.


One more thing we need to do is to bring up the "Object Info" Tool Window, by clicking the "[Object Info]" button at the bottom, middle of the screen and the toll window will pop up, giving you lots of very useful information like the current active LOD, The distance you are away from the very centre of the object (in meters), its Triangle Count (Says poly count but it is tri count), its Vertex count etc. This infomation in here is critical for us to get the cull and lod distances right


With all that off it should then look something like this up close:


Now fly back away from your object while still looking at it until it disappears from view. With the default cull radius scale (1), my rifle disappears at 79.6m away, first pic is 79.3m away and the 2nd is 79.6m away.


Now having our rifle disappear at 80m away is almost what we are looking for but if you look at the pic, its still quite a few pixels big by that time and on a higher rez screen it will be even bigger so we should have it drawing for a bit further and as such, we need to increase our cull distance. To do this, expand your default tab in the tweaker bar and you will see at the very top a setting called "CullRadiusScale" with its default setting of "1" next to it.


What we need to do is increase/decrease the value to the point where it draws the object to the distance we want it. Now for small objects like handheld weapons you need to increase the cull distance by quite a lot in order for it to have any affect so if we incease the cullradiusscale value up to 10, the shed now draws to 88meters which still isn't quite far enough, so we need to keep on turning it up to a point where its drawing far enough where we can still see it, but culling it when its no longer relevant, so its all about trial and error until we get it right


Next I tried a cull distance of 12 but this drew the object to 105m which was a little too far:


For this weapon, I found a CullRadiusScale of 10 seems about right, where it then draws for 139 meters before it gets culled and at that point, all it is is a little pixel on the screen and at 96m, you can hardly notice a difference since it was so small


Now we know our cull distance we need to manually put it into our .tweak file.
Open up your weapon's .tweak file with a text editor again and look for the line:
Code:
ObjectTemplate.cullRadiusScale
It should be somewhere near the top of the file, should be under "ObjectTemplate.castsDynamicShadow 1". If you can't find it, insert it into the file in the same place I have my one:


Once you have found that line, insert the value we worked out we needed in the BF2 editor for our cull distance. Since I found my cull distance needed to be "11", I will now put that in its place like so:


Save that up and move onto the next section


Effects

One thing that's sometimes forgotten about is to places the effects in the correct place. Effects like shell ejections, muzzle effects, etc.

Lets start off with the Shell Ejection Effect. First of all you should give your weapon the correct shell ejection effect in terms of what type of bullet your weapon fires. If your weapon fires a 5.56mm round, give it a 5.56 shell ejection effect. If it fires a 7.62mm round, a 7.62mm shell ejection effect. If it fires a 9mm round, a 9mm shell ejection effect etc.
Your weapon should already have a shell ejection effect in it if you look in its "addTemplates" bit, in my case, my rifle already has the correct shell ejection effect, the "e_shellejection_556" (5.56mm) effect


Which in the editor with the weapon loaded, if we scroll down to the bottom of the tweaker bar we can find it here and with it selected, and your "Draw Marker" turned on, your marker will then go to where it is like so:


We can see the shell ejection effect is in pretty much the right place already, which is no surprising since I'm working off the old L85 .tweak files but for your guys sake, encase your working on a totally new weapon that you copied the .tweak off an M16 for example and the shell ejection etc is in totally a different place, I will show you how to do this even thou I'm only going to be moving my shell ejection effect (and also my muzzle effect) very slightly.

First thing we need to do before we start editing anything is to backup our .tweak file like so:


The first thing we want to do is to replace our shell ejection effect with the shell ejection geometry so we can clearly see where the shell is in relation to our ejection port. But before we can do that we need to find out which shell ejection geometry our effect uses. It should be one of the following shell ejection geoms:
  • p_shell_25mm
  • p_shell_50cal
  • p_shell_smallarms
  • p_shell_30mm
  • p_shell_40mm
  • p_shell_9mm
  • p_shell_shotgun
  • p_shell_shotgun_buck
  • p_shell_smallarms_580
  • p_tube_at4
  • p_tube_m72
  • p_tube_pf89
  • p_tube_rpg26
  • no4clip
  • p_shell_556_casing
  • p_shell_762_casing
You can find out which one yours is using by expanding your shell ejection effect template, then expanding the sub "em_" template and you should find it in there, which in my case as you can see its the "p_shell_556_casing" shell geom:


Now we know which shell ejection geom our effect is using, we can now replace our effect with it to cleatly see where our shell ejection casing effect begins in relation to the ejection port. Opoen your .tweak file and replace your shell ejection effect, which in my case is called "e_shellejection_556" with the shell ejection geometry it uses, which in my case as we discovered above is the "p_shell_556_casing" shell ejection geom. So replace it and save it up like so:


When you save it your editor should pick up the .tweak file has been changed and will ask if you want to reload it, click yes (if it doesn't pick it up first time, save it again and again until it dose):


Now with Physics disabled (with them enabled the bullet will fall down into oblivion) you should now see your shell ejection geom like so:


Now I'm going to move mine very slightly a bit forwards since although its ok in its current place, it should be a little bit in front of where it is since if you think about it, when the shell ejection port opens, the handle will be right up against the back wall and as such, where it currently is the bullet wouldn't come out where it should be forward so I'm going to move it to where it should be by selecting it, then with "Draw Marker" on, moving it across on the axis until its in the right place (if you want to rotate the object, hold the shift key and the rotation gizmo will pop up):



Now before I save that up, lets quickly tweak the muzzle effect position. First thing we need to do is to establish what the effect looks like so if we load up the effect in the editor (your effect should be located somewhere in "/objects/effects/weapons/muzzleflashes/emitters/" and in my case its the "e_muzz_m4" effect, which I just double click on it to load it and the object editor should ask if you want to switch to the effect mode, click yes.
You should now see nothing but your marker (and possibly your grid, although I would turn off the grid, will make it easier to see the effect, need the marker thou) and the first thing we should do is change the colour of our editor background so we can see the effect much more clearly. On the right in the editor bar, scroll down until you see the Effect bit which should be expanded if your in the effect mode. In there there is a "Background Colour" section, click on the "Select Colour" button. A new Colour window should pop up, select black from tit and press ok and now your background should be totally black

Hit the Play button at the top of the effect bit in the editor bar and then it should play the effect like so:


We can see by the above pic that the effect is pretty much all directly in front of the marker so looking at the position of the effect on my L85, we need to move the effect way back as at the moment its playing quite far in front of the barrel. Although most people will never notice this, its still best to put it in the right place and makes sure that no major errors happen like the effect being 2m in front of the barrel


Select the effect and move it back to the correct point like so, although make sure you cross check your effect position against your 1p model as you dont want the effect to be playing way behind the barrel in 1p (which is the most important one):



Now with the shell ejection, muzzle and any other effects you may have in the correct place, save up your changes in the editor and make sure you only save it for the rifle your working on (if any other ones come up in the save window, uncheck the boxes so only the rifle you want to save is checked).



Now open up your backup .tweak in another tab/window and copy the new "ObjectTemplate.setPosition" values from your main .tweak file the editor saved to for all your effects into backup .tweak file, like so, also note what tab is selected in each screen:


Now select all the code in your backup .tweak file which has all the old code and the new position code for your effects, copy it then paste it over all the code in your normal .tweak file and save it up, which then effectively leaves us with a tweak file with all the same old code as before so not screwed up by the editor, but the new x,y,z values for our effects

Once you have saved the changes, the editor should have picked this up and will ask if you want to reload it, click yes and then we should have everything back as it was, with the new effect positions which if we select them we can check there positions


Now if we want to test our effects in the editor, there's a few ways to do this. The first is the "Input" method, which is first position your camera in "Free" mode where you want it to be, and then with your main window active (hit space bar while your mouse is over it) hit the fire button and you should see your effects play. Note the first pic is with Physics disabled, which you can see the shell ejection effect where it starts, and the 2nd is with physics enabled, where you can see the shell ejection effect flying in the air. Also take no notice of there being two shells that are ejected each time you fire, its an editor bug that happens in some views which is because there are two separate 1p and 3p shell ejection geoms in the same effect and your only meant to see one of them, but the editor some times shows both depending on your view state. Also note the bolt doesn't open and close in this mode, this is normal and providing your animations and export are set up correctly it should in other modes, and ingame.


The next way is if we hit the "Enter" button, we can see what the eject is like in the 1p view (you can sometimes see the shell ejection effect in 1p too)


As per this tutorial HERE you can view your weapon effects in 3rd person mode in the object editor while entering it by cycling though the 3p views via the c key (although you need your pr_edit set up to enable it first, as put that tut), like so and as we can see, the muzzel effect is in the right place as well as the shell ejection looks good, with the port even opening in this view, still got the double shell ejection but that's not a real problem.


Once your happy with all of that there is one last thing we need to do which is to delete our backup .tweak file for the weapon as with it in your mod folder, the bf2 editor will load it and will most likely screw up some shit so needs to be deleted, or at least moved outside of the mod.



Final Notes

With that all now done for the "gbrif_l85a2susatris" we need to repeat the same process for all the the other variants.
NOTE: Many bits like the effect positions, LODs and Cull distances you can copy and paste from one variant to another when the two variants are pretty much the same. Only real differences are for versions that are bigger or smaller or have some other feature that would mean they require different animations. For example, the L86, L85A2 with AG36 both have longer barrels than the normal L85, and the L22 has a shorter barrel so thous muzzle effect positions need to be changed, and the L86, AG36 and L22 will also need different LOD and cull distances. Also on top of that, the L85 with RIS and L85 with normal fore grip require two different sets of animations so its important none of this stuff is missed and you check all your working!
Also dont forget to apply your code to all the different versions of the same rifle, like the Smoke version of the UGL, the deployed version of the marksman rifle, the 6man version of the normal rifle etc. All very important items that you shouldn't miss!

Rhino is online now
Last edited by [R-DEV]Rhino; 2016-06-19 at 21:42..
Reply With Quote
Old 2012-06-25, 09:47   #2
[R-DEV]​Psyrus
PR:BF2 Developer
Default Re: [Weapon Tutorial] Seperating 1st and 3rd Person Models/Textures for Handheld Weap

Wow, what a tutorial! Top marks... My mind has kinda been blown

And I thought statics were hard to do
Psyrus is offline Reply With Quote
Old 2012-06-25, 10:30   #3
BroCop

BroCop's Avatar
Default Re: [Weapon Tutorial] Seperating 1st and 3rd Person Models/Textures for Handheld Weap

Rhino what you could do is use the CODE/SPOILER tags for each step.

That way my (and hopefully someone elses) mind doesnt blow up when opening this

Superb tutorial

BroCop is offline
Last edited by BroCop; 2012-06-25 at 10:39..
Reply With Quote
Old 2012-06-25, 11:29   #4
Sgt.Ayllon

Sgt.Ayllon's Avatar
Default Re: [Weapon Tutorial] Seperating 1st and 3rd Person Models/Textures for Handheld Weap

OMG amazing tutorial great work!!

Time to do the G36E, CETME, C90, C100....

sorry for my bad english
Sgt.Ayllon is offline Reply With Quote
Old 2012-07-05, 10:40   #5
ElPube
Default Re: [Weapon Tutorial] Seperating 1st and 3rd Person Models/Textures for Handheld Weap

A-MA-ZING tutorial, thx.

ElPube is offline Reply With Quote
Old 2012-07-05, 13:30   #6
sweedensniiperr
Supporting Member

sweedensniiperr's Avatar
Default Re: [Weapon Tutorial] Seperating 1st and 3rd Person Models/Textures for Handheld Weap

this...is scary.

sweedensniiperr is offline Reply With Quote
Old 2012-11-29, 09:12   #7
{ZW}C-LOKE
Supporting Member

{ZW}C-LOKE's Avatar
Default Re: [Weapon Tutorial] Seperating 1st and 3rd Person Models/Textures for Handheld Weap

I... I really don't know what to say here... This is top shelf knowledge right here! This will definitely come in useful, and I'll be testing this out as soon as I have that L4 Brent model done. Fantastic compilation!
{ZW}C-LOKE is offline Reply With Quote
Old 2014-09-04, 13:07   #8
Dasthan
Default Re: Separating 1st & 3rd Person Models/Textures for Handheld Weapons

Wow that's quite a lot of impressive stuff here. I feel like having another 3D course haha. But this is kinda way more advanced .
Dasthan is offline Reply With Quote
Reply


Tags
1st, 3rd, handheld, models or textures, person, separating, seperating, tutorial, weapon, weapons
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 23:54.