Director MX - Flash Integration - Flash Video Textures (a QT performance comparison)
 

 

Flash Video Textures (a QT performance comparison)
For quite some time now people have used non-DTS QuickTime videos and some imaging Lingo in order to create animated textures in 3D. This is a trio of example files that provides the ability to draw some performance comparisons between using QuickTime and Flash to achieve this goal.

Below you will find an explanation of how the movies are playing and applying the QuickTime and Flash files as textures within 3D followed by links to three different demo files. One of these demo files uses a QuickTime movie provided as test media while the second and third files use Flash movies that contain two different converted versions of that same QuickTime file each encoded at a different data rate.

Enjoy.

 

How were these movies created?
The general technique is the same in all three demo files and it's not really complicated. The idea here is that we want to avoid the need to image the cast member itself (not supported by QuickTime) and instead use the stage image in order to capture the playing video in an image object. Once that image object is obtained it can be applied to a model in 3D with relative ease.

In order to do this, to image the playing video off of the stage, the video needs to be playing as non-direct to stage so that it gets composited and is therefore available via (the stage).image. In this case I'm using 320x140 video/swf sprites that are placed on the right half of the stage, the left half of the stage is occupied with the UI elements that will be exposed to the end user (the movie's title, the 3D sprite as well as the simple renderer/FPS display information and the start/stop button. This leaves me with a stage that's 640x320.

Once the stage and its sprites are arranged correctly I then use some rather simple Lingo to grab the image of the right-half of the stage and then downsample that image to a size of 256x256 (from 320x320) and use that image object to update a texture that was created in the 3D member from an initial, solid black image object. For the sake of brevity I'm not going to explain how I used Lingo to create a simple box primitive, shader and texture, please see the sample source files for these details. The image object that I created for this purpose and the texture applied to the model are both updated every frame, thus providing an animated texture in 3D. Finally, in order to attempt to guage "best performance possible" I set the movie's frame rate tempo to 999 fps.

In using videos as textures in 3D you really don't want the end user to see the video sprite playing on stage and appearing in the 3D world as a texture, so we must take a few simple steps to hide the playing video from our user's eyes. In order to do this I made some very simple modifications to the HTML tags used to embed the DCR in the page. The first modification was to the swStretchStyle parameter which normally defaults to a value of fill indicating that the DCR should scale to fill the available display rect in the page. For my purposes I set this parameter to none so that no resizing of the movie occurs. The next modification was to set the display size of the embedded DCR to be only 320 pixels instead of the 640 pixels of the actual stage. Combining these two modifications causes the movie to play in the browser with only the left-half of the stage being shown (see the screen-shot above). This causes the playing video to actually be on stage, and thus visible to imaging Lingo, but not actually rendered in the browser so that the end user cannot see the playing video itself.

I used this technique to create three separate demo files, one containing the original QuickTime file and two others containing Flash movies created using Sorenson's Squeeze utility. The two demo files containing Flash movies are different in that I used Squeeze to create two versions of the QT video in Flash, each compressed with a different data rate (96Kbps and 300Kbps).

Show me the demos!
In total there are three movies to be see, for each movie I provided an HTML page that constrains the viewable stage to only 320x320 as you would deliver to an end-user. In addition I created HTML pages for each demo that do not constrain the viewable space (swStretchStyle is left at fill and the embedded DCR's width is left at 640 pixels). Click on the links below to see each of the examples created:

QuickTime - cropped
QuickTime - full

Flash (300Kbps) - cropped
Flash (300Kbps) - full

Flash (96Kbps) - cropped
Flash (96Kbps) - full

How do I use the demos to test frame rates against various renderers?
The demo movies contain some very simple UI elements that behave as follows:

Click on the START button to begin a frame rate testing sequence, then click STOP when you are done. The movie will track the actual number of frames rendered and the milliseconds elapsed during this interval and calculate the frame rate based on these values. When you click the START button the fps display is cleared (set to "--") and then pressing STOP will result in a display of the computed fps value along with the renderer that was being used.

Click on the "renderer" label (click on the word itself) to cycle through available 3D renderers. If you are in the middle of a test run then that run will be terminated and a calculated fps value will be shown. It is best to set your renderer then perform a test run as opposed to cycling renderers during test runs.

NOTE: please be sure that your Shockwave player is set to obey content settings with respect to what 3D renderer is being used. To do this right-click/control-click on the movie and selected 3D Renderer > Obey Content Settings.

Source files
Here are links to all of the source files and source media used to create these demos.

non-dts_mov.dir
non-dts_swf300.dir
non-dts_swf96.dir

reloaded_teaser_1_220.mov
reloaded_teaser_1_ISDN.swf
(300Kbps)
reloaded_teaser_1_Bband.swf (96Kbps)

 

page last updated 11-Dec-2002 | tom higgins - thiggins@macromedia.com