MRT in compositors Topic is solved

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


User avatar
bishopnator
Gnome
Posts: 348
Joined: Thu Apr 26, 2007 11:43 am
Location: Slovakia / Switzerland
x 16

MRT in compositors

Post by bishopnator »

Hi, I am trying to figure out the way how to create and setup MRT (multiple render targets) in the compositors, but I am struggling here. I suppose that in ogre-next it is possible to declare in compositor scripts multiple pixel formats to create MRT instead of regular texture as described in ogre 1.x documentation. But how I can I create and set MRT as input to the workspace? From the c++ side it accepts list of TextureGpu pointers, but I don't see a way how to create MRT as single TextureGpu instance?

Let assume that I need to create a CompositorWorkspace which always renders to a single MRT with 2 render targets. How can I setup it in c++ and/or in the script?

Note that in ogre-next documentation there is no info about MRT and there are some typos which makes the extraction of the information even more difficult. I am not collecting them as my understanding of the compositors is still I think too low to mark a typo with 100% certainty. As example I think here is the typo in the code as the node's target should be rt0 instead of Input_as_MyLocaName.

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5539
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1399

Re: MRT in compositors

Post by dark_sylinc »

Use rtv.

The colour keyword supports an index number to set the mrt index:

Code: Select all

colour <mrt_idx> <texture_name> [resolve <resolve_dst_texture_name>] [mip <#>] [resolve_mip <#>] [slice <#>] [resolve_slice <#>] [all_layers [true|false]]
 
// Example:

texture myRttAlbedo ...
texture myRttGBuffer ...

rtv myRtv
{
    colour 0 myRttAlbedo
    colour 1 myRttGBuffer
    depth myDepthBuffer
}

target myRtv
{
  // ... passes here
}

The SSR sample uses RTV to do MRT rendering for the GBuffer.

For C++, the low level code is RenderPassDescriptor which has mColour[OGRE_MAX_MULTIPLE_RENDER_TARGETS]. At higher compositor level, you want to setup RenderTargetViewDef::colourAttachments

Cheers