Jump to content
Official BF Editor Forums
Sign in to follow this  
[PoE]D_FAST

BF2 AnimatedUV Wheel Overview

Recommended Posts

To add up on D_Fasts's tutorial : Here's a simple and ugly testank for you to download:

http://berlin.schoeldgen.de/bf1942/testank.zip

It comes as Max 7 model and as a coded BF2 vehicle with (very crappy) textures. Use it as an example for animatedUV techniques , bones and coding.

No guns loaded and the driver camera is located just above the terrain, as i wanted to look at the wheels and tracks. Engine sounds are cutted out for a small download (its 175kBytes :D )

Edited by mschoeldgen[Xww2]

Share this post


Link to post
Share on other sites

i understand most of setting up for animating uv's,but how do you setup the animation part is what has me lost?..... :shock:

i can see the treads have to shift and the wheel hub has to rotate "but how??"..lol

any help would be fantastic!..thanx

Share this post


Link to post
Share on other sites

There is no animation like .baf's or so for tanks. Also a tank has no skeleton. After you applied your tank wizard's vertex colors, the rest is done in code. If you open an arbitrary tweak file for a tank, you'll find parameters like 'AnimatedUVTranslationMax' and 'AnimatedUVRotation' . The indexes are as follows:

1 - rotation right side wheels

2 - rotation left side wheels

3 - translation right side wheels

4 - translation left side wheels

5 - translation right side track/treads

6 - translation left side track/tread

( did i get those completely right ? not sure ,atm)

The parameters are as follows:

AnimatedUVTranslationMax : the width of the motion in relation to the texture. formula: (width of desired movement / texture width) . If your track segement is 20 pixels wide and your main texture is 2048 wide, you would have a max of 20/2048 = 0.012.

AnimatedUVTranslationSize : The speed of the movement. You want to adjust this to make the track/wheel move smoothly over the ground (Note the bad coding on some DICE tanks here)

AnimatedUVRotationScale : This only applies to Rotation. If the texture of your wheels is in a nonsquare texture , you need to adjust that here. If you're using e.g. a 512 by 256 texture for the wheels, you'd use 0.5/1 for the scale.

AnimatedUVRotationRadius: Determines the speed of rotation for wheels.

Share this post


Link to post
Share on other sites

woot woot,thanx for that mate,i can garuntee ill have more questions..lol

now i see what to do,ill reference what ya said to 1 of rexmans vids,and d'fasts tuts and all your posts.....huge thanx to ya for info.

Share this post


Link to post
Share on other sites

well i have run into a few problems,when i export i get this error pop up quite a few times...

tankboneprob28iz.jpg

.

the second problem that appears is in the editor is this(below),it gives me this error alot of times,(gives the same error in the output window for well over ten minutes..maybe more)..lol

tankboneprob10nt.jpg

.

this is what the bone looks like(below),i have no idea if its right..lol

tankboneprob30hs.jpg

.

in the editor the wheels do not appear,so i guese it has something to do with the way i aplied the animated uv setup to the wheels.

also when i enable physics the tank treads verts get moved in the right way,so i think the treads are fine.......thanx again for ya help

.

EDIT..after reading another post ,he appeared to have the same problems.

can you explain the prossess of aplying the rotate and translate setup in steps,cuz i feel thats where the issue lies..thanx champ.

not having voice over on rexmans vid was no real help..lol

Share this post


Link to post
Share on other sites

@BEEX: This error pops up when you apply more than one animation technique to a single vertex. Best way to get rid of this : Select your meshes and apply a 'UVMapping Clear' modifier to them with the channel set to 0 and collapse it. This will clear all vertex colors you might have. Try to export. If it works you found them all and are now ready to reapply the colors with the tank wizard. Do it one wheel after the other and check by exporting after each wheel has been colored.

The 'bmhasanimateduv....' error is related to the AnimatedUV material. The game needs to have at least a single face of the geom0 (cockpit) to be of the AnimatedUV material, even if there's no animation in the cockpit view. You could apply the AnimatedUV material to an arbitrary face of the geom0 and you're set. The wreck doesn't need this workaround.

Rexman's video is a bit cryptic in the beginning (and yes, there's no sound) but id you follow him closely, it falls into place after a while. I guess i watched about a dozen times....

