CREATING STEREO MOVIES WITH DATA EXPLORER

By Terence Griffin, NIST Gaitherburg 301-975-4703

Introduction

We will present a specific example of a DX application that creates stereo movies. The method described can be used in any DX application that displays 3D objects.

Starting with a network that displays a view of a 3D visualization, it is a straightforward matter to create a sequence of image frame pairs to be viewed with stereo display apparatus such as the Crystal Eyes stereo viewing system.

The basic idea is to take the original camera and use it to create a new camera shifted slightly to the left. It is important to keep the new (left) camera pointed at the same 'to' location.

This new camera is then used as the default camera for a new Image module. The Image module will create the output image files. Displaying the left view is necessary due to the way DX saves images. The image to be saved MUST be displayed on the screen. If there is an overlapping window in front of the image window, the portion that overlaps will also be stored in the output file. It is important to keep the image window in front of all other windows.
 

The Application

The application we will use in this example is a visualization of a simulation of particulate matter in a  fluid flow. This simulation models high performance concrete.

The particles are elliptical and vary in size. Their initial positions are randomly determined. The motion of the particle, position and attitude, are determined by the simulation model. A rectangular fin structure has been added to each particle in the visualization to make it easier to discern the attitude of the particle. This is not present in the simulation and has no effect on the motion of the particles.

We had added the ability to write frames to individual image files in a previous version of the visualization. Now we will add another camera to produce a second image for stereo viewing.
 

The Implementation

The collected particles, bounding box and frame counter are sent to an Image module for display and image output. We take the camera output from that Image module and use it as a starting point.
  1. Take camera from output of Image module for main view. This will be the right image.
  2. We use the Inquire module to obtain the current value of the 'from' position (a 3-vector: [b.x, b.y, b.z]).
  3. Next we use a Compute module to shift the camera position. In our case, we shift in the X direction which represents left-right on the screen. The current position is input to the Compute on the 'b' input, so the X component is denoted as 'b.x.' We use a negative number to move it to the left. The exact amount of shift for each component (X, Y and/or Z) depends on the position and direction of the camera. Had our camera been pointing in different direction, we may needed to used a combination of X Y and/or Z offsets. This is because the camera position is given in global coordinates. Also the angle between the slight lines (from each camera to the 'look-to' point) must be taken into consideration. The closer the camera is to 'look-to' point, the larger this angle will be. If the angle is too large,  the images will be too dissimilar to be suitable for stereo viewing.
  4. After computing the new (left) camera position, we put the main view (right) camera into the 'camera' input of the Update Camera module. We put the new 'from' vector as computed above into the 'from' input of Update Camera. Update Camera generates an entirely new camera. based on the input camera with the specified parameters modified. In this case we are changing one parameter, the 'from' position. This new camera will be the left view of the stereo pair.
Now that we have the new camera, we connect it to the 'Default Camera' input of a new Image module that generates the left view. The object to be viewed is the same as for the Main view. The  'Object' tab for both Image modules should be connected to the exact same source. The 'Reset Camera' input is always set to 1. This is done by editing the configuration for the Image module. This will force the Image module to use the camera provided on the 'Default Camera' input instead of an internal default.

This image module will also save the left view images to files, so we have to implement a method for systematically managing the filenames, file types and the Record Enable flag.

For any recording to take place, in stereo or otherwise, the Main View must be set to On. This will dynamically activate the Image module(s) that will save the images to disk files.

The user supplies a filename base. This can be anything the user wants. If the user has set Main Record to Off, the filename is ignored and no image files are generated. If it is set to On, we add a sequence or frame number and a suffix based on the output file type the user has chosen. The sequence number is incremented when a new image is generated.  With Main Record set to On, we are not recording a stereo movie. This filename is passed on to the Image module for the Main (right) view. If Main Record is set to Stereo, then two thing happen. First we add a ".r" (for "right") just before the extension to the Main (right) view filename. Second, we create and second filename with a ".l" (for "left") just before the extension, instead of ".r." This filename is NOT created unless Main Record is set to Stereo. The left filename is passed to the Image module for the left view. The suffix is the same for both files (that is the file types are the same).

The Record Enable flag for the right view must be on when Record Main is set to either On or Stereo. The Record Enable flag for the left view must be on only when Record Main is set to Stereo. Otherwise it must be off. In either case recording only takes place if the Main View is set to On.
 

Conclusion

When recording in stereo, the output is a pair of files for each frame of the animation, one taken from a point of view slightly to the left of the other. They are written to files whose names are appended with the frame number followed by a ".r" or ".l" depending on whether it is a right or left view. With this file naming protocol, an ASCII sort of the filenames will produce a list of stereo pairs in order of frame number, alternating left and right with the left image appearing first.

With such an ordering, a utility such as ilstereoview can easily be used to view the movie in full stereo using the Crystal Eyes system. Contact Steve Satterfield at NIST Gaithersburg, 301-975-5637 for more information about ilstereoview.