Jump to content
Official BF Editor Forums

Exporting A Tank


Recommended Posts

How to export a Tank to BF2 by XWW2[mschoeldgen]

Tools needed: 3DSMax 6 or above, BF2 Tools for 3DSMax Bf2 installation and the BF2 Editor.

I finally decided to write a tutorial about tanks. They use some special techniques not found on other models, so i will primarily focus these. The two techniques are 'AnimatedUV' and the usage of bones to make the track bounce over rough terrain.

I assume you have successfully exported one or two cars into BF2, so that you have a basic idea once i'm talking about hierachies, materials and collisionmeshes.

The tank used is the Cromwell, modelled and textured by our friend bobthemonkee for our BF1942 mod. Basically i port this model to BF2 by using the BF1942 vehicle importer, getting rid of all the BF1942 stuff and starting with a clean model. The texturing in BF1942 was different so i once again put all textures together in one auxiliary sheet and use a main texture, a wreck texture and my new auxiliary texture.This auxiliary texture carries the wheels and the track segments - something which will be interesting later on. I will need a number of special techniques, so my final material setup looks like this:

tankD.jpg

I have seperated collisionmaterials completely from the visible ones for clarity and for easier handling of the tank platings, which are important for realistic damage models. Although there are two bitmaps on collision materials atm, these are _only_ for helping me in the uvmap process, but not necessary for a successful export.

For the Cromwell it proved necessary to make new wheels as the old ones didn't have a center vertex. To ease the work , i prepared one new wheel with all collisionmeshes and the wheel bone:

tankA.jpg

In this view from the bottom you see the wheelmesh in brown, the nonvis_ dummy is green,col0 is pink and the col1 is yellow.Located in the center of the wheel is the blue bone, which is a 'pyramid' primitive. Create a first hierarchy as shown in the select window, reset 'Transform' and align the pivots to world plus center them on their objects. After that, i cloned this wheel by using the 'Clone with childs(copy)' function from the BF2 Utilities, moved them to the new position and renamed wheels and their according bones. I then created a small box mesh for the engine , put it in the center of the tank and parented all my wheels under it. The two frontmost wheels (whlr1 and whll1) are RotationalBundles, the rearmost wheels are Springs, but without collisionmeshes.

tankB.jpg

As the old tracks were unusable, i then created a new track with D_Fast's unsurpassed lofting method. Get the details here: http://bfeditor.org/forums/index.php?showtopic=1101

When creating the loft , make sure to check 'Apply Mapping' and select a length repeat of 8 to 16, it will come in handy later. Uncheck 'Cap Start' and 'CapEnd' as described in the tutorial and don't forget to set 'Path Steps' and 'Shape Steps' to zero to get a low-poly track.

tankC.jpg

Note how the repetition appears on the track. We will later have to split the segments of the track to uvmap them , but we can now simplify that task considerably. Now i convert my loft to an editable mesh and (if not done already) applied my tank material to the new track. I set all faces of it to the ID of the visible track material (3 in my setup). Ok, now lets do a first rough adjustments of the track's uvmap. Select all faces of the track and apply a 'Unwrap UVW' modifier on top of your track. Press the 'Edit' button in its rollout to bring up the UV Editor. Now the diffuse maps in the collisionmeshes show up in the small popup menu on the topright. Selecting my track texture underlays it in the editor window:

tankE.jpg

Hmm, the uvmap is rotated and much too large. Using the freeform tool, i brought the first track segment onto the track texture, with spare segments on the texture to the left and right of the uvmap face:

tankF.jpg

tankG.jpg

Do this as exactly as possible, the segments should all be tilable. Once you have exactly fitted the first part, its easy to fit the rest of the uv segments. To get the basic idea of scale , watch the viewport in the background. Although the tiles are not yet connected, by looking at the first segment you get the feeling for the right size of the track. When satisfied, collapse the unwrap modifer on the mesh.You will notice that only one side of the track has the track texture, select the other faces and again add an 'unwrap UVW' modifier. Edit the uv by dragging it onto the top texture. My tank has the same texture for below and above the track, but yours maybe different. Do the same for the sides of the track.

Now i need to select each segment and fit it to the start of the track tile with its uvmap:

tankH.jpg

