Page 1 of 1

[2.1] How to render two viewports with compositor?

Posted: Sat Nov 09, 2019 12:35 pm
by mrmclovin
Ogre Version: 2.1 :?:
Operating System: macOS :?:
Render System: Metal :?:

I want to have two viewports. One for rendering and one for GUI. But to demonstrate the problem I have, let's say I just want two viewports from the same camera.

With one viewport, things look normal:

Code: Select all

compositor_node main_node
{
    in 0 rt_renderwindow

    target rt_renderwindow
    {
        
        pass clear
        {
            colour_value 0.211 0.2335 0.349 1
        }

        pass render_scene
        {
            overlays    off
            rq_first    0
            rq_last     2
        }
    }
}
Image

-------------------------------------

When splitting into two viewport next to eachother, the left one is not scaled down, but seems to get stretched out and placed centerd, while the right seems to appear as expected:

Code: Select all

compositor_node main_node
{
    in 0 rt_renderwindow

    target rt_renderwindow
    {
        
        pass clear
        {
            colour_value 0.211 0.2335 0.349 1
        }

        pass render_scene
        {
            overlays    off
            rq_first    0
            rq_last     2
            viewport 0.0 0 0.5 1
        }

        pass render_scene
        {
            overlays    off
            rq_first    0
            rq_last     2
            viewport 0.5 0 0.5 1
        }
    }
}
Image

1. Is this expected or is it a bug?
2. How can I achieve what I want?

Re: [2.1] How to render two viewports with compositor?

Posted: Sun Nov 10, 2019 11:45 pm
by dark_sylinc
  1. This is not expected
  2. Often the problem could be aspect ratio. Make sure Camera::setAutoAspectRatio is set to tru
  3. Are you able to test other RenderSystems? It could be a Metal-only bug. If that's the case, it may have been already resolved in 2.2
  4. Try comparing your rendering against StereoRendering sample which does a very similar thing

Re: [2.1] How to render two viewports with compositor?

Posted: Mon Nov 11, 2019 7:43 pm
by mrmclovin
dark_sylinc wrote:
Sun Nov 10, 2019 11:45 pm
  1. Are you able to test other RenderSystems? It could be a Metal-only bug. If that's the case, it may have been already resolved in 2.2
Seems to work with GL3Plus:

Image

Any idea of how/where to fix it in Metal?

Testing with 2.2 is not an option right now as I need to port a lot of code.

Re: [2.1] How to render two viewports with compositor?

Posted: Sat Nov 23, 2019 11:58 pm
by mrmclovin
I was unable to find the bug in RenderSystem Metal. Seems to work in 2.2 though so I'm considering upgrading my code to 2.2.