Animated Textures

Forget your silly 10 fps looping quake animated textures. Now you can create complex multi-framed animated textures AND control them from APE. Explosion effects, computer terminal displays, animated 2D user-interface controls, even the mouse! ....the possibilities are endless.


type      = animation
colortype = integer 
width     = integer
height    = integer
bilinear  = integer (optional, def=1)
clamp     = integer (optional, def=0)
  file    = filename

  ... repeat for all bitmaps
  bitmap  = integer
  next    = integer (optional)
  wait    = float   (optional)
  x       = integer (optional)
  y       = integer (optional)

  ... repeat for all frames

Parameters (main)

Determines how the texture is stored on the card. All source bitmaps must be in the same format. Can be one of the following values:
value meaning
1 8-bit greyscale PNG
2 8-bit greyscale + 8-bit alpha PNG
3 24-bit RGB PNG
4 24-bit RGB + 8-bit alpha PNG
Width of output texture, must be power of two.
Height of output texture, must be power of two.
Must be 0 or 1, controls whether bilinear filtering is used on this image. Default is 1.
Must be 0 or 1, controls whether the texture is clamped to its edges or is repeated (tiled). It must be 1 if you want to use an animated parabolic environment map. Default is 0.

Parameters (bitmap list)

Specifies a source image file. Must be in PNG format and have the same color type as specified earlier by colortype. It can be any size as long as it not larger than the output size in any dimension.

Parameters (frame list)

Integer specifying which file specified in the bitmap list to use. The first bitmap you specified is numbered 0; subsequent bitmaps are numbered 1, 2, 3, and so on.
Integer specifying the next frame in the animation sequence. The first frame you specified is numbered 0; subsequence frames are numbered 1, 2, 3, and so on. If you specify −1, then the image will stop animating after this frame. The default value is −1.
Floating point value specifying the number of seconds to wait before displaying the next frame in the animation sequence. For example, specifying 1.5 will show a frame for one and a half seconds. If you specify 0, then the next frame will be uploaded on the next rendering pass. If you specify −1, then the current frame is uploaded immediately and the next frame in the sequence is processed (see Remarks section). The default value is 0.
Integer specifying the x offset into the output texture where the bitmap should appear.
Integer specifying the y offset into the output texture where the bitmap should appear.


Since this new animated texture code uses frame uploading, having many frames of animation takes up main memory instead of video card texture memory. The amount of video texture memory used is never more than the amount required to store the output frame. However, this doesn't mean animated textures are free and you should frame-output the FF8 opening movie into PNG format and watch it play in Anachronox.


Although they no longer take up video memory, they still do take up main memory, and taking up too much main memory is a bad thing. One way to reduce your RAM usage is to not change the all of the texture in the animation frame. For example, say you skin a robot, and you want one of his lights to blink. Instead of making two copies of the skin with the light either on or off, you can have one frame be the original skin, and one frame be a very small bitmap containing only the part of the skin that changes with the blinking light. Then you can do something like this:

base.png on.png off.png output


# Frame 0 is what is always uploaded to the texture
# before anything is displayed.  In this case, wait 
# is -1 so the next frame (1) is immediately processed.


# Frame 1 says to upload on.png at the specified
# offsets into the texture.  Then it waits half
# a second before processing the next frame.


# Frame 2 uploads off.png at the specified offset.
# This replaces the center light with a picture
# of the light turned off.  It then waits .2
# seconds before looping back to frame 1.


Look in map joeyproc for some examples in animated textures.