Adding Animation to the Effect

Adding animation to the effect involves being able to programmatically control the progression of the star streak effect from frame to frame, starting with the original starfield and progressing to a point where all the stars have streaked past the camera. For several weeks, I thought about different algorithms that might allow me to accomplish this task. Finally, I came to the algorithm that is presented below.

NOTES: For all the following discussion, the units are in pixels and the jump point location is located in the center of the HI.

The animation algorithm basically works by first taking the HI image, with all its stars, and positioning it in the XY plane at a particular distance down the negative Z axis. The distance the HI image is placed down the negative Z axis depends on the percent along the animation for this frame is supposed to go. If say, the effect is supposed to be at 0%, which represents no streaking at all, then the HI image will be placed down the negative Z axis a distance of half the HI's pixel width. If the effect is supposed to be at 100%, then the HI image is placed down the negative Z axis at a distance of just two pixels. The percent complete values for the hyperspace jump pictures shown on the previous web page are as follows: 0%, 10%, 20%, 50% and 100%.

In the XY plane at Z=0, a virtual viewplane is then created and a viewport, with a width of 2 pixels, is centered within the viewplane. The viewport has exactly the same proportions as the larger HI image in back of it. A virtual camera is then placed in front of the viewplane along the positive Z axis at a distance of 1 pixel, i.e. (0,0,1). The below diagram explains the basic setup.

(Image)


Once we have this type of setup, we can then draw a line segment from the virtual camera postion to a star position on the HI. This line segment must intersect the viewplane somewhere. Finding this intersection point is often called doing a projection. If the projection point is in the interior of the viewport, then this point represents the point the star streak should end on the HI. In this case, the end of the star streak stays on the screen. Of course, some of the star streak endpoints will project outside the viewport. In these cases, these star streaks are simply lopped off so that they just end on one of the edges of the HI. See the below diagram for an example of these two cases.

(Image)


Once the location of the interior viewport projection points are determined, these points must be translated back into the HI's pixel space so that we can have a starting and ending point for each star streak vector that ends on the interior of the HI.

It should be noted that the above setup results in the virtual camera having a 90 degree field of view. This corresponds to the virtual camera using about a 28mm wide angle lens to "photograph" the scene.

Off Center Hyperspace Jump Points

Of course, the user could specify the hyperspace jump point to be somewhere other than the center of the HI. In this case, we must move both the viewport and the HI image before we do the projection. For everything to remain consistent, we must move both the HI and the viewport in scaled unison with each other. We move both these viewports so that the jump point on the HI and the jump point on the viewport each line up with the (0,0) coordinate in the XY plane. We then do the projections for each star and map the corresponding viewport projection points back into the HI pixel space again. See the below diagram for an example of this situation.

(Image)


The below diagram and equations show how we do the above projections down onto the Z=0 plane.

(Image)


Last Updated: June 18, 2000
HTML URL: http://geocities.datacellar.net/~special_effect/hyperspace_aa.html
E-Mail: special_effect@geocities.com or click here
1