Allow plugins to render directly to the PluginHost node (as optional mode)

Some plugins have smaller UIs and for these I would sometimes love to have the plugin’s UI directly visible inside the PluginHost node. So the node would directly show the plugin’s live UI with input - not in a dedicated window but right in the canvas of MNodes, inside the node of the PluginHost (which then becomes as large as the plugins’s window). Mouse input is directed to the plugins UI when iteracted with it and keyboard input will be directed to that node when selected / focused.

I know that this a bit complicated. But it would have the benefit to work with VST3 plugins just as they were a part of MNodes, directly accessing their UI on screen, inside the node graph. This would be really elegant UX wise for some plugins.

Note that this option must be enabled for each PluginHost manually. It shall not be anabled by default. It is just for single plugins to make them accessible inside of the graph when desired.

This is just an idea for brainstorming :slight_smile: If it turns out that is is technically too demanding and therefore not doable - fine.

This could be a way to do it on Windows (needs checking of course):

  1. Host the VST3 UI Off-Screen
    Create a hidden, native parent window (HWND) positioned outside the visible screen coordinates (e.g., at -10000, -10000). Pass this handle to IPlugView::attached so the plugin draws blindly into it.
  2. Initialize Windows Graphics Capture (WGC)
    Create a GraphicsCaptureSession targeting your hidden HWND. WGC hooks directly into the Desktop Window Manager (DWM) composition layer, forcing it to redirect the plugin’s live GPU swapchain into an accessible Direct3D 11 Texture buffer at 60+ FPS, regardless of whether the VST3 renders via software, OpenGL, or DirectX.
  3. Bridge into Your Engine Canvas
    • If your node engine is DirectX-based, map this D3D11 texture directly onto your node’s render quad.
    • If your engine is OpenGL-based, pass the D3D11 texture handle directly to your OpenGL context using the hardware-accelerated WGL_NV_DX_interop extension.
  4. Apply Arbitrary Scaling & Shaders
    Draw the resulting texture as a native element inside your node bounding box. You can now smoothly scale, zoom, mask, or apply custom shader effects to the texture in real time.
  5. Inverse Input Remapping
    Intercept mouse inputs over your node canvas, mathematically reverse your UI’s zoom/pan matrix back to 1:1 local coordinates, and forward them to the hidden HWND using PostMessage (WM_LBUTTONDOWN).