[1.9] Rendering Entities after Compositors?

Problems building or running the engine, queries about how to use features etc.
Post Reply
SufferinPup
Greenskin
Posts: 119
Joined: Tue Mar 02, 2010 11:09 pm
x 2

[1.9] Rendering Entities after Compositors?

Post by SufferinPup »

Ogre Version: 1.9, Forward Rendering

We're using a really nice SSAO compositor, and it looks great, but because it is a compositor it renders after all geometry. This is causing a problem with translucent alpha (windows, particles, etc.), as they don't render into the zbuffer so the SSAO ignores them, and thus you can see the AO "creases" on top of the alpha geometry.

Is there any way to render a set of entities AFTER compositors? Ideally I'd set all of our translucent alpha to this render group and it would then render on top of the SSAO and all would be well.

I've also thought of rendering the alpha into its own compositor, but this seems to be more challenging than expected due to zbuffer and RTT alpha issues (which I think are solvable but seem challenging), I feel like there must be some built-in way to do this in an easier way.

Thanks for any help, hopefully someone can dig back into their memory and remember how to do this in the older version of Ogre. Upgrading to a newer Ogre version isn't realistic for our current project.

Thanks!
SufferinPup
Greenskin
Posts: 119
Joined: Tue Mar 02, 2010 11:09 pm
x 2

Re: [1.9] Rendering Entities after Compositors?

Post by SufferinPup »

Progress report: no luck.

I've tried:

1) 2 viewports, one that renders the "solid" objects and has an SSAO compositor, then a 2nd viewport that just renders translucent alpha and has our other compositors on it (bloom, some custom stuff, etc.). This looked promising at first, but as soon as I added a compositor to the 2nd viewport everything fell apart. I either get an exception (""Invalid compositor content_type compositor name" in SceneManager::_setPass) or, if I try some different compositors in different orders, they seem to be clearing the viewports when I don't want them to. Sometimes they might clear what was rendered in viewport 1, so I only see alpha, or they might clear viewport 2 so I only see the solid objects and no alpha. After much messing with stuff and hacking at Ogre, I gave up on this method. I feel that this is the "correct" method, but I'm either doing something wrong or Ogre isn't meant to have multiple viewports with multiple compositors.

2) Render all the alpha in a compositor. I did a quick hacky proof of concept of this, and it does seem to work, but in order to do it "right" it will require a ton of work. In the "render alpha" compositor I'll need to: render my own zbuffer because compositors can't use the scene's zbuffer (at least in 1.9), render all additive alpha to a RTT, render all multiplicative alpha to a RTT, and render all alpha blended alpha to an RTT, then correctly add/multiply/blend those with the scene. These will also all require custom shaders because of the manual zbuffer I have to use - I can't even use the RTSS to help.

I'm most curious why #1 didn't work, are compositors not supposed to work on multiple viewports? The API makes it look like this should work fine.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1995
Joined: Sun Mar 30, 2014 2:51 pm
x 1075
Contact:

Re: [1.9] Rendering Entities after Compositors?

Post by paroj »

maybe you can draw some inspiration from the deferred sample which faces similar problems:
https://ogrecave.github.io/ogre/api/lat ... erred.html

see the "Postponing transparent objects" part.
Post Reply