Jump to content
DerelictStudios Forums
killakanz

How To Make A Tread Move

Recommended Posts

I'm posting this so every man, woman, child and phoib can easilly refer if they forget how to make treads move.

 

It's a simple trick that makes the tread texture move along the mesh, simulating tread movment.

 

As you are applying the texture in RenX, in the material editor under Pass 1, Vertex Material tabs, you have the Stage 0 Mapping section. There, drop the box down aside Type: and select Linear Offset. In the box immediatly below, type in:

VPerSec=1

 

Then continue to apply your material as normal and line it up with UVW Mapping. It wont be moving in gMax.

 

Export to game, and take a close look. If the tread is moving sideways, replace the V in the code with a U or W. If the tread is moving backwards, place in negative 1 after the equals sign. If the tread isn't moving, start again and type it right, it is case sensitive. If that fails it's a mesh name/ini problem, but in my experience getting the treads moving is rarly the problem. Getting them to stop is a problem which sparks up much more often.

Share this post


Link to post
Share on other sites

To complete this, let me add a few remarks :

 

To have the treads move correctly ingame you actually needs 2 models.

One model with no moving texture, for when the tank stops.

One model with moving texture, when it is moving.

 

You then define the models as conditionstates, with the first as default and the second model as MOVING conditionstate.

You'll then have no longer the problem of models who's treads keep moving when standing still...

Share this post


Link to post
Share on other sites

Made a small tut for those who know their way around in gmax:

 

 

 

 

Having the treads of a tank display correctly in Generals involves 2 different models:

 

One model will be used as default CondotionState, for the idle position, where as a second model will be used as MOVING ConditionState model.

 

ConditionState = MOVING

Model = xxxx_mov

End

 

The default model can be made as usual; however, the illusion of movement comes from second model:

 

2 options to approach this moving model: with only 1 texture template or with 2 textures.

 

Both approaches need to have the treads as SEPERATE objects, meaning: detached from the main body!

 

When using only 1 texture for the complete tank, you HAVE to fill the strip completely, where the track image comes. This is because of the way the UV displacement works: it makes the texture scroll either vertically or horizontal. As a result you need to have a strip with a tiled tracks image within your model texture.

 

When using 2 textures, you can layout your model texture without much consideration as your second texture will include only your tracks image. One important aspect is the keep in mind the aspect of the tracks needs to be a power of 2 when using DDS. Usually I take something like 32x128. Applying a texture also means the tracks need a separate UV layout. If you unfold the tracks, using chilliskinner, you can easily apply planar mapping. Don't forget to choose bitmap fit, so that your UVWmap takes the aspect of the bitmap, resulting in zero distortions. Once you got the aspect right, you can then scale the map so it fits the width of the track. Make a W3D texture, with the tracks texture set as stage0. For those who wish can even use alpha blending if you've added an alpha map to your tracks texture. Go to the vertexmaterial tab in the W3D material. in the dropdown list you will find "linear offset". In the "args" section you add either UPerSec=(float) or VPerSec=(float), with (float) being a positive or negative floating point value (eg -0.3). Usually, negative values make the treads move correctly (=backwards). Apply this texture to both track objects on the model. Apply the other texture to the other model parts and export...

Share this post


Link to post
Share on other sites

In maya, for the extreme few who use it, you just go into the UV texture editor. Select all the UV's on the outside tread faces and hit "s". then move forward 2 frames, move the uv's a small amount over the texture, and hit "s" again. Go into the hypergraph, and select the keys you set under the UV map, go into the menu "post infinite" and click cycle with offset. Now your treads will move in a constant rate forever, but there are ways to make the speed change.

Share this post


Link to post
Share on other sites

I actually notice that these lines in the INI make the treads stop when the tank does:

 

    TreadAnimationRate    = 1.0; ammount of tread texture to move per second
   TreadDriveSpeedFraction = 0.3; fraction of locomotor speed below which treads stop moving.
   TreadPivotSpeedFraction = 0.6; fraction of locomotor speed below which we allow pivoting.

 

As long as your tread meshes are named

TREADSL01

and

TREADSR01

it'll work.

Share this post


Link to post
Share on other sites

What if I have 4 treads? on either side?

 

LIKE

 

TREADSL01

-

TREADSL04

 

Cos I can't seem to get mine working ingame. I've followed this tutorial to the T and still cant get it to work. Help would really be apprechiated. Model exports fine and run ingame but treads still dont animate.

 

*** Figured it out in the end. Have to go File > Export for the tread to move ingame properly.

Edited by Liger

Share this post


Link to post
Share on other sites
I actually notice that these lines in the INI make the treads stop when the tank does:

 

    TreadAnimationRate    = 1.0; ammount of tread texture to move per second
   TreadDriveSpeedFraction = 0.3; fraction of locomotor speed below which treads stop moving.
   TreadPivotSpeedFraction = 0.6; fraction of locomotor speed below which we allow pivoting.

 

As long as your tread meshes are named

TREADSL01

and

TREADSR01

it'll work.

This is correct.With this code you only need one model.It will override the material settings for VPerSec and UPerSec.

Share this post


Link to post
Share on other sites

Since IA came in...

Share this post


Link to post
Share on other sites

Just come to think about it:

we should find the correlation between the "texture sliding speed" and the speed set in the locomotor, so that the sliding actually matches up...

Share this post


Link to post
Share on other sites
we should find the correlation between the "texture sliding speed" and the speed set in the locomotor, so that the sliding actually matches up...

I dont think there is one, I think that TreadAnimationRate = 1.0 would be eqivelant to VPerSec = 1.The UV layout of the treads will also effect scroll rate.

Edited by key0p

Share this post


Link to post
Share on other sites

Also to further simplifly this whole "tread" issue, here are some "rules" that should be followed:

  • - Always design your Treads to run from
Left to Right of your texture map

- It's best to take the tread texture and have it reach both left and right side completely

- You need to seperate the mesh faces that you want to texture as the treads, otherwise you'll find other parts of your model's uv's moving as well

- They need to be named according to what side they are on: Hense Right side = TREADSR01 & Left Side = TREADSL01. This is also needed for like when the tracked vehicle pivot's to turn, then the treads counter rotate to eachother for a more real effect.

- Make sure all your faces you're mapping FLOW in the same diretion, meaning that if you select all the faces in the uv edior and slide them left to right your viewport should show the textures all sliding in the same direction. Otherwise you'll get some faces going one was and others going opposite and no manner of V or U Persec's will fix it..;)

- You can overlap your faces but I find giving them as much texture space from left to right in a row not overlapping makes for a much prettier look and feel in game.

If you follow these guidelines then you'll have no problems getting them working. It is the easiest method to do it. Trust me I've done over 22 tanks now for Blitz 2 and I know it by heart now :D

 

Here's an example of how you can save texture space for your main object and keep your treads all in one nice single texture:

 

Treads.jpg

 

Then you can select any type of tread so you desire by simple moving up or down the strips..:D

 

Topknot ;)

Edited by Topknot

Share this post


Link to post
Share on other sites

Good work on consolidating the process topknot, now all we need is a new sticky, as a lot of people will probably not read the entire thread before trying it out ;)

 

As UVs are tiled, you can also map the treads to a single tiny bitmap like:

treadchop.jpg

Share this post


Link to post
Share on other sites

Correct, but if you want some dirt variation, you might make the treads a bit longer.

 

If you do it with a small map, you might considering making a 1:4 or a 1:8 map(32x256). As long it has the power of 2, it's fine.

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

×