Bones are pyramids primitives (and you mustn't convert them to editable meshes). Create one bone per wheel and parent it to the wheel.

After every wheel has a bone, add a 'Skin' modifier to the main hull (the one with the tracks in it) and add the bones to this modifier. Edit their envelopes to 'catch' the vertices of the track you want to bounce the wheel with. When finished , don't collapse the Skin modifier to the mesh, but leave it there.

Before exporting , you should deselect it, the exporter seems to be confused a bit when the Skin modifier is selected while exporting.

Share this post


Link to post
Share on other sites

Hmm, the real nightmares are the limitations of the gameengine... like not being able to fire two guns simultaneously and so on....

On a sidenote: Bones are useful for other things ,too. I use them e.g. on landing gears to make the suspension move with the wheel...

Share this post


Link to post
Share on other sites

first i have to apoligise to d fast for a quick change of subject..sorry d fast..lol..we'll get back to subject.

i thought you could fire 2 weapons simultaneously.

heres a section from my laser guided predator (sraw),still a work in progress.although this tweaked weapon does not fire 2 weapons at once.but it could if coded correctly...lol

.

first section

.

ObjectTemplate.activeSafe GenericFireArm usatp_predator

.

rem ---BeginComp:DefaultAmmoComp ---

ObjectTemplate.createComponent DefaultAmmoComp

ObjectTemplate.ammo.ammoType 1

ObjectTemplate.ammo.nrOfMags 6

ObjectTemplate.ammo.magSize 1

ObjectTemplate.ammo.reloadTime 3

ObjectTemplate.ammo.minimumTimeUntilReload 1.8

ObjectTemplate.ammo.magLinkWeapon at_predator_tv

ObjectTemplate.ammo.reloadWithoutPlayer 1

rem ---EndComp ---

.

doubled up

.

ObjectTemplate.create GenericFireArm usatp_predator_tv

.

rem ---BeginComp:DefaultAmmoComp ---

ObjectTemplate.createComponent DefaultAmmoComp

ObjectTemplate.ammo.ammoType 1

ObjectTemplate.ammo.nrOfMags 6

ObjectTemplate.ammo.magSize 1

ObjectTemplate.ammo.reloadTime 3

ObjectTemplate.ammo.minimumTimeUntilReload 1.8

ObjectTemplate.ammo.magLinkWeapon at_predator

ObjectTemplate.ammo.reloadWithoutPlayer 1

rem ---EndComp ---

.

basicly what ya have to do is double up the whole firearm code and link it to each other.

its this line that does it

.

ObjectTemplate.ammo.magLinkWeapon

.

that line is supposed to link 2 fire arms together and can draw from the same ammo box.

main problem is that it needs a dummy for each fire arm,i am not 100% sure about that,but all i got was crashes without a dummy.

so after messing around with this i found there is some real possibilties for some very advanced weapon systems on vehicles and for hand weapons.

i think its possible to set it up so it can fire both at once and switch to fire them seperatly.probly need to add a third and forth "create GenericFireArm" section.

hope that helps some...if ya want the full tweak file for my predator to look over,just ask ill pm it to ya

.

and that idea about skinning bones to suspension for wheeled vehicles is a cool idea,thats been on mind for quite some time,just never got around to it..lol

.

now back to uv animation..lol

i still cant get it workin on the wheels,the uv translation works,but not the rotation on both sides of the wheel,all i get is flat grey non textured.

i remade the wheel model so its a basic cylinder and still it dont work,any idea's why its grey?..thought i should ask that.cuz it may lead to an answer..lol

Share this post


Link to post
Share on other sites

Thanks for the hint on firing two weapons synchronously, i'll definitely try it out :D (that maglink parameter looks new to me :P )

Rotation problems can be related to one of these:

a) you uvmapped your wheel after applying the vertex colors or

B) you didn't setup the center correctly. Note that just hitting 'Guess' won't select the center for you , it just gives you a hint. You really have to select the center vertex, then press 'Center' in the tank wizard dialog. Keep in mind only faces touching the center (of rotation) should be 'Rotate' , all others 'translate'.

But it seems you made some major progress :D Good news !

Share this post


Link to post
Share on other sites

I think it came down to this:

seelct the outer side of your wheel, click guess center then Rotate, then you select the inside and do the same, then you select the wheels thread and click translate and that shoudl basically be it. I am probably missing half the steps tho.

Share this post


Link to post
Share on other sites

its because those pics refer to the old site (the one with the ip adress). Either D_FAST has to fix that or you jsut have to dld the tut and the pics by hand it put it straight on your own HDD

Share this post


Link to post
Share on other sites

Thanks Msch!

The tutorial says to split the wheel perimeter into two UV elements. Should we do the same with the tank Tracks' Treads? After following the Loft method of tread creation for hassle-free UVs, I proportionately stretched the UV tread element over the full height of the UV map. My goal was that it will just loop over the tiled texture... would this work instead of splitting it in half?

One other thing I haven't found anywhere... When I am using the tank wizard, will I need to prep the geometry of the tank like I did for the car? I.e.: main body and left-side wheels only - and then it creates the other side? Or do I need to have all the geometry present?

Share this post


Link to post
Share on other sites

The tank wizards needs all geometry, so you have to add it yourself. Also, tankthreads are a part of the main body, unlike the wheels.

As for the UV, UV the tanktracks as you wish and then put the same texture tiled under or besides the original so it has room to shift for the animation. If the track moves outside the texture it will not tile but stretch the last pixel.

Share this post


Link to post
Share on other sites
Thanks Msch!

The tutorial says to split the wheel perimeter into two UV elements. Should we do the same with the tank Tracks' Treads? After following the Loft method of tread creation for hassle-free UVs, I proportionately stretched the UV tread element over the full height of the UV map. My goal was that it will just loop over the tiled texture... would this work instead of splitting it in half?

One other thing I haven't found anywhere... When I am using the tank wizard, will I need to prep the geometry of the tank like I did for the car? I.e.: main body and left-side wheels only - and then it creates the other side? Or do I need to have all the geometry present?

Track UV's are tricky to get looking good, you will need to experiment with them to get it right. It isn't as simple as stretching the whole thing over your texture. You can import a BF2 tank and dissect how they did it. Just select the main body PCO and hide unselected then detach one side of the tracks and select it. Apply an unwrap modifier set to ch9 on the the imported mesh then you can see how they did it. Go through each poly step by step watching in the unwrap edit window and follow how they are laid out. Once you get the hang of it you can do an entire section of the track at the same time.

Share this post


Link to post
Share on other sites
The tank wizards needs all geometry, so you have to add it yourself.
Could I run the car wizard on the tank to make things go faster? ;)
Also, tankthreads are a part of the main body, unlike the wheels.
Um... nobody said otherwise. But thanks for the other help!

showNOmercy, you lost me. First... you can import a default BF2 model?

This is a little confusing because I am trying to re-train my brain to do tank tread texture panning. I come from experience doing this in UT2004, that's why.

You must unlearn what you have learned.

If I mirror-clone wheels that I already set center, rotation, and translation in the tank wizard, will the clones have all that information, or do I need to wizard them seperately?

Edited by Rooster3D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×