AB4D Forum

Full Version: Overlay 3d rendering over recorded videos. I this possible with AB4D?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to overlay 3d rendering over recorded videos. I this possible with AB4D?

Is it also possible for realtime videos?
It is possible to overlay 3D objects over a video in a WPF application. But you need a video player that composes well with other WPF objects - this means that you are able to add WPF objects (buttons, text, etc.) over the video. If this can be done, then you can also add 3D objects over the video. Some video players require their own section of the screen (hwnd) and in this case you cannot add WPF objects over the video.

You can use a WPF's MediaElement control to play the video and add 3D content over the video.

For example:
Code:
<Grid Name="MainGrid">
    <MediaElement Source="c:\videos\video.mp4"></MediaElement>
    <Border Name="ViewportBorder" Background="Transparent">
        <Viewport3D Name="MainViewport">
            <visuals:WireGridVisual3D CenterPosition="15 0 0" Size="130 100" WidthCellsCount="13" HeightCellsCount="10" LineColor="#555555" LineThickness="2"/>

Note that you need to set Border.Background to Transparent to see the video through the 3D scene.

A sample application that shows a video playing behind a 3D scene is also attached to this post.


If you need to show more complex 3D graphics with advanced rendering techniques, you can also use  Ab3d.DXEngine to render 3D scene on top of a video (use DXViewportView.PresentationType == "DirectXImage").


Note:
The MediaElement control is part of the WPF controls so I cannot provide a lot of support for that. Please check for more information about that on the internet. You can find a basic sample on https://wpf-tutorial.com/audio-video/playing-video/