Walk your way around the track and repeat that for all segments. Each UV segment should have its start exactly fitting to the end of the former one and so on. The better your seams are, the better the track will look when moving. If you have created a teeth loft, apply the same length repeat to it as you did for the track loft and handle it the same way as you did with the track. You should end up with an evenly tilable track without seams between the segments:

tankI.jpg

Fortunately the Cromwell allows simple cloning and mirroring of the track for the other side. Attach both tracks to the main body (the PCO) of the tank. Before we can try an initial export, everything needs to be in the right hierarchy. Refer to the hierarchy help in this forum to get it right. This tank has a hullgunner position with a rotating front MG. I will later add a coaxial MG with the BF2 Editor to this RB. The main gun is the GenericFireArm, this will also be the recoiling mesh:

tankJ.jpg

Ok, an initial export tells us if we have missing materials, rotated pivots or any undesired effects. If there's no export at all, clear your high map channels (all above number 1) and retry. The distance values in the generated .con file are in meters, so we can see if the scale is good:

GeometryTemplate.create BundledMesh cromwell
CollisionManager.createTemplate cromwell

ObjectTemplate.create PlayerControlObject cromwell
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.creator BobTheMonkee:mscho
ObjectTemplate.collisionMesh cromwell
ObjectTemplate.mapMaterial 0 armor_3_tanksides 0
ObjectTemplate.mapMaterial 1 tank_front 0
ObjectTemplate.mapMaterial 2 Rear_armor 0
ObjectTemplate.mapMaterial 3 tank_tracks 0
ObjectTemplate.mapMaterial 4 wreck_material 0
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometry cromwell
ObjectTemplate.addTemplate Cromwell_ctower
ObjectTemplate.setPosition 0/0/0.2961
ObjectTemplate.addTemplate cromwell_hullgunner
ObjectTemplate.setPosition -0.2726/-0.2131/1.5369
ObjectTemplate.addTemplate cromwell_motor
ObjectTemplate.setPosition -0.0010/-0.8503/0.0123

ObjectTemplate.create RotationalBundle Cromwell_ctower
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 1
ObjectTemplate.addTemplate Cromwell_gunBase
ObjectTemplate.setPosition 0/0.2877/0.8048

ObjectTemplate.create RotationalBundle Cromwell_gunBase
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 2
ObjectTemplate.addTemplate Cromwell_barrel
ObjectTemplate.setPosition 0/-0.2877/-1.1010

ObjectTemplate.create GenericFireArm Cromwell_barrel
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 3

ObjectTemplate.create PlayerControlObject cromwell_hullgunner
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 4
ObjectTemplate.addTemplate Cromwell_hull_mg
ObjectTemplate.setPosition 0/0.0106/0.2923

ObjectTemplate.create RotationalBundle Cromwell_hull_mg
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 5

ObjectTemplate.create Engine cromwell_motor
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 6
ObjectTemplate.addTemplate Cromwell_whll1
ObjectTemplate.setPosition -1.3237/0.0936/2.5623
ObjectTemplate.addTemplate cromwell_whll2
ObjectTemplate.setPosition -1.2981/-0.3532/1.6803
ObjectTemplate.addTemplate cromwell_whll3
ObjectTemplate.setPosition -1.2981/-0.3532/0.6709
ObjectTemplate.addTemplate cromwell_whll4
ObjectTemplate.setPosition -1.2981/-0.3532/-0.3175
ObjectTemplate.addTemplate cromwell_whll5
ObjectTemplate.setPosition -1.2981/-0.3532/-1.3040
ObjectTemplate.addTemplate cromwell_whll6
ObjectTemplate.setPosition -1.2981/-0.3532/-2.3178
ObjectTemplate.addTemplate Cromwell_whll7
ObjectTemplate.setPosition -1.2153/0.0936/-3.0630
ObjectTemplate.addTemplate Cromwell_whlr1
ObjectTemplate.setPosition 1.2866/0.0936/2.4993
ObjectTemplate.addTemplate cromwell_whlr2
ObjectTemplate.setPosition 1.2904/-0.3532/1.6854
ObjectTemplate.addTemplate cromwell_whlr3
ObjectTemplate.setPosition 1.2904/-0.3532/0.6643
ObjectTemplate.addTemplate cromwell_whlr4
ObjectTemplate.setPosition 1.2904/-0.3532/-0.3153
ObjectTemplate.addTemplate cromwell_whlr5
ObjectTemplate.setPosition 1.2904/-0.3532/-1.2974
ObjectTemplate.addTemplate cromwell_whlr6
ObjectTemplate.setPosition 1.2904/-0.3532/-2.3188
ObjectTemplate.addTemplate Cromwell_whlr7
ObjectTemplate.setPosition 1.1936/0.0936/-3.0630

