angus Posted November 15, 2016 Posted November 15, 2016 Hi, We're working on an "instant replay" by using engine.render.renderImage2D() to capture frames and then play them back a moment later. The routine is pasted below. But when we play back the images they're significantly darker than the view through the camera in the main Unigine window. Is there something we're missing about how to use renderImage2D() ? void buffer_and_playback() { Image images[0]; Player play = engine.game.getPlayer(); Camera cam = play.getCamera(); log.message("Start capture\n"); forloop(int i = 0; 75) { images.append(new Image()); engine.render.renderImage2D(cam, images[i], 0); sleep(1.0f/25.0f); } log.message("Capture done. Playback start\n"); sleep(2.0f); WidgetSprite ws = new WidgetSprite(engine.getGui()); engine.gui.addChild(ws, GUI_ALIGN_OVERLAP | GUI_ALIGN_LEFT); forloop(int i = 0; images.size()) { ws.setImage(images[i]); sleep(5.0f/25.0f); delete images[i]; } engine.gui.removeChild(ws); log.message("PLayback done\n"); }
silent Posted November 16, 2016 Posted November 16, 2016 Hi Angus, More likely engine.render.* is not taking in account some post effects. We recommend to use renderImage2D() method from VIewport class: https://developer.unigine.com/en/docs/2.3.1/api/library/rendering/class.viewport?rlang=usc&words=renderimage2d#renderImage2D_Camera_Image_void You can control which effects will be skipped by setting Viewport's SKIP flags (enumeration is available at the very end of the page). Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
angus Posted November 16, 2016 Author Posted November 16, 2016 Hi Silent, I get the same "it's darker" result, from using viewport.renderImage2D(cam, images, 1024, 576, 1); (although the images are a little different). I've tried the shorter viewport.render(cam, images) too, just to check. And with the HDR flag set to zero to see if that was it. I don't have any post materials set, and the render settings are the default for new projects. It's not a killer issue, but I'd like to get to the bottom of things.
silent Posted November 17, 2016 Posted November 17, 2016 Hi Angus, Could you please give us a minimal sample with reproduction steps? We would like too look more closely to this issue. Thank you! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
angus Posted November 17, 2016 Author Posted November 17, 2016 Sure thing. I've attached an "out of the box" Unigine project with a couple of buttons using engine.render and viewport.render. What I'd love is just a way of accessing the framebuffer of the finally rendered image. It seems wasteful to call another full render() to get the frame. Cheers. example.zip
sebastianbah Posted November 18, 2016 Posted November 18, 2016 Hi, It's seems that Adaptive exposure causes such effect. Please, try to set Exposure Mode value to Static (Windows -> Render settings -> Camera effects tab -> Exposure tab -> Mode values) and Exposure value to 1.Thanks!
angus Posted November 18, 2016 Author Posted November 18, 2016 That's great. Yes - that does indeed fix things and now the images are the same.
Recommended Posts