[2.1] How to render two viewports with compositor?

Problems building or running the engine, queries about how to use features etc.
Post Reply
mrmclovin
Gnome
Posts: 324
Joined: Sun May 11, 2008 9:27 pm
x 20

[2.1] How to render two viewports with compositor?

Post 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?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5299
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1280
Contact:

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

Post 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
mrmclovin
Gnome
Posts: 324
Joined: Sun May 11, 2008 9:27 pm
x 20

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

Post 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.
mrmclovin
Gnome
Posts: 324
Joined: Sun May 11, 2008 9:27 pm
x 20

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

Post 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.
Post Reply