Make MRT texture skip over compositors?

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
mogumbo
Gnoblar
Posts: 14
Joined: Thu Sep 14, 2017 4:14 pm
x 1

Make MRT texture skip over compositors?

Post by mogumbo »

I want to use MRT to output my depth buffer in Ogre 1.9.1 (using 1.9.1 because I'm using Gazebo). I got the basics working by outputting depth in a PF_FLOAT32_R texture and disabling the getGLFormat exception as described here: viewtopic.php?p=518118#p518118

This works for a simple case. But then if I insert an intermediate compositor, the contents of the depth texture don't get through. My original pass renders both textures in a shader and my final compositor is:

Code: Select all

compositor MyCompositor
{
  technique
  {
    texture mrt target_width target_height PF_FLOAT32_RGB PF_FLOAT32_R

    target mrt
    {
      input previous
    }

    target_output
    {
      input none

      pass render_quad
      {
        material MyMaterial
        input 0 mrt 0
        input 1 mrt 1
      }
    }
  }
}
I tried using 'chain_scope' on the texture line but that didn't help. And the docs say input can only have values of 'none' or 'previous,' but I really want my PF_FLOAT32_RGB texture to come from the 'previous' input and my PF_FLOAT32_R texture to come from the very first input. Any suggestions?
paroj
OGRE Team Member
OGRE Team Member
Posts: 2108
Joined: Sun Mar 30, 2014 2:51 pm
x 1134

Re: Make MRT texture skip over compositors?

Post by paroj »

mogumbo wrote: Tue Oct 19, 2021 12:12 am I tried using 'chain_scope' on the texture line but that didn't help. And the docs say input can only have values of 'none' or 'previous,' but I really want my PF_FLOAT32_RGB texture to come from the 'previous' input and my PF_FLOAT32_R texture to come from the very first input. Any suggestions?
then you have to write PF_FLOAT32_R in the first input and reference it like:

Code: Select all

        input 0 mrt 0
        input 1 firstInputDepthTexture
where mrt is defined as above, but "firstInputDepthTexture" comes from another compositor with "chain_scope".
mogumbo
Gnoblar
Posts: 14
Joined: Thu Sep 14, 2017 4:14 pm
x 1

Re: Make MRT texture skip over compositors?

Post by mogumbo »

I don't think I understand completely. I see two possible scenarios:

1. Initial render -> final compositor
2. Initial render -> intermediate compositor(s) -> final compositor

In Scenario 1, there's no other compositor that can define a texture with chain scope, so I don't know how to apply your solution to that. In Scenario 2, I could probably do it but I'd like to be able to insert intermediate compositors without modifying them. Is there any way to get the PF_FLOAT32_R render target from the initial render simply by asking for it in the final compositor? I guess changes to the initial render are okay since I have to make it write to an extra texture anyway. But I'd like to be able to use any intermediate compositor without modifying it.