ianyyinzyytek Posted October 30, 2014 Posted October 30, 2014 Hi,We are developing a project based on Unigine about video application. OS: windows x64 chineseGraphics Card: Nvidia GTX 770\GTX 780VS Version: Visual Studio 2010Unigine SDK: Unigine 2014-0707Render API : DXSDK_Jun10In our project, we must get buffer of DX11 RenderViewTarget with RGBA format, and we focus on the Alpha channel data very much.So we set BackgroundColor as Vec4(0,1,0,0) [RED,GREEN,BLUE,ALPHA], Unigine should clear viewport with this color. In the pure Widget/GDI Scene, we get pixel color of blank region as Vec4(0,1,0,0), all is OK. But, In the 3D Animation Scene, we get pixel color of blank region as Vec4(0,1,0,1). The ALPHA is not right!Please tell us how we can get the right ALPHA channel data in the 3D Animation Scene.Thanks and waiting for ur reply. Ian
unclebob Posted November 5, 2014 Posted November 5, 2014 Hello, Ian! Am I understand you correctly that when the engine clears framebuffer (before actual frame rendering) with transparent green color everything is ok and after it finishes rendering it's putting wrong alpha on a whole frame, right? Could you please give us more details about how you're relying on alpha channel data?
ianyyinzyytek Posted November 11, 2014 Author Posted November 11, 2014 Hi Unclebob, For our case, we want to do the video mixing, so we want to do the video mix with two video stream. The foreground video stream is from the engine, the other one could be an external video stream from a camera or so used as background. So we are relying on the alpha channel data. I tried the alpha data, it works before open any 3d scene. ' For example. in the samples' menu screen (only a widget with a background), we set the backgroundcolor vec4(0, 1, 0, 0), the alpha channel works. The samples' menu will be mixed on top pf the background video. After we opened a 3d scene, alpha channel seems do not work. Regards, Ian
silent Posted November 12, 2014 Posted November 12, 2014 Hi Ian, Could you please check this behavior with modified data/core/shaders/default/render/fragment_composite.shader from the attachment? This issue should be fixed in the upcoming SDK update.Thanks! fragment_composite.zip How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
ianyyinzyytek Posted November 23, 2014 Author Posted November 23, 2014 Thanks for the reply, silent. It fixed the issue. BTW, for our case, we want to overlay the engine's video on top of another input video. We tried with the provided fix, and it works for the most cases. For some particular case, like the glass material which it has alpha value between 0 and 1, if we set the scene's background as black and transparent, the glass will blend with the black, then mix with the background video. Is there any way that we can force the glass do not blend with black, and use its alpha value to mix with the background video directly? Regards, Ian
unclebob Posted December 2, 2014 Posted December 2, 2014 Hi Ian, Try to use WidgetSpriteVideo widget to play your video as a background. That way you'll achieve proper results with transparent objects. If that's not possible in your case then I recommend to render each frame twice: first time with transparent background (imagine this as a mask for blending) and second time with your background video. By doing so, you'll have mask and frame image so you'll be able to do blending outside the engine.
ianyyin Posted March 20, 2017 Posted March 20, 2017 @silent, the same issue/problem we encountered again in the new release. fragment_composite is no longer there. Please help, we will do the video mixing in the newer version, and upgrading our application. But encounter the same issue.
silent Posted March 20, 2017 Posted March 20, 2017 Hi Ian, I'm afraid we need to check the small test sample with that issue so we can debug it on our side. Could you please provide a small test scene for reproduction? Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
ianyyin Posted March 20, 2017 Posted March 20, 2017 Hi Silent, It will be difficult to provide a test sample. We have hardware video IO SDI card, and our source code related to this, to set up the full environment. Basically, what we did is video mix. overlay the engine 3d scene (foreground) with an external video feed as background. What we did before is, when we opened a 3d scene, we set the backgroundcolor vec4(0, 1, 0, 0), the alpha channel works. In the new version, it no longer works. In the previous post in this thread, we described the issue, and at that time, "fragment_composite.shader" fix works well for us. And unigine bring that into the update later on. In the new version, the alpha channel issue comes up again.
ianyyin Posted March 21, 2017 Posted March 21, 2017 Hi Silent, We just tried again. When the engine only open GUI, the alpha channel is right. The blank area in the background will be transparent,. and we can get the alpha channel and overlay on the external video feed. After we open a 3d scene, the blank area's alpha channel is no longer transparent. Which is the same case as the very beginning of this thread. Back in Unigine 1.0, we found this issue. It was fixed by the provided "fragment_composite.shader" in the reply and the fix has been merged to the following update. In the new versions, the issue comes up again. Because our use case is not that common for other uses, we built a video application on top of the unigine core, and highly depends on alpha channel when we are doing broadcaster level augmented reality. The issue is very important to us. Please help us to resolve this issue. Thanks, Ian
silent Posted March 21, 2017 Posted March 21, 2017 Hi Ian, Render pipeline is very different now and old shader just give us no idea right now. What we really interested in: Sample .world file with all the settings configured (Environment lut texutres, common rendering settings and post-processig) + blank cpp file; Small C++ or whatsoever application with main loop and only functions required that are doing render to texture and saving that texture (so we can check what is going on). Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
zhengwenxin Posted March 24, 2017 Posted March 24, 2017 Hi , We change the shader shaders/screen_space/fragment/composite.frag, we change the OUT_COLOR at the bottom of the shader file, replace the red data to alpha data, OUT_COLOR.r = OUT_COLOR.a; After change the shader, the background of 3D scene change to red. This simple test prove the alpha isn't zero, but it is 255. You can use this way to test the alpha. Thanks!
silent Posted March 24, 2017 Posted March 24, 2017 zhengwenxin, Thanks, we will take a look into this. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
zhengwenxin Posted March 30, 2017 Posted March 30, 2017 Hi, Have you found the problem that I presented before? We are time bound of this. Thanks
silent Posted April 3, 2017 Posted April 3, 2017 Hi zhengwenxin, Not yet. We are still investigating. Could you please provide a small test scene (basically, just .world + .cpp file with actual rendering settings) that you are using and specify (at least on a screenshot) where should be a correct alpha?Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
zhengwenxin Posted April 6, 2017 Posted April 6, 2017 Hi, The attachment is the shader and the screenshot that I changed. The background should be transparent, but now it isn't. This prove the alpha data is not zero. Thanks! composite.frag
zhengwenxin Posted April 18, 2017 Posted April 18, 2017 Hi, It's a long time that we commit this question, but you didn't give us a useful feedback. We are really need this , so please speed some time to solve this. Thanks,
silent Posted April 19, 2017 Posted April 19, 2017 Hi Ian, Sorry for the late reply. Could you please check that you have enabled 16bit color (Rendering -> Buffers -> Color 16F)? Also you can disable Environment (Rendering -> Features -> Environment). The next step will be to modify Environment color: Rendering Settings (Alt + R) -> Common -> Background Color (set it to black and Alpha to 0 via sliders). If that doesn't help, I'm afraid we will need more time for debugging. Please, don't use your modified composite shader to verify the wrong alpha channel - it can be wrong. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
zhengwenxin Posted April 20, 2017 Posted April 20, 2017 Hi, I am very sorry it does not work that the way you give us. The problem is still exist, so please solve this quickly. Thanks,
ianyyin Posted April 20, 2017 Posted April 20, 2017 Hi Silent, We tested using the real camera and full setup instead of the modified composite shader. It does not work. Please help us to fix this issue asap. Thank you very much, Ian
silent Posted April 21, 2017 Posted April 21, 2017 Hi Ian, Which SDK version are you currently using? We can fix it either in 2.3.1 (but not in 2.4.x) and in the upcoming 2.5 update. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
silent Posted April 21, 2017 Posted April 21, 2017 Hi Ian, We've found the root cause of such issue. Could you please try to do the following: Enable 16bit color format for the final image (Rendering -> Buffers -> Color 16F); Disable Environment (Rendering -> Features -> Environment); Modify Environment color: Rendering Settings (Alt + R) -> Common -> Background Color (set it to black and Alpha to 0 via sliders); Disable DOF (if enabled): Rendering -> Camera Effects -> DOF; Set Exposure mode to static: Rendering Settings (Alt + R) -> Camera Effects -> Exposure -> Mode: Static (adjust Exposure level to get more brighter picture). In that case we have correct alpha channel in final texture. DOF and Adaptive exposure are causing alpha channel artifacts. If DOF and Adaptive exposure is critial for your current project, please tell us SDK version where should we fix that. Otherwise we will fix it only in 2.5 SDK update. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Recommended Posts