ObjectTemplate.create RotationalBundle Cromwell_whll1
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 7

ObjectTemplate.create Spring cromwell_whll2
ObjectTemplate.collisionPart 8
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 8

ObjectTemplate.create Spring cromwell_whll3
ObjectTemplate.collisionPart 9
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 9

ObjectTemplate.create Spring cromwell_whll4
ObjectTemplate.collisionPart 10
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 10

ObjectTemplate.create Spring cromwell_whll5
ObjectTemplate.collisionPart 11
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 11

ObjectTemplate.create Spring cromwell_whll6
ObjectTemplate.collisionPart 12
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 12

ObjectTemplate.create Spring Cromwell_whll7
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 13

ObjectTemplate.create RotationalBundle Cromwell_whlr1
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 14

ObjectTemplate.create Spring cromwell_whlr2
ObjectTemplate.collisionPart 15
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 15

ObjectTemplate.create Spring cromwell_whlr3
ObjectTemplate.collisionPart 16
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 16

ObjectTemplate.create Spring cromwell_whlr4
ObjectTemplate.collisionPart 17
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 17

ObjectTemplate.create Spring cromwell_whlr5
ObjectTemplate.collisionPart 18
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 18

ObjectTemplate.create Spring cromwell_whlr6
ObjectTemplate.collisionPart 19
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 19

ObjectTemplate.create Spring Cromwell_whlr7
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.geometryPart 20

include cromwell.tweak

If you find a material called UNDEFINED , there's an error in assigned materials or face ID's. Fix them before going on. From now on, i will provide some basic .tweak file, to ease the task of coding the UV animation. So maybe its good to spend some time in the editor now to get the basic vehicle working by setting up the materials, the engine, the springs and the rotationalbundles. Make sure to check 'Rotate UV' for all springs in their code and give them some strength and damping. The four outmost wheels should be given a networkable 'SpringInfo'. Use an existing tank .tweak file as template to get other values right. Later on,when we are focussing on the UV Animation good physics are a nice base to start from. Don't forget to fill in the mass of the tank.

In case you get a lot of editor errors like '... has starving streams in shader bmhasanimateduvhas... ' , you have a missing UVAnimated texture in one of your geom0 or geom1 meshes. Note that although you probably have no UVAnimation in the cockpit ( geom0 ) model, you have to assign an UV-animated texture to at least a single face in it. In my material setup, i have simply assigned AnimatedUV techniques to all my shaders. It doesn't hurt and you won't encounter the above errors. Unfortunately, the BF2 engine has a problem where several alpha'd textures intersect. The tank will suffer from it, but lets think about a solution laters :P

Now setup the basic tank . Probably you have a lot of wheels, so don't overdo the strength on each of them. For a 24 ton tank , i used a strength of 30 on the edge wheels and a lower value for the others. For damping, a value of 4 to 10 is mostly good. If the wheels start to bounce , lower damping again.

You will have noticed a few things: If everything went right, your wheels seem to bounce with the ground , but the tracks stay in place , looking unnatural. The bones i mentioned in the beginning will be bound to the track vertices (' weighting' the vertex ). We will have to add this feature. The other thing is the wheels not rotating (if you already checked 'RotateUV' in each of them, which you should do ) and the track stays in place. A lot of this will be done in code, but for the moment we will need to implement it on the model first. Save your tank to get a first .tweak file, then quit the editor. ( Sometimes its possible to run both applications at once, but sometimes not... ) O.k., lets fire up 3DS and load the model again. The step to animate the tracks is the most easy one. Hide everything except the PCO from geom1 . This should be your main tank model with the tracks. Now use element selection and select both tracks and (if applicable) the teeth elements. From the BF2 menu, choose the 'BF2 Utilities' and run the 'Tank Wheels/Treads' wizard . In the wizard window , press 'Setup Treads' . Thats all thanks to Rexman :P If you press 'Display vertex colors' in the window, your tank body in the viewport should go pitch black, while the tracks glow in red. A closer look shows the right track to be a little brighter than the left. Btw, the upper part of the tank wizard you normally never use. This is for direct setting of vertex colors, something which the other functions take over for you. The only other buttons we will use are in the 'Wheels' division.

