azanin Posted May 21, 2015 Share Posted May 21, 2015 I think I did not make myself clear, sorry about that. I'm doing the following: pCurTexture->enable(); Unigine::State::get()->clearBuffer(0xFFFFFFFF, Unigine::vec4(0.0f, 0.0f, 0.0f, 0.0f)); /* Noesis rendering */ pCurTexture->disable(); Unigine::State::get()->setBlendFunc(Unigine::State::BLEND_SRC_ALPHA, Unigine::State::BLEND_ONE_MINUS_SRC_ALPHA); I've tried to call State::flushStates right after that, and not call State::setBlendFunc. I don't want to regularly investigate the OpenGL context with/without Noesis rendering to guess what I should do to give Unigine a correct context. What I have now is a hotfix rather than a proper solution. Is there a way to make sure I get back to the state Unigine is expecting at render time? Link to comment
azanin Posted May 22, 2015 Share Posted May 22, 2015 Maybe you could help me better if I'm getting more specific. The problem I'm facing right now is that, when displaying some UI element with Noesis, when using OpenGL, the screen flickers between two frames. It feels like Noesis is messing up something that prevent Unigine to render properly on the backbuffer and that swap chain is alterning two frames that never gets updated. I see two possibilities: Noesis is changing something in the OpenGL context that I can't find (that's why I'm asking for a way to reset the graphic state once Noesis is done) Noesis and Unigine render threads are stepping into each others Link to comment
unclebob Posted June 1, 2015 Share Posted June 1, 2015 Alexandre, I have two more ideas: 1. Try to reset render state via this call right after Noesis rendering: state->clearStates(); state->flushStates(); 2. If there's a two frame lag then it's probably you forgot to call pCurTexture->flush method before pCurTexture->disable. Link to comment
azanin Posted June 2, 2015 Share Posted June 2, 2015 The calls to State::clearStates and State::flushStates doesn't seem to change anything, I still need to manually use State::setBlendFunc once Noesis is done. I can't see any difference when calling Texture::flush neither. Link to comment
unclebob Posted June 4, 2015 Share Posted June 4, 2015 Alexandre, Will it be possible to have minimal sample with noesis integration from your side so we'll be able to see what's wrong? Link to comment
azanin Posted June 15, 2015 Share Posted June 15, 2015 Hi, I've just added an upload in my account. Do I need to add a ticket as well or can you access it directly? I don't really know how that's supposed to work. My archive contains the minimal project with a trial version of Noesis, available for 30 days from now. Link to comment
silent Posted June 15, 2015 Share Posted June 15, 2015 Hi, Could you please send me a link to this file via PM (https://developer.unigine.com/forum/index.php?app=members&module=messaging§ion=send&do=form)? 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
unclebob Posted June 16, 2015 Share Posted June 16, 2015 Thanks, Alexandre! I've received your test scene and will report back once I get results. Stay tuned! ;) 1 Link to comment
unclebob Posted June 30, 2015 Share Posted June 30, 2015 Alexandre, I've made some progress so far but still it's not perfect. I managed to remove all strange freezes by rendering offscreen commands to the same texture render. I tried many different ways but it looks like it's just not rendering its inner texture properly. Will investigate more! Link to comment
azanin Posted July 16, 2015 Share Posted July 16, 2015 Hi, Rendering offscreen commands to the same texture render seems to fix the problem indeed, but I end up with a systematic crash when I close the application. Here's the code I've just tested: g_pTexRender->enable(); pState->clearBuffer(0xFFFFFFFF, Unigine::vec4(0.0f, 0.0f, 0.0f, 0.0f)); Noesis::Gui::RenderCommands commands = g_pNsElmt->WaitForUpdate(); if (commands.offscreenCommands != 0) g_pNsElmt->Render(commands.offscreenCommands.GetPtr(), true); g_pNsElmt->Render(commands.commands.GetPtr(), true); Is it what you have? Also I've noticed your trial version of Noesis has expired. I'm gonna ask for a new one for you. Thanks Link to comment
azanin Posted September 3, 2015 Share Posted September 3, 2015 Hi, I have another question. I'm trying to enable MSAA on the UI part. I've enabled the option on the Noesis side but I also have to create the texture with MSAA 8x and activate it before I call the UI rendering method. I've found Unigine::TextureRender::MULTISAMPLE_8 and Unigine::Texture::MULTISAMPLE_8 and I'm passing this in both object creation but that does not seem to do anything, what am I missing? TexturePtr colourTexture = Unigine::Texture::create(); colourTexture->create2D(widthPix, heightPix, Unigine::Texture::FORMAT_RGBA8, Unigine::Texture::USAGE_RENDER | Unigine::Texture::MULTISAMPLE_8); TexturePtr stencilTexture = Unigine::Texture::create(); stencilTexture->create2D(widthPix, heightPix, Unigine::Texture::FORMAT_D24S8, Unigine::Texture::USAGE_RENDER | Unigine::Texture::MULTISAMPLE_8); TextureRenderPtr textureRender = Unigine::TextureRender::create(); textureRender->create2D(widthPix, heightPix, Unigine::Texture::USAGE_RENDER | Unigine::Texture::MULTISAMPLE_8); textureRender->setColorTexture(0, colourTexture); textureRender->setDepthTexture(stencilTexture); Link to comment
unclebob Posted September 8, 2015 Share Posted September 8, 2015 Hi there, Alexandre! First, you need to pass color & depth formats to your texture render (COLOR_RGBA8 and DEPTH_24S8). Then you have two options here: 1) Pass textures you created earlier with same multisample count and format; 2) Just use TEXTURE_COLOR | TEXTURE_DEPTH flags during creation of texture render and it'll internally create color & depth textures, don't forget to remove code with your own texture creation. Link to comment
azanin Posted September 8, 2015 Share Posted September 8, 2015 Hi, Thank you so much for you answer! I've tried both options and I prefer the second one (less code). However, I still can't see no difference, the anti-aliasing does not seem to be applied. Is everything alright on the Unigine side ? int flags = Unigine::TextureRender::TEXTURE_COLOR | Unigine::TextureRender::COLOR_RGBA8 | Unigine::TextureRender::TEXTURE_DEPTH | Unigine::TextureRender::DEPTH_24S8 | Unigine::TextureRender::MULTISAMPLE_8; _textureRender->create2D(w, h, flags); Link to comment
silent Posted September 8, 2015 Share Posted September 8, 2015 Have you tried to enabled hardware antialiasing? Just execute following command in the console: video_renderable 1 && video_multisample 3 && video_restart 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
unclebob Posted September 14, 2015 Share Posted September 14, 2015 Alright, I think I found the reason of your crashes: the problem was with pointer being freed after the engine, so just destroy them before engine shutdown. Like so: int main(int argc, char* argv[]) { Unigine::Engine* pEngine = Unigine::Engine::init(UNIGINE_VERSION, argc, argv);; NoesisUtil::Initialize(); InitUIElement(); InitUIRendering(); while (!pEngine->isDone()) { NoesisUtil::Tick(); g_pNsElmt->Update(static_cast<float>(Unigine::Timer::getFloatTime())); UpdateMouse(); pEngine->update(); RenderUI(); pEngine->render(); pEngine->swap(); } g_pNsElmt.Reset(); NoesisUtil::Shutdown(); // don't forget to remove widget from the gui Unigine::GuiPtr pGui = Unigine::Gui::get(); pGui->removeChild(g_pWidgetSprite->getWidget()); // destroy all pointers here g_pWidgetSprite.destroy(); g_pColourTex.destroy(); g_pStencilTex.destroy(); g_pTexRender.destroy(); pEngine->shutdown(); return 0; } I'm still have no idea why you're having couple of frames lag between drop down menu click and its appearance. Link to comment
azanin Posted September 15, 2015 Share Posted September 15, 2015 It fixed it indeed. I've tried to apply that to our application but I still experience some weird freezes. I'll try to update the minimal application to reproduce these and I'll let your know. However, the lag when you open the drop down menu is weird indeed. Link to comment
azanin Posted September 22, 2015 Share Posted September 22, 2015 Hi, Did you find anythin about the couple of frames lag between drop down menu click and its appearance? Link to comment
azanin Posted September 23, 2015 Share Posted September 23, 2015 Hi, I've done some research about that blinkering problem. I have two frame captures done with NSight with DirectX, one during the blink, the other right after (they are too large for me to send it to you ~300Mo for both). Note that the capture was done on our main project and not on the minimal application I've given to you but the related calls are the same. What seems to be happening is that NoesisGUI is rendering something on the RGBA8 texture (frame 110 - 124 - 131 - 138), then the render target is unbound and NoesisGUI renders the rest of the GUI without binding a new one. I'm talking to Noesis support in order to get more information about this and I'll let you know. Did you know this? Could that help you find the root of the problem? Edit: Alright, I've talked to Noesis support. Apparently, the order of my calls was right from the beginning. It should be the following (extracted from their tutorial): // Render offscreen if (commands.offscreenCommands != 0) { xamlRenderer->Render(commands.offscreenCommands.GetPtr()); } // Start frame glBindFramebuffer(GL_FRAMEBUFFER, 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Render Scene // ... // Render HUD xamlRenderer->Render(commands.commands.GetPtr()); // SwapBuffers // ... Now, we are back to the initial problem: the screen freezes when I open the ComboBox. I've tried to capture a frame from that state. From what I understand, everything is fine in the pipeline until we reach the final stage. From my understanding, when everything should be rendered to the backbuffer, the render target is not set, so nothing is actually refreshed and we see the two same frames being rendered on screen. Could this help? Edit2: Could you tell me what are exactly doing TextureRender::enable and TextureRender::disable, in terms of draw calls, render target switch... please? What might happen is that the pre-render phase is creating its own render target, renders to it and unbind its render target when it's done. Our guess is that TextureRender::enable then saves the current render target (null on that case) and that TextureRender::disable re-binds the saved render target. Is that possible? If it is, how could I set back the proper render target once Noesis is done doing its pre-rendering? Link to comment
jesus.garcia Posted March 10, 2016 Share Posted March 10, 2016 Hi, Sorry for resurrecting this thread. I am one of the developers of NoesisGUI. Now, we are back to the initial problem: the screen freezes when I open the ComboBox. I've tried to capture a frame from that state. Was this finally solved? The problem is that sometimes our offscreen phase changes the bound render target and it should be restored before starting to render in the main framebuffer. Link to comment
azanin Posted March 10, 2016 Share Posted March 10, 2016 Yes it is. We manage to restore the graphic state after offscreen rendering with a dummy TextureRenderer and that fixed the issue. Link to comment
Sergey.Belnikovskiy Posted May 31, 2016 Share Posted May 31, 2016 Hi Can you tell us, show how to integrate NoesisGui in unigine. The ideal situation would be if you sent an example implementation integration :) . Thank you. Link to comment
Klimczak.Jan Posted November 25, 2017 Share Posted November 25, 2017 Hi, do you successful implemented NoesisGui in Unigine ? Do you have any sample of that ? Link to comment
Recommended Posts