Mapping Video

So, I’m trying to map a video texture onto a Xaml surface. So far, so easy. Except I want to apply the diffuse data to the emissive channel, because that’s closer to the way LightWave works. This is fine with static textures, but there’s a problem with videos. I generate as much as possible in a ResourceDictionary, and the relevant Xaml looks a little like this:

<VisualBrush x:Key="media_element" Opacity="1.0">
  <VisualBrush.Visual>
    <MediaElement Source="#filename#" />
  </VisualBrush.Visual>
</VisualBrush>
<DiffuseMaterial Brush="{StaticResource media_element"} />
<EmissiveMaterial Brush="{StaticResource media_element"} />

The problem is that even when I specify that the DiffuseMaterial and EmissiveMaterial brushes point to the same element, they get their own players which don’t start in sync, so you get ghosting and funky audio ringing. I can’t see an obvious way around this… Anyone?

Leave a Reply

Entries (RSS)