Particle Animation with Anim8or v0.7


Understanding Anim8or’s file format

Open in Anim8or a new project file. Let’s create a sphere in the center of the object editor (create it anywhere, than click Edit->Locate…->Center about Origin). Save the file (save it as “hack.an8”) and open it again with a plain text editor, like Notepad in Windows OS. It will look like this:

 

header {

  version { "0.7-beta-3" }

  build { "2001.10.24" }

}

environment {

  grid { 1 10 50 50 }

  framerate { 24 }

}

object { "object01"

  sphere {

    name { "sphere01" }

    material { " -- default --" }

    diameter { 7.7945 }

    longlat { 12 8 }

  }

}

 

  It is self-explanatory: version and environment information (grid spacing, animation frame rate); we have created object01 as a default sphere with 12 longitude and 8 latitude divisions named sphere01, diameter = 7.7945, with default material. We take a step further: in hack.an8 switch to Scene mode and click Build -> Add Object, selecting object01, click OK than save the file. Open it again in a text editor. The code written above will be repeated and a new section will be appended. That is what we are interested in:

- repeating the above mentioned code –

scene { "scene01"

  frames { 72 }

  groundgrid { 1 }

  background { 153 153 153 }

  camera { "camera01"

    loc { (150 100 200) }

    orientation { (-0.04877 0.93733 -0.14632 -0.31244) }

    fov { 90 }

  }

  objectelement { "eobject01" "object01"

    loc { (0 0 0) }

  }

}

 

This code defines the scene, again pretty self-explanatory: the scene is named scene01, it is composed of 72 frames, the ground grid is on (=1), background color is R=153, G=153, B=153. Following the camera parameters (name, xyz location, orientation as quaternion, field of view). We are interested only in the code figured in red. It defines the single object in the scene, named eobject01, which is an instance of object01. It’s located at the coordinates x = 0, y = 0, z = 0.

One more step: In scene mode click again Build -> Add Object, select object01, click OK, than move away the newly added object from the origin. Save hack.an8 and open it in the text editor.

- repeating code -

objectelement { "eobject01" "object01"

    loc { (0 0 0) }

  }

objectelement { "eobject02" "object01"

    loc { (-34.384 21.776 0) }

  }

}

 

We notice that a new line was added, defining eobject02 which is a second instance of object01. Its coordinates correspond to the location where we have moved the object. Now we have learned how Anim8or keeps the record of the added objects in a scene. Let’s make a major step forward, editing the project file! First, close hack.an8 in Anim8or. In the text editor, insert the code lines figured in blue to the file.

- repeating code -

objectelement { "eobject01" "object01"

    loc { (0 0 0) }

  }

objectelement { "eobject02" "object01"

    loc { (-34.384 21.776 0) }

  }

objectelement { "eobject03" "object01"

    loc { (10 20 30) }

  }

}

 

These code lines define a third instance of object01, located at the coordinates x=10, y=20, z=30. Save the file in the text editor (keeping the .an8 extension) and reopen it in Anim8or. In scene mode, you should see three spheres now. This simple file manipulation shows that we can actually create a scene without opening Anim8or at all!

