Headless render of Voronoi shadertoy via D3D11 and Media Foundation

Fancy stuff goes first:

This is an application that renders this shadertoy by Taron into a video file with requested metrics. Why?

  1. it looks great
  2. it is a source of content used for various development and testing purposes

Video is rendered on GPU (Radeon RX 570 Series in this particular case, Intel(R) UHD Graphics 630 does the job great too), compressed with the help of GPU hardware and the steps are also connected one to the other through Media Foundation without leaving GPU, and in this sense it is worth mentioning that intensive render process happens with CPU load near idle levels:

A run to produce a 2160×1440@60 video file with duration of 300 second (above on YouTube) took 209.56 seconds, that is the process runs 30+ percent faster compared to real-time, and according to task manager charts above it’s the encoder limitation: 3D part alone runs faster than this.

C:\>RenderMfSw -re 2160 1440 -ra 60 -d 300 -b 8000000 Output.mp4
Elapsed Time: 209.56 seconds

Video frames are rendered into DXGI_FORMAT_B8G8R8A8_UNORM (MFVideoFormat_ARGB32) textures, so there is an implicit RGB to YUV conversion, which at this time happened on AMD MFT side and presumably loads GPU compute queue with the conversion task.

Have fun generating your own content: it is possible to define resolution, frame rate, duration and bitrate of interest.

C:\>RenderMfSw
Syntax: RenderMfSw [options] <output-path>

Options:
  -DisableDebugOutput - Disable forward of debug output to console output in debug mode (should appear before -Debug)
  -Debug[:<Normal|Full|<Value>>] - Enable self-debugging capability with specific minidump type
  -EnumerateAdapters - Enumerate DXGI adapters and exit
  -AdapterIndex <index> - Specify DXGI adapter index (default is 0)
  -Resolution <width> <height> - Specify resolution of generated video (default is 1920x1080)
  -Rate <frame-rate-numerator>[/<frame-rate-denominator>] - Specify frame rate of generated video (default is 60)
  -Duration <duration> - Specify duration of generated video in seconds (default is 60)
  -Bitrate <bitrate> - Specify bitrate of generated video in seconds (default is 10 MBps)

The HLSL source code for the shaders is embedded as an RCDATA resource into the executable in source code, so it is possible to extract and even update if needed (for the most curious).

Download links

Binaries:

  • 64-bit: RenderMfSw.exe (in .7z archive)
  • License: This software is free to use

Leave a Reply