Coppel.Damien Posted March 5, 2020 Share Posted March 5, 2020 Hello, I'm trying to render then save multiple images to file and I struggle to have image of the quality I see on the main render saved as PNG. Currently I'm using a component that implements the "update" method. In my component's update I call this "saveImage" function multiple time : int ImageGen::saveImage(std::string path) { ImagePtr image = Image::create(); viewport->renderImage2D(player->getCamera(), image, 400, 400); image->save(path.c_str()); Log::message("saving image to : \"%s\"\n", path.c_str()); return 0; } However the saved image is always badly rendered like so : There is no sky is the saved image and they often look like the render didn't properly finish or like another render started before the image was saved. What would be the correct way of saving images to file ? Link to comment
silent Posted March 5, 2020 Share Posted March 5, 2020 Damien, This artifacts are expected for the first frame grabbed (because no previous frame was ever existed / it contains some garbage). Please, check the C++ samples in SDK Browser regarding the viewport and textures rendering: Render -> Screenshot Render -> GBufferRead I believe these two samples should be enough to generate perfect images :) 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