tankK.jpg

O.k., lets close the Wizard for now and do a test export. Its best to test an export after each setting of vertex colors as the exporter checks for invalid color combinations and yields errors. If you encounter a 'TBM' error, its probably because you either assigned too many or to less of vertex colors. The only way to correct that is to start over, so its best to check after each item. If you encounter this error, clear the vc channel of your mesh and run the wizard again. Clearing the vc channel can be done by adding a 'UVMapping Clear' modifier on the mesh, set its channel to 0 ( zero ) and collapse it on the mesh. A test export shows if it helped.

Lets start coloring the wheels. Go to the first wheel, select the mesh and run the tank wizard. Press the 'Guess' button in the Wheels section and note the vertex number. go to vertex selection in the wheel mesh and select the suggested vertex. If the wizard is unable to find a center vertex, you have either used a cylinder without center vertices ( I'm sorry, these are unusable , you will have to model new ones ) or the wizard is confused. Select the center vertex and press 'Set Center' in the wizard. Note that this is not done automatically by 'Guess', you will have to press 'Set Center' in any case.

tankL.jpg

Go to face selection mode and now select all faces on one side of the wheel touching the center . If you have faces on the sides not touching the center, don't select them now.

tankM.jpg

When you have selected all faces press 'Set Rotate' in the wizard. Switching on vertex colors show one side of the wheel now in either a dark red or a dark green. Go to the other side and again select all faces touching the center and press 'Set Rotate' . Your wheel should now glow in green on one and in red on the other side. Of course this is very dependent on your wheel texture which adds to the vertex colors.

tankN.jpg

To finish this wheel , select all other faces. For my wheels, this is only the outer rim, but your wheel maybe different. Once you have them all press 'Set Translate' in the wizard. Note how cyan and magenta colors are added.

tankO.jpg

To test if everything went right, do an export. If an error pops up, you either have missed a face, didn't set a center or otherwise violated the rules. Try a different appoach after clearing out the VC's. All that is left to do to make the wheels rotate is to repeat that procedure on each wheel now.This is how my wheels look after coloring them all:

tankP.jpg

As a final test for the colors do an export.

Now we need to make the track bounce with the wheels. For this purpose we have the bones (pyramids) in each wheel. The task now is to weight the appropriate verttices of the tracks to the bones.If you followed D_Fast's tutorial, you should have track vertices next to each wheel. Lets now add a Skin modifier to the main PCO in geom1 (which is your main tank body with the tracks). Add all the bones to it and set the 'Bone Affection Limit' in the advanced Parameters for the Skin modifier to 1. Tanks allow only one bone affecting each vertex, in contrary to skinnedMeshes , where 2 bones are allowed. Now select the first bone in the modifier rollout, press 'Edit Envelope', uncheck 'Cross sections' and 'Envelopes' but check 'Vertices'. I will use the Weight table to set the weigthing , but you could perhaps use 'Envelopes' as well. Lets go the Weighttable way for now :P Press the 'Weight Table' button down in the rollout and set the weighttable to 'Selected Vertices', done in the lowerleft of the weight table. In the rear viewport select all vertices which will be affected by this particular bone. In this screenshot, i'm working on the front left wheel and therefore i selected the vertices of the track in the vicinity of this wheel:

tankQ.jpg

To simultaneously set weighting on this group of vertices, i choose 'Select All' from the 'Edit' menu in the weight table window. Now i enter a 1 (followed by a <TAB> to leave the field) into the first cell, it will be inherited into all other cells in this column:

tankR.jpg

(I have hidden the main body elements of the body and only left the tracks visible, that makes it easier to catch the right vertices). O.k., when finished with the first bone just select the next bone in the weight table (press its name on top of the column) and select the vertices for it. Enter a '1' into the cells and continue with the next bone:

tankS.jpg

When finished with the last bone, keep in mind to not collapse the 'Skin Modifier' , you would loose your work. If you later create a lod1 and want to have bones in it, you have to collapse it on the lod1 and above, but leave it uncollapsed on lod0. A final export should give you the desired model. Note that there is a very minor bug in the exporter, you shouldn't have the Skin modifier selected when exporting, sometimes the weighting colors of the vertices interfere with the vertex colors used for UV animation, yielding errors. Just select a different part of the tank to successfully export the thing.

Now lets proceed to the Editor and code in the UV Animation. We won't need any specials to make the bones work, they do their job independently of any code. We now need to set the translation of the tracks with some index and get the scale right. The index tells us if its the left or right side of the track, where index 5 stands for the right track and index 6 for the left track. The only parts affected by the engine are the wheels, this is our chance to hook the animation into the tracks. Select a left-side wheel (i used the first one on the left side) and open the 'Animation' part in its tweaker window. We want to check 'AnimatedUVTranslation', as tracks always translate.The first thing to set in this tweaker is the 'AnimatedUVTranslationIndex' to 6 (for the left track). The following parameters are dependent on the orientation of the track texture. If its horizontal like in my tank, the first parameters (they are always X/Y) are to be set for X-movement, when your texture has it vertically, use the second parameter for Y - movement. Lets walk through the parameters :P The 'AnimatedUVTranslationSpeed' adds a continous movement to the track, we should leave that at zero. Next is 'AnimatedUVTranslationSize', this parameter sets the relation of ground-to-track speed. Enable physics and give some throttle. Adjust either X-Size or Y-Size (see above) to a believable value. The track should not move in relation to the terrain. The higher the value, the slower the track will move. Before you set this finally, first walk to the 'AnimatedUVTranslationMax' Parameter. This value can be calculated by the following formula : (pixelwidth of a single chain link)/(total texture width). E.g. if your texture is 1024 pixels wide and a single track piece is 32 pixels, you would enter 0.03125 for 'AnimatedUVTranslationMax'. This makes the track jump back exactly one segment when rolled to give the impression of a continous movement. Now you know why you had to uvmap your track with spare pieces to the left and right. These segments will be dragged into vision by the UV Animation. If your track moves the wrong way around, check the 'AnimatedUVTranslationReverse' box. Leave the 'AnimatedUVRotation' at zero for this wheel as tracks have no rotation.

tankT.jpg

Go to the other side of the tank and enter the same values in a right-wheel tweaker, except you should enter a 5 for the 'AnimatedUVTranslationIndex' on the right side. Now we need to make the wheels rotate. This is done in a single wheel for each side and will affect all wheels of this side. For wheels we need both translation and rotation. Select a single wheel on the left side, choosing another wheel than before. Set the 'AnimatedUVTranslationIndex' to 2 (for left wheel translation) and adjust movements of the translated wheel parts, like the outer rim. Apply the same rules as we did for the translation of the tracks for a natural movement. It would look bad if the rim rotates much faster or slower than the hub. In the same tweaker set 'AnimatedUVRotationIndex' to 1 (left wheel rotation). The 'AnimatedUVRotationRadius' determines the rotation speed of the wheel, i used 0.4 for it on my tank as the wheels just have that radius. In case the wheel rotates the wrong way around, check 'AnimatedUVRotationReverse'. 'AnimatedUVRotationScale' is normally set to 1/1. You only have to change that value if your texture is a non-square format, like 2048*1024. In that case you would enter '1/0.5' into that parameter to counteract elliptical deformation of the uvmap. The last three parameters are used for additional rotation effects only, leave them empty for the standard wheels.

tankU.jpg

Go to the other side of the tank and repeat setting the parameters. For the right side wheels , use 3 for the RotationIndex and 4 for the TranslationIndex. Here's the complete Index table:

1 - Left wheel rotation

2 - Left wheel translation

3 - Right wheel rotation

4 - Right wheel translation

5 - Right track translation

6 - Left track translation

We are rapidly approaching the end of this tutorial. As a final test lets pack the mod and put the tank into a testmap :P I prefer to use the debugger for the first tests to make sure i have not forget an obvious (or not so obvious) thing. That doesn't look too bad, does it ?

tankV.jpg

Known bugs and limitations: The BF2 engine seems to have a problem with the left side of rotating AnimatedUV's. If the gloss for them is set to more than zero (black in the gloss map) , the wheels start to flicker in sunlight. Solution: Provide a fully black gloss for the wheels. Idk if BF2142 suffers from the same problem.

No BundledMesh should have more than 26 geometry parts (meshes) in BF2. This includes only meshes. Point helpers, dummies and collisionmeshes don't count here. The .con file generated by the export shouldn't have more than 26 parts. Considering a normal walker in BF2142 already made out of 56 parts (or more) this limit has been virtually removed for BF2142.

Have fun!

Thanks go to all the people who helped to reveal the how's and to's and to Rexman, who coded the tools : D_FAST, BEEX, icemagician, Koricus,ctz and Panzaman.

Thanks to our modellers providing so much material to test it all: geledonut, bobthemonkee, TuuT, DemonDelta and last but not least Beppe.

Edited by mschoeldgen[Xww2]
Link to comment
Share on other sites

nice work misch!,its about bloody time someone made this tutorial.

dont forget to add that there is a limit to mesh parts in the hierachy 26 meshparts...dummies and cols are not included,too many parts may/will cause the editor to crash and wierd things will go on ingame.

wierd things like the hull being attatched to a player,at the same time the tracks can be attatched to another vehicle in view ,the turret being attatched to another vehicle in view and even the tracks stretching halfway across the map to another vehicle in view,all that at 1 time...lmao...very funny stuff.

tankstoomanypartsql6.th.jpg

basicly what is happening there is too many mesh parts are causing the tanks parts to randomly attatch to any pco's (player controlled objects) in view and at certain distances away from the screwed up tank.

Edited by BEEX
Link to comment
Share on other sites

Lol, BEEX if something like that would have happen to me in my early times, i'd probably given up on it , hehehe. It looks a bit - well - confusing ?

What i wanted to explain in depth are mainly the UV animation stuff and the bones thingies. Exceeding the geometry limit wasn't on my list - but if you think it important, i'll add a few comments about it :D

Link to comment
Share on other sites

Very good tutorial msch, finally somebody put all the pieces together, and more! B)

