Multiple Viewports + Compositor Post Effect Nodes?

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


Post Reply
Shimayama
Halfling
Posts: 74
Joined: Sat Apr 25, 2009 2:20 pm
Location: Norway
x 1

Multiple Viewports + Compositor Post Effect Nodes?

Post by Shimayama »

What is the recommended way to layout workspaces if I want the following features at the same time:
  • Multiple viewports with individual cameras.
  • Post effect nodes (for simplicity for example B&W).
I have tried to solve both of these with one customizable system, however they do currently not play well together.

This is how the features above are currently solved:
  • Multiple viewports are done by having multiple workspace def's and workspaces that are almost identicaly except from the clear pass only being executed by the first workspace and clearing the entire screen (using execution & viewport modifier masks). Created with unique viewport, execution mak, and default camera, per viewport workspace. This works well. (I'm currently recreating the workspaces when switching camera, because I'm not sure if it's safe to just change the camera on the scene pass def without recreating.)
  • Post effects are done very similar to the Post effect sample project. The first workspace defines two render textures, and they are "ping-ponged" through the rest of the post effect nodes.
The problems when both these features are used at once:
  • Viewport modifier mask appears to be used multiple times (see images). I think this is actually the B&W node not knowing that the input texture that it's reading from (rendered by the scene pass of previous node) has only been rendered to half the texture? It would be great if the quad rendering would know this when sampling, so that it samples from the "inverted viewport modifier" area... sort of? Or should I instead solve it by creating smaller viewport-sized render textures for each viewport workspace, which are passed through the node chain, and then only the last node uses the viewport modifier to only write to one half of the render window?
  • I'm think I'm currently creating more render textures than needed, or too large. I think my current setup probably creates 2 x 2 = 4 full sized render textures (2 per viewport) since I define them as local for the start node of each workspace chain? Should I try to re-use the full-sized render textures between viewport workspaces? Or should I do the "reduced-size-viewportlocal-textures" solution mentioned previously?
Splitscreen without B&W post effect node:
Image

Splitscreen with B&W post effect node:
Image

Any ideas? :) What is the recommended way to proceed?

ps. The solution that is most compatible with any other systems (HDR, SSAO, Ogre default post effects, etc.) would be preferred.
Shimayama
Halfling
Posts: 74
Joined: Sat Apr 25, 2009 2:20 pm
Location: Norway
x 1

Re: Multiple Viewports + Compositor Post Effect Nodes?

Post by Shimayama »

Ok, I tried the solution with letting the first node (that renders the scene) of each viewport's workspace have a reduced texture size, and setting its viewportModifierMask to zero. This way only the last node in the workspace will use the viewport modifier when actually rendering to the render window. This worked great. Just wondering if it is the best way?

Also, about letting each viewport's workspace share textures used by previous viewport's workspace.. I think it might be problematic, because the viewports are not always of same size, and they might have completely different post effects (or no post effets at all). I hope the only drawback of not doing this is memory consumption?
Post Reply