luuk.van-dijk Posted February 26, 2019 Share Posted February 26, 2019 I have assigned auxiliary textures to all the objects in my world and I am able to save the auxiliary texture to images by auxiliaryTexture->getImage(image), which are correct. But when I try to display this image in the WidgetSpriteViewport by WidgetSpriteViewportPtr segm; segm->setImage(image); it does not get displayed. segm->setRender(auxiliaryTexture); does not work either. The Widget has suitable size and is added to the Gui. Link to comment
silent Posted February 26, 2019 Share Posted February 26, 2019 Hi Luuk, Is there any possibility to check the full source code? Do you have a Texture::USAGE_RENDER flag set to that texture? Right now it's not completely clear what do you want to achieve. 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
luuk.van-dijk Posted February 26, 2019 Author Share Posted February 26, 2019 I have the Texture::USAGE_RENDER flag. vsize = TEXTURE_SIZE auxiliaryTexture = Texture::create(); auxiliaryTexture->create2D(TEXTURE_SIZE, TEXTURE_SIZE, Texture::FORMAT_RGBA8, Texture::USAGE_RENDER); segm = WidgetSpriteViewport::create(Gui::get(), vsize, vsize); segm->setPosition(0, App::get()->getHeight() - vsize); Gui::get()->addChild(segm->getWidget(), Gui::ALIGN_OVERLAP | Gui::ALIGN_BACKGROUND | Gui::ALIGN_EXPAND); then later: auxiliaryTexture->getImage(image); segm->setRender(auxiliaryTexture); //doesn't work segm->setImage(image, 1); //doesn't work unsigned char *pixel_arr = image->getPixels(); String save_path = String::format("Outputs/image_%d_y.png", time); image->save(save_path); //the image saved here is correct Link to comment
silent Posted February 27, 2019 Share Posted February 27, 2019 Hi Luuk, setImage and setRender methods are valid only for the simple WidgetSprite (basically you change the background texture of sprite by doing this). It's not possible to do the same thing with WidgetSpriteViewport. We will update documentation to cover that or maybe also change an API to be more user friendly. Right now it's not completely clear what do you want to achieve with that code. If you can provide us some more information - maybe we will find another solution for your task. 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
silent Posted February 28, 2019 Share Posted February 28, 2019 Hi Luuk, As far as I know terrain object doesn't have a Aux pass, so it would be rendered black if we will decide to render an aux buffer contents in this viewport. Do you only need to render your drone with a solid color and leave all other objects unchanged? 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
luuk.van-dijk Posted March 4, 2019 Author Share Posted March 4, 2019 Yes, only the drone needs to be rendered. Link to comment
silent Posted March 5, 2019 Share Posted March 5, 2019 Hi Luuk, For that use-case you need to write a custom post-processing shader and assign it to the camera that rendering the picture into the WidgetSpriteViewport. Please, check the attached example: post_camera.zip 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
Recommended Posts