Click or drag to resize

Video Streams on Models

VideoStream can be used with many classes in Insight3D, including COLLADA models. This allows you to stream video to a model's textures. The models are self contained, so you can distribute the models and videos and they can be used in other Insight3D applications. Any image that is used by a COLLADA model for texturing can be replaced with a video. To allow for interoperability with different 3D modeling applications and for models to be self contained and redistributable, a separate ancillary file, corresponding to the COLLADA dae file, is used to provide mapping from the static images within the COLLADA model to the videos that will replace them during rendering in Insight3D. The ancillary file format also supports many options to tweak the playback of the video, and filter attributes to add effects to the video. See below for the complete list of attributes supported by the video_texture element.

Video on Model
A COLLADA model using an ancillary file to replace two textures in the model with videos. Since each texture contains a transparent attribute to apply an alpha mask, the mask is also applied to each frame of the video as it would be applied to the static images being replaced.
Ancillary File

The ancillary file allows for your COLLADA models to be edited with any 3D modeling application using placeholder images for textures. When the model is loaded into Insight3D and the ancillary file is present, the references to the placeholder images in the ancillary file are mapped to videos within Insight3D. When the COLLADA model has an ancillary file associated with it, it can be loaded and used like any standard model in Insight3D, as seen below. The actual COLLADA model is never modified.

Java
CentralBody earth = CentralBodiesFacet.getFromContext().getEarth();

ModelPrimitive model = new ModelPrimitive(baseUri.resolve("hellfireflame.dae"));
model.setPositionCartographic(earth, new Cartographic(Trig.degreesToRadians(49.88), Trig.degreesToRadians(-77.25), 5000.0));
model.setScale(Math.pow(10.0, 2.0));
SceneManager.getPrimitives().add(model);
Note Note

Currently, RasterStream support for COLLADA model textures is provided through the VideoStream interface, which is a derived class. In the future, programmatic manipulation of model textures and the use of RasterStream classes in the ancillary file will be supported.

The ancillary file should exist in the same directory as the COLLADA model, and have the same name as the COLLADA dae file, but with the .dae file extension replaced by .anc. Below, the ancillary file format is shown via the hellfireflame.anc ancillary file, included in the HowTo example, corresponding to the hellfireflame.dae COLLADA model:

XML
<?xml version="1.0" standalone="yes"?>
<ancillary_model_data version="1.0">
    <video_textures>
        <video_texture image_id="smoketex_tga" init_from="smoke.avi" video_loop="true" video_framerate="60" />
        <video_texture image_id="flametex_tga" init_from="flame.mov" video_loop="true" video_framerate="60" />
    </video_textures>
</ancillary_model_data>

The video_textures section of the ancillary file contains video_texture elements for each image that will be replaced within the COLLADA model, and relevant attributes to associate the image with a video. If we examine the library_images section of the hellfireflame.dae COLLADA model, we see that each video_texture element's image_id attribute in the ancillary file maps to an image element id attribute in the COLLADA model's dae file:

XML
<library_images>
  <image id="flametex_tga">
    <init_from>flametex.tga</init_from>
  </image>
  <image id="flamealpha_tga">
    <init_from>flamealpha.tga</init_from>
  </image>
  <image id="smokealpha_tga">
    <init_from>smokealpha.tga</init_from>
  </image>
  <image id="smoketex_tga">
    <init_from>smoketex.tga</init_from>
  </image>
</library_images>
Smoke and Flame Videos
Individual frames of the smoke.avi and flame.mov videos that are referenced by the ancillary file. Each placeholder image's alpha mask is shown below each frame of the replacement video.

When Insight3D's COLLADA loader encounters a texture containing an image that is mapped to a video in the ancillary file, the video is loaded as a RasterStream in the image's place. The video textures also support common COLLADA texturing techniques that typically apply to static images, such as applying alpha masks with a texture sampler through the transparent attribute of the texture. When such a case is encountered, FilteringRasterStream is used to filter each frame of the video to apply the same effect that a static image would have applied. The ancillary file also has support for applying other common filters to the video, to achieve a variety of effects.

Attributes supported by the ancillary file video_texture element

Attribute

Requirement

Type

Description

image_id

Required

string

The id attribute of the image in the COLLADA dae file that will be replaced with the video specified in the init_from attribute.  The value of the image_id attribute corresponds to the id attribute value of the image element contained within the library_images section of the COLLADA dae file.

init_from

Required

string

The filename or URI of the video that will replace the init_from attribute of the COLLADA image element specified with the image_id attribute.

video_loop

Optional

boolean

Sets the Loop (get / set) property of the video.

video_framerate

Optional

double

Sets the FrameRate (get / set) property of the video.

video_starttime

Optional

double

Sets the StartTime (get / set) of the video, in seconds.

video_endtime

Optional

double

Sets the EndTime (get / set) of the video, in seconds.

video_startframe

Optional

long

Sets the StartFrame (get / set) of the video.

video_endframe

Optional

long

Sets the EndFrame (get / set) of the video.

filter_alphafromluminance

Optional

boolean

When set to true, a AlphaFromLuminanceFilter will be applied to each frame of the video.

filter_alphafrompixel

Optional

boolean

When set to true, a AlphaFromPixelFilter will be applied to each frame of the video.