One tip someone may consider usefull (Atleast I do):

if you change the animatedUV values in the debugger rather than doing it in the editor, the changed will have effect immediatly. I just placed the chase values of the camera right besides a track (using chaseoffset and chasedistance, I guess thats something that can be one in the editor) and then went from the console. It a bit more typing but when it comes to the editor and having to use input on vehicles I always get in trouble, ingame everything works just like I want to. If you want to save your changes type "objecttemplate.save [NAMEOFVEHICLE]", itll either overwrite or create a con file that looks much like a tweakfile of the editor in the objects folder (outside the zip file) (if you want the game to load a con file rahter than a zip file, type "run Objects/vehicles/whatever.con" in the gamelogicinit.con file, this is the same con file that will get overwritten, so be carefull to make backups).

Link to comment
Share on other sites

Thanks Harry, but isn't that too complicated ? The later editors can display the UVAnimation in the editor and changing the values have an immediate effect there, too. I know the first closed beta editor didn't animate the UV's (this bug costed me days :( ) but newer ones work in that regard.

Link to comment
Share on other sites

I have a few questions:

1. Wheel vertex coloring - You mentioned that only the faces attached to the the intended center vertex should be selected, but to leave the same-side, non-vertex-touching faces to the translation. This is somewhat confusing. I have a wheel with a recessed center hub on the outer side; the geometry design is very similar to the M1A2's ground wheels. I am thinking that if I set those 'rim' faces to translate, then I would need to UVunwrap the rim portions of the outer side similar to the rolling side of the wheel? AND if I did that, then any detail on those faces would lose its 'roundness' and look more polygonal, which I don't see happening on any of the BF2 treaded craft.

