Transparent Video Overview

MPEG2 does not support transparent video by default, but we can create the same effect by decoding 2 MPEG2 video streams, and assigning them to different channels of a custom CgFx shader.

This shader supports graduated, or smooth, alpha channels. This will allow for long slow alpha gradients. This is an example of a supported alpha mask:

Assigning Shaders in Maya

  • Go to Window->Settings/Preferences->Plug-In Manager.
  • Enable Loaded and Auto Load for cgfxShader.mll, and close the Plug-In Manager.
  • Click Create->Polygon Primitives->Plane.
  • Click Create UVs->Automatic Mapping to apply a UV set to the plane.
  • Select Shading->Smooth Shade All and Shading->Hardware Texturing.
  • Enable the Hypershade/Perspective view.
  • Click the Cgfx Shader shiny ball icon to create a new CgFx material. It will be pink by default.
  • Middle-click and drag the pink ball over the recently created plane to apply it to the plane. The plane will turn pink.
  • Select the cgfxShader1 tab. Your screen should look like the above image.
  • Download the TextureAlpha.cgfx from our Dashboard.
  • Click on the folder to the right of the CgFx File area. Navigate to the location on your hard drive where you saved the TextureWithAlpha.cgfx file, and select the file.


Applying Textures

  • Click the checkerboard box next to the ColorSampler line, select File, and click the folder to the right of Image Name to pick the image with the desired RGB colors. Any alpha data will be ignored.
  • The image must be named with the ”video\_” prefix to be recognized as a video target by Previzion.
  • Click on the polygon to show the cgfxShader1 tab again, and click the checkerboard box next to the AlphaSampler.
  • Select File as before, and select the image that will be used to drive transparency. As before, this needs to be named with the ”video\_” prefix.
  • The only part of the transparency image that will be used is the R channel. Since matte images are by nature grey scale, the red, green, and blue channels are all identical, so the choice is arbitrary.

The resulting image should appear as above. A red sphere has been placed behind the polygon plane to demonstrate the correct transparency display in the viewport.

In order for the CgFx shaders to be embedded in the FBX file, the Embed Media box must be checked in the FBX export.

The above image shows how this appears when loaded into Previzion, with a red sphere behind the plane to demonstrate transparency. The correct MPEG2 RGB and grey scale matte videos can then be loaded and linked to the appropriate video targets.