AGI Components with Insight3D Alpha 2008 r8
Dynamic Images on Models

Insight3D's dynamic data pattern can be utilized by many objects within the library, including COLLADA models, allowing for users to create interesting visual effects. Any image that is used by a COLLADA model for texturing can be replaced with a video or video stream. 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 conditioner attributes to add effects to the video. See below for the complete list of attributes supported by the video_texture element.

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.

The ancillary file pattern 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 dynamic images constructed from video data 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.

CopyC#
IAgGxCentralBody earth = sceneManager.CentralBodies("Earth");
IAgGxPrimitiveModel model = new AgGxPrimitiveModel();
model.InitializeCartographic(earth,
    Program.uriLocalDataPath + "Models/hellfireflame.dae",
    Trig.DegreesToRadians(49.88),
    Trig.DegreesToRadians(-77.25),
    5000);
model.ExponentialScale = 2;
sceneManager.Primitives.Add(model);
Note: Currently, dynamic data support for COLLADA models is provided through the IAgGxVideoData interface, which is a specialization of IAgGxDynamicImageData. In the future, programmatic manipulation of model textures and the use of IAgGxDynamicImageData plugins 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" extension replaced with "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:

CopyXML
<?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:

CopyXML
<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>
<!--

Inidividual frames of the smoke.avi and flame.mov videos that are mapped to replace placeholder images in the hellfireflame.anc ancillary file. Each placeholder images'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 dynamic image in the image's place. Dynamic images 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, IAgGxDynamicImageDataConditioner is used to condition 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 conditioners to the video data, to achieve a variety of effects.

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 When set to true, enables looping of the video when the animation_startdate and animation_enddate attributes are not present.
video_framerate Optional double Specifies the framerate of the video when the animation_startdate and animation_enddate attributes are not present.
animation_startdate Optional double The animation start date in epoch seconds at which the video will begin playing
animation_enddate Optional double The animation start date in epoch seconds at which the video will stop playing.
video_starttime Optional double The start time of the video in seconds.
video_endtime Optional double The end time of the video in seconds.
video_startframe Optional long The start frame of the video.
video_endframe Optional long The end frame of the video.
conditioner_alphafromluminance Optional boolean When set to true, the IAgGxConditionerAlphaFromLuminance conditioner will be applied to each frame of the video.
conditioner_alphafrompixel Optional boolean When set to true, the IAgGxConditionerAlphaFromPixel conditioner will be applied to each frame of the video.