2. Collapsing lod1 - If I did this, would I use the same bones that lod0 uses? I saw in another thread where a guy had a great-looking "Light Tank" (he had used a colored UV map as a texture), but he seemed to have new bones for lod1 with the same name as the bones in lod0. I tried it like this, but I got export errors. It finally exported (without animated textures) when I made all the bone names unique. So, maybe the answer to this question would help clear this up.

3. Is it possible to make the wheels bounce from an offset pivot, rather than like a spring? In other words, it would be more like a rotation, rather than a sliding. If so, then it would be possible to make the suspension struts bounce, but without stretching and deforming.

Link to comment
Share on other sites

1. You're right about the rim's uvmapping. Translation always means a linear motion on the texture, rotation will rotate the uv's around the center vertex' uv coordinates.

I think you should give it a try by applying 'rotate' even to the rim sections around the hub. If the exporter finds a 'TBM' error, the center vertex is too far away from the uvmap and you have to unfold the rim texture to a linear texture and use 'translate' .

2. I'd give the bones in lod1 a different name for a) clarity and b ) to avoid confusion of the exporter. As in any case you have to make a new skin modifier in the lod1, it can't hurt to get it completely seperated from the lod0 setup.

3. Each object in BF2 touching the ground has to be a 'Spring' , else strange things are happening :blink: But you can give the impression of a wheel on a suspension by using its bone to not only drag the tracks with them , but also the suspension, like i did on our Grant tank:

