Keywords: instance, motion

Summary

This scene is used to demonstrate nested or hierarchical motion. In the scene, a 2 x 2 grid of balls (spheres) and cube rotate about a central point and that point orbits around a second point.

Details

There are two levels of motion in this scene: (1) a spinning group of items (a cube and 4-ball set) and (2) the orbiting of that spinning group. This demo uses two different motion models (DeltaMotion and GenericMotion) to demonstrate variety and flexibility. There is no reason that these specific motion models must be used at the respective levels outlined in this example. The user can create virtually unlimited levels of hierarchy and use any of the available motion models at each level.

Important Files

This demo is primarily focused on scene motion. Therefore, all the important files are in the geometry folder.

The base cube and ball

The base cube is define using the built-in DIRSIG "box" primitive in the file geometry/base/cube.glist. The box is 2 x 2 x 2 and cenetered at the origin (0,0,0):

<geometrylist enabled="true">
  <object>
    <basegeometry>
      <box>
        <matid>2</matid>
        <lowerextent><point><x>-1</x><y>-1</y><z>-1</z></point></lowerextent>
        <upperextent><point><x>+1</x><y>+1</y><z>+1</z></point></upperextent>
      </box>
    </basegeometry>
    <staticinstance/>
  </object>
</geometrylist>

The 2 x 2 set of balls are all instances of the built-in DIRSIG "sphere" primitive defined in geometry/base/ball.glist. The sphere is constructed at the origin (0,0,0) and a radius of 1 (diameter of 2):

<geometrylist enabled="true">
  <object>
    <basegeometry>
      <sphere>
        <matid>2</matid>
        <center><point><x>0</x><y>0</y><z>0</z></point></center>
        <radius>1</radius>
      </sphere>
    </basegeometry>
    <staticinstance/>
  </object>
</geometrylist>

The cube and 4-ball group

The cube and 2 x 2 set of balls are positioned relative to each other in the geometry/wrappers/item_set.glist file, which statically instances the base cube GLIST once and the base sphere GLIST 4 times:

<geometrylist enabled="true">
  <object>
    <basegeometry>
      <glist><filename>base/cube.glist</filename></glist>
    </basegeometry>
    <staticinstance name="item0">
      <translation>
        <point><x>0</x><y>0</y><z>0</z></point>
      </translation>
    </staticinstance>
  </object>
  <object>
    <basegeometry>
      <glist><filename>base/ball.glist</filename></glist>
    </basegeometry>
    <staticinstance name="item1">
      <translation>
        <point><x>+2</x><y>-2</y><z>0</z></point>
      </translation>
    </staticinstance>
    <staticinstance name="item2">
      <translation>
        <point><x>+2</x><y>+2</y><z>0</z></point>
      </translation>
    </staticinstance>
    <staticinstance name="item3">
      <translation>
        <point><x>-2</x><y>+2</y><z>0</z></point>
      </translation>
    </staticinstance>
    <staticinstance name="item4">
      <translation>
        <point><x>-2</x><y>-2</y><z>0</z></point>
      </translation>
    </staticinstance>
  </object>
</geometrylist>

Note the the center of the group is at the origin (0,0,0).

Spinning the cube and 4-ball group

The cueb and ball group is then instanced with a dynamic instance driven by the DeltaMotion model in geometry/lists/spin.glist to introduce the spin of the group around their relative origin:

<geometrylist enabled="true">
  <object>
    <basegeometry>
      <glist><filename>wrappers/item_set.glist</filename></glist>
    </basegeometry>
    <dynamicinstance>
      <motion type="delta">
        <filename>motion/50_rpm.mov</filename>
      </motion>
    </dynamicinstance>
  </object>
</geometrylist>

Orbiting the spinning set

The last component of the chain is the orbit of the spinning 4-ball set. This is accomplished by instancing the spinning 4-ball set with a dynamic instance driven by the GenericMotion model (driven by a PPD file that traces out an circular orbit) in geometry/lists/orbit.glist:

<geometrylist>
  <object>
    <basegeometry>
      <glist><filename>lists/spin.glist</filename></glist>
    </basegeometry>
    <dynamicinstance>
      <motion type="generic">
        <filename>motion/orbit.ppd</filename>
      </motion>
    </dynamicinstance>
  </object>
</geometrylist>

Setup

This section includes any step-by-step instructions for running and visualizing the simulation.

Single-frame simulation

To run the single-frame simulation, perform the following steps:

  1. Run the DIRSIG demo.sim file

  2. Load the resulting demo-t0000-c0000.img radiance file in the image viewer.

Multi-frame simulation

To run the multi-frame simulation, perform the following steps:

  1. Run the DIRSIG video.sim file

  2. The resulting set of radiance image files (demo-t0000-c0000.img through demo-t0000-c0063.img) can be converted and encode into a multi-frame (video) format of your choice.

Results

The single-frame simulation produces a single frame.

images/demo.png
Figure 1. The output of the single-frame simulation.

The multi-frame "video" simulation produces 64 image frames that span the 2 second task window.

images/video.gif
Figure 2. Animation of multi-frame simulation.