HateDread
Topic Author
Posts: 11
Joined: 06 Feb 2020, 10:27

Samples with transparency?

15 May 2021, 18:23

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?

Tags:
 
User avatar
sfernandez
Site Admin
Posts: 2220
Joined: 22 Dec 2011, 19:20

Re: Samples with transparency?

17 May 2021, 10:44

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

Who is online

Users browsing this forum: No registered users and 2 guests