Create an animated material

Preparation

  • To create a material with animation, you first need to define the frames for CS 2.0 to cycle.

Expected effect

  • For example, to create an animation with 4 frames, we can define the 4 frames as below.

Frame distribution Actual image

  • The images within the 4 frames must be of the same size, and CS 2.0 will cycle the images from left to right, then from top to bottom.
  • If the material has images other than _color.png, then other files (e.g. _selfillum.png) should also follow the same layout as above.

Material Editor

Settings

  • Once the images are created, go to the Material Editor, select Csgo Complex as the shader, then check Texture Animation on the left hand side.
    • By default, the Texture Animation Mode should be Sequential.
    • It is still to be determined on how the two other modes Random and Scripted work.
  • A list of parameters should show up that allows you to adjust the settings for the animation.
    • Animation Grid - tells the engine how the frames are distributed. In the example above, it would be 2 x 2.
    • Num Animation Cells - just multiply the two numbers above, unless you want to skip some of the frames, in which you can put a number smaller than the product.
    • Animation Time Per Frame - tells the engine how long should it wait for in seconds before switching to the next frame.
    • Animation Time Offset - tells the engine from which time frame to start with in seconds, this is useful for skipping the initial frame(s).
    • Animation Frame - to be determined.
  • If everything is done correctly, then you should be able to see the animation effect right away in the Material Editor and the Hammer Editor.

Using the Animated Material in a Model

  • One thing to notice is that when you try to use the animated material in 3D modeling editors like Blender, the UV mapping should follow the size of the image in a single frame, not that of the image with all the frames.
    • Otherwise, the animation will look wrong in both the Hammer Editor and in the game.
  • Using the example material above, the UV mapping should follow the image for a single frame below.

Blender UV mapping