Shadertoy & .NET MAUI CommunityToolkit MediaElement

A side effect from integration of external video signal coming from native code C++ application with a .NET MAUI Blazor app: a reference video source (based on nice Shader Art Coding Introduction shadertoy – an HLSL equivalent can be found in resources of the attached application) is taken into .NET MAUI CommunityToolkit MediaElement control (see also Play Audio and Video in .NET MAUI apps with the new MediaElement).

The application below is a reduced version to simply put the video source into a slim C++ application, see this tiny CompositionVideoDemo application if you are curious how to host a Windows.Media.Core.MediaSource instance in a C++ application.

There is full hardware video acceleration of course, the live video is rendered directly by the shader to a Direct3D 11 device. Then the signal transits into the control bypassing system memory, hence minimal CPU load and reasonable GPU load on its 3D engine.

Leave a Reply