We are in the need of Unity 5.x Pro rendering itself transparently when hosted in a WindowsStore 8.1 application - in other words, we need other XAML elements at lower Z-order to show through the unity layer. Or think of Unity being a HUD for XAML elements underneath. Is this possible?
Tried multitude of settings, including replacing the Graphics’ RenderBuffer with ARGB32 textures, as well as during OnGUI() a Graphics.Blit to the framebuffer with a custom shader overwriting target alpha value.
But they have multiple swapchains for specifying UI, while Unity applications have only one… Still there’s no transparency there, if I am not mistaken
For swapchain transparency, it seems to alpha premultiplication, as shown here https://code.msdn.microsoft.com/windowsapps/XAML-SwapChainPanel-00cb688b , but swapchain has to be created with DXGI_ALPHA_MODE_PREMULTIPLIED flag, but Unity doesn’t expose functionality to set this parameter.
yes, something similar to FreshPaint. We did experiment before with the SwapChainPanel code in the link you referenced, and we replaced the XAML’s SwapChainPanel with our custom swap chain created with the DXGI_ALPHA_MODE_PREMULTIPLIED flag set. This didn’t help, but we were able to confirm that anything rendered into this dxgi surface was alpha enabled and rendered transparently above XAML elements lower in Z order.
So, is it correct to assume then that Unity creates its own SwapChainPanel and renders into it? In this case, Unity does not render directly into the SwapChainPanel it was set to through the below C# call?
No, Unity doesn’t create its own swapchainpanel, it creates its own swapchain though. But like I said earlier, when creating swapchain, user doesn’t have any control over it, like for ex., you cannot tell Unity to set DXGI_ALPHA_MODE_PREMULTIPLIED when creating swapchian.
I guess you could set your main camera to render to a RenderTexture, rather than the screen, and then at the end of the frame blit it to your own SwapChain that you created using a native plugin.