Jump to content

How to improve panorama image resolution.


photo

Recommended Posts

Hi. I am currently developing a program that make  360 VR output  image in runtime.

Related source is "ScreenShot of C ++ sample".

Normal render(not panorama)  mode captures output image nicely.(Attached File : screenshot_Normal.png, 3840*2160)

But in panorama render mode capture output image not properly.(screenshot_VR.png )

In Init function set the panorama view and add callback function.

    auto render = Render::get();
    render->setPanorama(4);

    //create viewport
    viewport = Viewport::create();

    viewport->removeSkipFlags(Viewport::SKIP_VISUALIZER); // Visualizers are disabled by default for all new viewports.
    viewport->setRenderMode(Viewport::RENDER_DEPTH_GBUFFER_FINAL);

    viewport->addCallback(Render::CALLBACK_END, MakeCallback(this, &AppWorldLogic::screenshot_callback));
    Render::get()->setViewport(viewport);

In Callback function I change the virtual resolution and capture renderer's texture color .

        auto render = Render::get();
        if (capture_flag == false)
        {
            capture_flag = true;
            render->setVirtualResolution(Math::vec2(3840, 2160));
            return;
        }

In addition,  Since console command "video_grab" capture only window size, the resolution improvement effect is not applied.

I'd like you to give me a little hint. it will be a lot of help. thank you.!

screenshot_Normal.png

screenshot_VR.png

Link to comment

Hi!

First, when you set render panorama mode, the engine actually renders buffers several times with the different view angles during each frame.
For 360-degrees panorama modes that will be six view angles.
The final image is then assembled from these temporary buffers.
Since the callback in the sample copies the buffer into the same image, intermediate screenshots are overwritten and what you see as a result is the last of them.

I guess you don't want to bother with accumulating all buffers in a callback and assembling them yourself, you just want a final image.
Please, check out the modified version of the screenshot sample in an attachment.
It mimics the behavior of the "video_grab" command and captures the *final* image, as you see it on the screen, including all post effects and GUI and even the mouse cursor.

Second, changing render virtual resolution in a callback will give nothing, because buffer sizes are fixed while the engine is rendering the frame.
Also, in order for temporal effects to accumulate when you change the resolution, you should wait at least for 30 frames before grabbing the screenshot.
I suggest you set virtual resolution once at the start and keep it the same during the execution.

Screenshot.cpp

Link to comment
×
×
  • Create New...