d.vavilov Posted September 25, 2021 Share Posted September 25, 2021 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 Link to comment
silent Posted September 27, 2021 Share Posted September 27, 2021 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: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
dmitry.vavilov Posted September 27, 2021 Share Posted September 27, 2021 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 Link to comment
karpych11 Posted September 28, 2021 Share Posted September 28, 2021 Hello, I made a component with an example of creating screenshots. Is this solution suitable for your task? Screenshot.cs Link to comment
dmitry.vavilov Posted November 1, 2021 Share Posted November 1, 2021 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 Link to comment
silent Posted November 1, 2021 Share Posted November 1, 2021 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: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
dmitry.vavilov Posted November 2, 2021 Share Posted November 2, 2021 tested in standard "new project" from SDK 2.11. AppWorldLogic.cs with karpych11's code in AppWorldLogic Link to comment
silent Posted November 2, 2021 Share Posted November 2, 2021 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! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
dmitry.vavilov Posted November 2, 2021 Share Posted November 2, 2021 got it. thank You! Link to comment
Recommended Posts