Animating Materials

To animate one or more materials, you follow exactly the same rules used to animate any other object type in Realsoft 3D. This tutorial presents a number of example projects that demonstrate common material animation cases. We'll start with a simple case, and move on to more interesting ones at the end of this tutorial.

Animating a texture map

Tutorial level: Medium

Example project: 'tutorprojects\animation\materials\moving texture'

One way to animate a texture is to make the entire texture map change in some way. In general, this would do nothing to the characteristics of the texture itself - that is, attributes of the texture - but it would still produce certain useful effects.

To begin, imagine you have a scene that requires a painting on a wall, and you want to create an animation where the painting moves across the wall (maybe this is a haunted house). To do this, you do not need to animate actual material attributes. Realsoft 3D uses geometric mapping objects to assign materials to actual geometric objects. This type of system allows you to animate all geometric material properties, such as position, scale, and rotation, as easily as animating these same properties of any "regular" geometric object using the animation recording mode or choreographs.

To demonstrate this technique, start by creating an analytic cube as a wall (a front view is probably best). Now do the following:

1. Go to the Select window's Materials tab. Right click, and from the popup select New/From Template.

2. The Load dialog opens up. Open the materials folder. Open the Image Maps folder and then select the Color Map file. This creates a new material called 'Color Map'. Find this material in the list, select it, and then rename it to something more suitable, such as Lake_painting, for example.

3. Double click the Lake_painting material to open the property window. Set the value of the File Name field to 'lake,' found in the Realsoft 3D 'textures' directory. Leave all the checkbox attributes unchecked. Close the property wndow.

4. Now highlight the Lake_painting material, then right-click and select Map/Parallel from the popup. Draw a rectangle over the wall object.

5. Ray trace render the view.

Texture map drawn inside the wall object
A material parallel mapped on the wall

6. Set the time slider to the first frame, and activate animation recording. If the "painting" (that is, the texture map object) is not placed where you want it, move it to the starting position. Go to the last frame of the animation, and move the painting to a different location, for instance, the other side of the wall. Turn off animation recording and play the animation. The parallel mapping object representing the position of the painting moves across the wall.

Essentially, that is all there is to it. You can animate a texture map object in many other ways, such as scale, rotation, skew, etc., just like any other geometric object.

You can create many interesting and useful animation effects by animating mapping objects this way. For example, you can animate the Invisible in photorealistic rendering attribute to enable and disable rendering of a certain material. In this way you can create "wink out" effects, or make a transparent portion of an object become opaque. You can even apply gravity and other simulation effects to mapping objects.

Animating texture attributes

Tutorial level: Medium

Example project: 'tutorprojects\animation\materials\animated wood'

In the previous section we looked at animating a texture map object, but this is not the only way to animate textures. You can also animate any of the attributes of a texture.

For example, let's create a wooden tabletop and animate several characteristics of the wood texture. To do this, you animate the actual material object, not the mapping object.

1. In a top view, create an analytic cube, and size it so it looks like a tabletop. Leave the cube selected.

Wood in the first animation frame

2. Go to the Materials tab of the Select window. Find the standard Wood material and double click its icon to open the property window.

We will use the default values of the wood material for its initial look, so do not change the material in the first frame.

3. Now move the time slider to frame 60 and activate animation recording. Set the Color 1 attribute to a darker brown, and the Irregularity attribute to 0.3.

4. Next, move to frame 120 and set the Color 2 attribute to an off-white, and the Block Size attribute to (0.5 0.5 3). Finally, reset animation recording to off.

5. Reset the animation to the first frame, and drag the time slider (do not press play!) through to frame 120 while watching the attribute values change in the property window. Do you notice something? Did you want the Color 2 and Block Size attributes to start changing at the first frame or at frame 60?

Wood in the last animation frame

6. If you wanted the animation of the Color 2 and Block Size attributes to begin at frame 60, this is easy to correct. Open the choreography window (from the pull down menu Windows/Choreography Window) and select the Time Lines tab. Open the wood.init0 entry and the keyfr1 entry under it. Now you see a list of the animated attributes of the choreograph. The last two elements should be Color2= ..... and tilesize=...... Move the first key of these two attributes to frame 60. Now go back, make sure the properties window is open, and drag the time slider again. Watch the attribute values for the animated wood material change over time.

Resetting the keys to frame 60 for the Color2 and tilesize attributes

7. To finish this tutorial, close the choreography window and drag & drop the wood material from the Select window to the view window. This maps the animated wood to the tabletop.

Using animation files as textures

Another method of creating an animated texture is to use an animation file, such as an AVI, as a texture map. This allows you to use, for instance, a video sequence, or a series of images created in another program and rendered as an FLC or AVI file, as a texture.

To do this, go to the Select window's Materials tab, right-click and from the popup select New/From Template. From the Load Selected Objects dialog, open the Animated Image Maps folder, and then select the TextureAnim file. This places a new material called 'textureanim' in the materials list. Rename this material to something useful for your project, and then double-click this material to open the property window.

Property window and attributes for a texture animation material

Enter the name of a file in the File Name field (this should be one of the supported animation file types). Now map this material to an object.

As you can see from the attributes, you have additional options for controlling how the animation file is positioned and played. For instance, you can keep repeating the animation file from beginning to end, you can ping-pong it (beginning to end, end to beginning, and so on), or you can have it play in reverse.

Controlling the timing of an animated texture

The technique we just described works fine if the AVI (or other type) file plays the images exactly at the speed you want. But what then if that is not the case? What if you need an animated image to change first slowly and then speed up? Obviously, you can not achieve this type of control with the basic Ping Pong, Repeat, or Reverse options. The Current Frame attribute is provided for situations like this.

Assume you have an AVI animation file consisting of 10 frames, and that you want to control the speed of the AVI file in special way. For the first 60 frames of the animation, you only want to use the first 3 frames of the animated texture, then during the last 40 frames you want to use the remaining 7 frames of the animated texture.

You set up this kind of an animation by key framing the texture frame index (the Current Frame attribute). To do this, you can use the supplied template material in the Animated Image Maps folder.

1. If you have, or can easily make, a 10 frame AVI, do so and use it in this exercise (see the manual chapter about File Rendering for details).

2. Go to the Select window's Materials tab, and choose New/From Template from the popup. Load the 'Animated Image Maps/Keyframe Texture' material template.

3. The materials list should now contain an entry called 'keyframe texture'. Rename this material template to Accelerated Index, or something else meaningful to you, then double click it to open the property window.

4. In the File Name field, enter the name of your AVI file.

Use an .avi file as a texture

5. Now activate animation recording and set the time slider to the first frame. The Current Frame field is, by default, zero, which is the correct start value (The frame index for AVI files typically begins at 0, so a 10 frame AVI uses index values of 0-9). Move the time slider to frame 60 and set the Current Frame field to 2. Now move to frame 99 and set the Current Frame field to 9. Turn off animation recording.

That's all there is to it: you have now keyframed the frame index of your AVI file.

6. Last, open the choreography window to the Properties tab. Select the CurrentFrame attribute from the choreography list to view the animation curve.

The animation curve controlling the frame number of the AVI file as a function of time