HowTo:Make Animated Textures

From VsWiki
Jump to: navigation, search
arrow_left.png Tips for realistic-looking textures arrow_up.png HowTos Editing BFXM files (format spec) arrow_right.png

Using animated textures on a model is similar to using regular textures. Instead of (or in addition to) setting the texture element in the xmesh, you must set the animation element as well. For example:

<Mesh scale="1.0" ... blend="ONE ONE" animation="whitelight.ani">

would create a blinking white light.

Newer versions of Mesher with support for MTL files will interpret a map_Kd property pointing to an .ani as an animated texture, and will properly add them to the xmesh/bfxm as an animation as shown above.

Animations are fairly simple. Each animation is made up of a folder containing several individual pictures. It also contains an .ani file that tells the game what frames to display and in what order. Here is an example of an .ani file:

-10 10
40 .035
blink0000.png
blink0001.png
blink0002.png
blink0003.png
blink0004.png

The first row of numbers are for the (deprecated?) animated sprite system, and can be safely ignored, but must be present.

The second row of numbers indicates the number of frames in the animation and the duration of each frame (in seconds?) respectively.

In SVN, startRandom can also be added at the end of the second row to pick a random starting frame.

After the numbers, there is a list of frames to be used in the animation. You may reference each frame as many times as you like. For instance:

blink0009.png
blink0010.png
blink0010.png
blink0010.png
blink0010.png

will display frame nine briefly, and frame ten for a longer period. This is especially useful for blinking animations, where you want to display the black frame for a long period of time to control the interval between blinks.

The standard running light animations are redlight.ani, bluelight.ani, greenlight.ani, and whitelight.ani. Other special light animations exist, such as blink.ani for the Llama and streak.ani for the Ariston.

You can find all the shared animations used by the game in the "animations" folder.

Ships with custom animated textures may store their animation frames and .ani file in the ship's directory in /units.