GrantE.jpg

Note how the suspension moves with the wheels. (This is a very old screeny where the tank had weak springs, btw)

Edited by mschoeldgen[Xww2]
Link to comment
Share on other sites

...

3. Each object in BF2 touching the ground has to be a 'Spring' , else strange things are happening :blink: But you can give the impression of a wheel on a suspension by using its bone to not only drag the tracks with them , but also the suspension, like i did on our Grant tank:

GrantE.jpg

Note how the suspension moves with the wheels. (This is a very old screeny where the tank had weak springs, btw)

Doesn't this result in the deformed look? Say, for example, that my strut has the profile of a rectangle. In a rotation, the rectangle would retain its proportions. But this method turns it into a non-90-degree parallelogram. Granted, some struts aren't THAT detailed that it would make a significant difference, but if the strut were on a dune-buggy or something where the suspension is much more exposed, then the difference would be noticeable - even for a game I think.

Perhaps a way to fix this with the spring effect is to somehow enable the 'spring' part to also move slightly towards the would-be pivot point of its would-be strut as it goes up or down from its resting position (thus simulating a hinged joint maintaining its vertical orientation while moving in an arc).

Edited by Rooster3D
Link to comment
Share on other sites

It can't hurt to have the vc channel cleared for _all_ meshes before applying the tank wizard to your selected elements. It doesn't really matter for the non-UVAnimated materials, but can save a lot of time in case you have problems with exporting and the TBM errors.

As i said in the tutorial, to avoid the shader errors in the editor/game, i simply applied the uv-animated material to all of my tank - relying on the fact that their vc channels were all cleared out.

For your bone question: As long as you obey the 'only one bone can affect a vertex' rule, you're free to use that in any way you like. I showed in the plane tutorial how to use a bone to hold vertices fixed while the landing gear was retracted.

The suspension on our Stuart/Honey tank also has a long bar holding the back wheel. I added the rear vertices to the wheel bone's weighting and left the front side untouched. No deformation, it looks as if the bar swings with the wheels.

Edited by mschoeldgen[Xww2]
Link to comment
Share on other sites

A new problem has arisen, and it is probably oversight on my part. I have a need for transparency on various parts of my tank - a grill that covers the turbine engines and the gaps between the tread 'teeth'. I still have the treads and wheels detail on the same texture as the rest of the tank. Whenever I export the tank with the texture named "Alpha_AnimatedUV_mytank_material||AnimatedUV_AlphaTest" it produces a semi-transparent all-over texture. It's like the backfaces are colored only, but I can see through setain parts only at certain angles. I wouldn't even know how to describe it. Whenever I leave out the "Alpha_" in the beginning of the name, it yields a normally colored tank with no transparency at all.

Edit: After some playing around and searching, I found that it has to do with the underscores and capital letters. "Alpha_TestAnimatedUV_mytank_material||AnimatedUVAlpha_Test" works great, as far as I can tell.

Edited by Rooster3D
Link to comment
Share on other sites

Next Issue: I have performed the index, rotation, translation, etc. settings in the editor tweaker. The Tracks are now translating beautifully, but there is absolutely no affect on the wheels. I used the first L & R wheels for the track settings and the second L & R wheels for the groundwheel settings.

L wheels are set to 2 translation and 1 rotation

R wheels are set to 4 translation and 3 rotation

The tank at this point appears to be exporting fine, with no visible errors.

EDIT: I've just noticed the drive wheels don't rotate either. The only way I can get any wheel rotation is to disable Rotate UV on the ground wheels. Even then, it's only the ground wheels that move and not the drive wheels, which are supposed to have geometry rotation.

