Jump to content

[SOLVED] Screenshot with transparency


photo

Recommended Posts

Posted

hello!

is there any way to take screenshot with transparency (no background) in runtime?

looks like "no" but the tracker can do it from editor

Posted

d.vavilov

You need just to grab and RGBA image (Environment rendering should be enabled). In A channel there would be an alpha that will mask the background. Please check the attached RGBA picture - it has been grabbed with built-in Video Grabber tool from inside the Editor.

Thanks!

frame_5.zip

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

But how to do it in runtime?

var ima = new Image();
Render.GetScreenshot(ima);
ima.Save(AppDomain.CurrentDomain.BaseDirectory+"test.tga");

this code brings screenshot with background (haze), but same scene with Tracker and Video grabber gives screenshot without it

image.thumb.png.f38ca13bd8369f0d88aacca1c7d2f775.png

Posted

Hello,

I made a component with an example of creating screenshots. Is this solution suitable for your task?

Screenshot.cs

  • 1 month later...
Posted
On 9/28/2021 at 11:08 AM, karpych11 said:

Hello,

I made a component with an example of creating screenshots. Is this solution suitable for your task?

Screenshot.cs 1.73 kB · 10 downloads

thank you. handy tool, but still no transparent background in runtime mode :(

maybe it works in modern SDK, i'm on version 2.12

Posted

Is it possible to get a small reproduction project that we can run and test?

If you can emulate your web camera image rendering - it would be just great. Maybe there is something different happens when additional texture is being rendered on top.

Thanks!

 

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

I've tried to fix this two shady lines of code:

if (image.Format == Image.FORMAT_RGBA8)
	image.ConvertToFormat(Image.FORMAT_RGB8); // needs to be RGBA8 to keep the alpha instead of sky color

Also, RGBA16F can't be saved into PNG, use DDS / EXR formats instead.

After replacing RGB8 with RGBA8, I have correct results with transparent sky (check attached image).

Thanks!

prozr.png

How to submit a good bug report
---
FTP server for test scenes and user uploads:

  • silent changed the title to [SOLVED] Screenshot with transparency
×
×
  • Create New...