SwapChainPanel Transparency

Hi, I’m working on a WP8.1 project and would like to overlay a transparent SwapChainPanel over other XAML elements, but I’m having trouble making the SwapChainPanel transparent. I suspect I need to get down to the render target properties and set the AlphaMode to PreMultiplied (might be wrong about this) but can’t work out how to do this via the GraphicsDeviceManager.

Any pointers would be much appreciated.

Thanks

Is it a Xaml only issue, or related to Paradox itself?

Not sure to be honest, I’ve tried various things to try and clear the background like this:

public class HelloWorldGame : Game
{
    protected override async Task LoadContent()
    {
        await base.LoadContent();

        RenderSystem.Pipeline.Renderers.Add(new RenderTargetSetter(Services)
        {
            ClearColor = SiliconStudio.Core.Mathematics.Color.Transparent
        });

…SwapChainPanel is always black so it looks like something else needs clearing?

I tried this too but has the same effect:

protected override bool BeginDraw()
    {
        GraphicsDevice.Clear(GraphicsDevice.BackBuffer, Color.Transparent);
        GraphicsDevice.Clear(GraphicsDevice.DepthStencilBuffer, DepthStencilClearOptions.DepthBuffer); // only clear the depth buffer

        return base.BeginDraw();
    }

I think transparency should work, this example (cpp) has a highlighter panel which overlays other xaml:
https://code.msdn.microsoft.com/windowsapps/XAML-SwapChainPanel-00cb688b/sourcecode?fileId=99187&pathId=1569374273

Thanks

If you’re wondering why I’m trying to do this, basically I’m trying to create an AR app with a camera preview feed behind 3d objects rendered using Paradox and using the phone’s giro to control the camera in the 3d scene. I figured laying the 3d scene on top of the camera preview in XAML would be simpler than inserting frames into the game’s background.

SwapChainPanel is defined in the .xaml file:

<SwapChainPanel x:Name="SwapChainPanel" />

If you just want it to be transparent, I think you can use http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.uielement.opacity.aspx

If you want something more complex (i.e. transparent part of render target mix properly), you probably have to follow one of those:

Hope that helps

Thanks for your help. I’ve been playing around with the CX examples and can get custom SwapChainPanels to render with transparent backgrounds fine, but when they are integrated into a Paradox app like the Animated model for example, the model is not rendered.

XAML:

<customDX:D3DPanel Name="SwapChainPanel" />

cs:

Game.Run(SwapChainPanel);

I’m not sure what the issue is - whether the customisation is burying something Paradox/SharpDX needs to render the model.

If I inherit the panel without customisation it renders the model fine.