Let’s see now the code for animation! Hit the “Animate” button. Select eobject01 (the sphere in the center of the scene, go to frame 5 and move eobject01 a certain distance. Go to frame 10, than 20, moving each time the selected object. Select now eobject02. Go to frame 5 and move eobject02 from its position, go to frame 25 and move it again somewhere. Save hack.an8 and open it in the text editor. The file looks like this:

header {

  version { "0.7-beta-3" }

  build { "2001.10.24" }

}

environment {

  grid { 1 10 50 50 }

  framerate { 24 }

}

object { "object01"

  sphere {

    name { "sphere01" }

    material { " -- default --" }

    diameter { 7.7945 }

    longlat { 12 8 }

  }

}

scene { "scene01"

  frames { 72 }

  groundgrid { 1 }

  background { 153 153 153 }

  camera { "camera01"

    loc { (150 100 200) }

    orientation { (-0.04877 0.93733 -0.14632 -0.31244) }

    fov { 90 }

  }

  objectelement { "eobject01" "object01"

    loc { (0 0 0) }

    controller { "position"

      track {

        pointkey { 0 (0 0 0) (-18.471 -10.52 0) (18.471 10.52 0) "?" }

        pointkey { 5 (-36.942 -21.04 0) (-19.771 -8.596 0) (19.771 8.596 0) "?" }

        pointkey { 10 (-79.083 -34.384 0) (-28.873 1.5352 0) (28.873 -1.5352 0) "?" }

        pointkey { 20 (-152.44 -14.9 0) (-36.676 9.7421 0) (36.676 -9.7421 0) "?" }

      }

    }

  }

  objectelement { "eobject02" "object01"

    loc { (-34.384 21.776 0) }

    controller { "position"

      track {

        pointkey { 0 (-34.384 21.776 0) (-24.642 4.0115 0) (24.642 -4.0115 0) "?" }

        pointkey { 5 (-83.668 29.799 0) (-51.576 -10.029 0) (51.576 10.029 0) "?" }

        pointkey { 25 (-240.69 -18.339 0) (-78.51 -24.069 0) (78.51 24.069 0) "?" }

      }

    }

  }

  objectelement { "eobject03" "object01"

    loc { (10 20 30) }

  }

}

 

We are interested in the code colored in orange. Notice that each object that was animated got a position controller. Each key frame has a record of the frame number (highlighted with yellow) and of the x, y, z position of the object (highlighted in green). The other values in the brackets following the coordinates define the tangents to the path in the key positions. If these values are 0 each, the path becomes a series of straight segments between consecutive keys. Now we are in the position to animate eobject03 outside Anim8or! Close the file in Anim8or. Insert with the text editor, right after

  objectelement { "eobject03" "object01"

    loc { (10 20 30) }

the following code lines:
 

  controller { "position"

      track {

        pointkey { 50 (10 20 30) (60 10 0) (-60 -10 0) "?" }

        pointkey { 70 (100 100 0) (10 40 0) (-10 -40 0 "?" }

      }

    }

 
You realize by now the meaning of this code: eobject03 will begin moving at frame 50 from the position (x, y, z) = (10, 20, 30) on a smooth curve till frame 70 arriving to coordinates (100, 100, 0). Save the file in the text editor and open it in Anim8or. In Scene mode play the animation. You should see eobject03 moving as predicted above.

You could do experiments in a similar way to see what code Anim8or generates for different animated elements (camera, lights), but for now we are interested only in the code for the animated eobjects. Here is a comprehensive code for an animated object:

  objectelement { "eobject01" "object01"

    loc { (0 0 0) }

    facestarget { }

    target { "camera01" }

    controller { "position"

      track {

        pointkey { 0 (0 0 0) (-43.553 9.1691 0) (43.553 -9.1691 0) "?" }

        pointkey { 11 (-87.106 18.338 0) (-33.238 -6.0172 0) (33.238 6.0172 0) "?" }       

        pointkey { 21 (-132.95 -24.069 0) (5.7307 -29.226 0) (-5.7307 29.226 0) "?" }

        pointkey { 33 (-64.183 -98.567 0) (34.384 -37.249 0) (-34.384 37.249 0) "?" }

      }

    }

    controller { "orientation"

      track {

        qkey { 0 (0 0 0 1) "?" }

        qkey { 7 (0.11839 0.22069 0.46637 0.84840) "?" }

        qkey { 26 (0.24406 -0.67370 0.30355 0.62803) "?" }

      }

    }

    controller { "scale"

      track {

        floatkey { 0 1 "?" }

        floatkey { 10 2.4596 "?" }

        floatkey { 28 7.846 "?" }

      }

    }

    controller { "visibility"

      track {

        booleankey { 0 1 "?" }

        booleankey { 11 0 "?" }

        booleankey { 17 1 "?" }

      }

    }

  }

This code is Anim8or’s record for animating eobject01, an instance of object01, initially resting at coordinates (0, 0, 0). The code in pink indicates that eobject01 faces the camera. The orange code lines control the movement in time, as described above. The green code rotates the object. For each key frame is given the frame number followed by the orientation of the object as a quaternion. (A quaternion is a set of four numbers codifying the orientation of an object, widely used in animation programs. Math details can be found on the net.) Colored in blue is the code for scaling, self-explaining. The yellow code gives the visibility of the object (visible between frames 0 – 10, hidden between 11 – 16, visible again from frame 17).

Now we have enough knowledge to deal with PA in Anim8or. Two problems remain:

1. Designing PA for a desired effect

2. How to write the code to animate thousands of particles before we get old?

A couple of examples will make things clear.

 

back               next