Nobody knows why the wheels won't respond?

Edited by Rooster3D
Link to comment
Share on other sites

There's a slightly misleading entry in the editor for 'AnimatedUVRotation' which requires you to enter a '1' if UV Rotation is desired. This should normally be a checkbox (boolean) but it isn't. Enter a '1' in it, then assign your AnimatedUVRotationIndex as usual. The 'RotateUV' checkbox should be checked for all ground wheels.

Drivewheels can be a 'RotationalBundle' as long as they don't touch the ground. They don't need vertex colors (tank wizard) and can be rotated through the tank engine like a standard wheel.

Link to comment
Share on other sites

I'll try resetting the drivewheels back to rotational bundles (they are currently Springs). Looking at the T90 tank, I don't know if that technique will even work unless the groundweels' animations start working. I've already had all the ground wheels set to "rotate UV" as well. I did a test run with the wheels' AnimatedUVRotation set to "1" for the wheels that are supposed to affect the others' settings, but there was still nothing.

Link to comment
Share on other sites

I'm making new ground wheels in place of the current ones. I don't know where or what went wrong, but I figure I can do it right from the beginning, especially with something as simple as an array of wheels, easier than trying to backtrack and hunt down problems.

The good news is that despite the ground wheels not rotating, the drive wheels are now behaving properly. YAY!

Incidentally, I hope anyone reading along as I stumble through the tank process will be able to find answers for any problems they might encounter as well.

Link to comment
Share on other sites

I'll try resetting the drivewheels back to rotational bundles (they are currently Springs). Looking at the T90 tank, I don't know if that technique will even work unless the groundweels' animations start working. I've already had all the ground wheels set to "rotate UV" as well. I did a test run with the wheels' AnimatedUVRotation set to "1" for the wheels that are supposed to affect the others' settings, but there was still nothing.

To have the Drive wheels act correctly, you might have to use the entries not mentioned in the tutorial. Here's the extract from the left drive wheel of the Cromwell, using the 'rotateAsAnimatedUV' properties:

ObjectTemplate.activeSafe RotationalBundle Cromwell_whllDrive
ObjectTemplate.modifiedByUser "mscho"
ObjectTemplate.floaterMod 0
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.grip 128
ObjectTemplate.rotateAsAnimatedUV 1
ObjectTemplate.rotateAsAnimatedUVReverse 1
ObjectTemplate.rotateAsAnimatedUVObject cromwell_whll3
rem -------------------------------------
ObjectTemplate.addTemplate S_Cromwell_whllDrive_RotationRpm
rem -------------------------------------

Give it a try. Its helpful to have the drivewheel selected in the editor when testing its rotation as you see the XYZ arrows rotate.

Link to comment
Share on other sites

  • 7 months later...

Question........

How does one get the texture to show up in the unwrap edit window? I noticed in your tutorial, you have your track texture under your uvmap area. How did you bring that into 3dsmax? I have look and tried to figure out how to do that, but I have yet to figure out how to. I am sure I have looked right over it. I tried picking the texture from the drop down window in the upper right of the map area, but that does not lead me to anything. Unless, I am missing some step.

If I knew how to do that, boy, would it save me alot of time. Oh, yes, I am still learning how to work max. There is alot I can do, but some stuff still stumps me. Anyway, can you post the steps in how to do that?

Thanks!

Trahn

Link to comment
Share on other sites

up at the top right of the unwrap editing window should be a drop-down list box with a line through it. (because it's empty) - if you click on this, the list should drop down and give you 'Pick Texture' to select. then browse to your texture, same way as you would for a material:

Pick Texture > Bitmap > Browse to texture file > Open.

any textures you use in the course of your UV-editing session will be added to that list so you don't need to keep browsing for them twice. the little Show Map icon immediately to the left of the list lets you show/hide the texture in the edit window

the UV icon in the same area if clicked will give you VW or UW coordinates instead of UV.

Edited by clivewil
Link to comment
Share on other sites

You can ease up the long way of adding a texture to the UV Edit window by creating an additional material of type 'Standard' and apply the texture you want to show in its 'Diffuse Color' map. There's no need to display that material in the viewports , but it automagically pops up as background picture when opening the UV Edit window.

If you have more than one Standard material with a diffuse map, you can choose them directly in the popmenu in the upper right corner of the Edit window.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...