Animated Textures with X-Particles Sprites

Suppose you have an animated texture applied to each sprite. When the sprite is created, the frame of the animation it displays will be whatever the current frame is in the scene. This means that each and every sprite displays exactly the same frame at all times. If you want the sprites to start from different frames, you need to use random start frames.

1. Create your textures

First, you will need an animated texture. It is strongly recommended that this is a sequence of still images. It is (in theory) possible to use a single animated movie file, but there are problems with this, notably that older versions of Cinema 4D cannot load .mp4 files, and the function to distribute frames of a movie file to individual layers in a multishader is extremely slow.

For test purposes we have prepared a simple 10-frame image sequence which you are welcome to use. You can download it from the following link:

Image sequence, 10 frames

This is a sequence of numbers starting with 0 and counting up to 9. SImply unzip it to a location of your choice. The image files are contained in the folder 'ImgSeq'.

2. Create a material

Next, create a Cinema 4D material with a Mograph Multishader in one or more channels. You should use the same image sequence in each instance of the multishader. (This isn't essential and you can use different sequences in different multishaders but the results may not be optimal.)

In the multishader, add your image sequence. The easiest way to do this is to click the 'Add From Folder' button in the multishader and locate the folder which contains the sequence. If you are using the test sequence provided, you should navigate to the 'ImgSeq' folder and use that.

You can also try using a single movie file, in which case add the movie file to the first texture slot in the multishader, then click the 'To Layers' button. You are warned that this may take some time (it does!).

With the test sequence you will end up with something like this in the multishader:

Ignore the actual bitmaps shown.

3. Add the material to the Sprite object

Add the material to the Sprite object, either by dragging it into the 'Texture List' or by adding it to the object in the usual way.

4. Set the Multishader controls

If you play the sequence now you will see that each sprite has the same image and that there is no animation. To fix this, we first need to turn on the Multishader, so back in the Sprite object, change the 'Multishader Control' menu to something other than 'None'. 'Greyscale' will be fine. The resulting render does show an animated texture, but all the sprites have the same image; also, it does not loop but stops when it reaches the last frame:

Now check the switch 'Random Start Frame'. You can also select the animation mode, which will be applied automatically to all frames in the sequence. When you rewind the scene to the start, each frame in the sequence will be set to a randomly-selected starting frame, or you can click 'Redistribute Frames' to force it to update immediately.

Once you check this switch, each bitmap shader in the sequence will be assigned a random starting frame ranging from 1 to the number of frames in the sequence. Each sprite is then randomly assigned one of the bitmap shaders, so each sprite will start the animation at a random frame.

If you don't like the results you can change it by changing the random seed value ('Seed' parameter in the Sprite object) and then clicking the 'Redistribute Frames' button to assign different starting frames to each bitmap.

Try setting the 'Animation Mode' setting to 'Ping-Pong'. Now when you render the scene, each sprite will start the animation at a random frame and count up to the last frame in the sequence, at which point it will count back down again to its original starting frame:

Note that each multishader receives the same random pattern of frames. That is, if you have a multishader in the color channel, and another multishader with the same image sequence in the alpha channel, the two sequences are given identical random frames. This ensures that the alpha and colour channels match as both are using the same frame of the sequence.

Limitations

As noted above, using movie files is problematic and still image sequences are preferred.

Secondly, if the frame assigned to a sprite is (for example) 1, the initial frame displayed will be frame 2, not frame 1. Using 'Ping-Pong' animation, however, will cause the sequence to count back down frame 1 rather than frame 2.

In addition, using 'Loop' or 'Ping-Pong' modes the animation will start again at (loop) or rewind back to (ping-pong) the initial starting frame for that sprite, not the very first frame in the sequence. This means that if, for example, the starting frame is chosen to be 10 out of a series of 10 images, the sprite will always display the last frame in the series and never animate back to the start.