Page 1 of 1

Samples with transparency?

Posted: 15 May 2021, 18:23
by HateDread
I've been loading some of the samples to test my integration, and wanted to test a partially-transparent one over the top of rendering a world, but can't seem to find any samples that are set up this way (or I have, and my handling of transparency is clearly not working!)

Anything fairly simple I can use?

Re: Samples with transparency?

Posted: 17 May 2021, 10:44
by sfernandez
If you need a simple XAML to test transparecency that is using the Offscreen render you can use this:
<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Border BorderBrush="Black" BorderThickness="20" Margin="20" Opacity="0.5">
    <Rectangle Width="200" Height="100" Fill="Red"/>
  </Border>
</Grid>
As explained in the integration tutorial you have to call RenderOffscreen before actually rendering your scene:
mView->Update(timeInSeconds);

// Offscreen pass
mView->GetRenderer()->UpdateRenderTree();
mView->GetRenderer()->RenderOffscreen();

// Set main render target and set correct GPU state
// Render scene
// Onscreen pass
mView->GetRenderer()->Render();

// Swap buffers and Present