[ogre 13] WBOIT / early-z / rendering opaque objects only?

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
loath
Platinum Sponsor
Platinum Sponsor
Posts: 290
Joined: Tue Jan 17, 2012 5:18 am
x 67

[ogre 13] WBOIT / early-z / rendering opaque objects only?

Post by loath »

how do you tell ogre to render only opaque objects in a pass? i'm looking through the WBOIT code in ogre 13 and curious.

the reason i'm asking is:

1) so i can use WBOIT outside of RTSS and
2) i'm curious if an early-z pass would improve performance and create a scene depth map for lighting and post processing purposes. is there an example of this anywhere? is the deferred sample's GBUFFER compositor / shaders the closest? and then just use the same depth pool so later stages can "early out"?

thanks!
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: [ogre 13] WBOIT / early-z / rendering opaque objects only?

Post by paroj »

the WBOIT sample puts the transparent objects on a non-standard render-queue manually:
https://github.com/OGRECave/ogre/blob/f ... ency.h#L58

and then explicitly triggers that in the compositor using the same depth pool.

You can certainly do early-z the same way. The "PSSM/shadow_caster" material does exactly what you want as it "just writes depth".
loath
Platinum Sponsor
Platinum Sponsor
Posts: 290
Joined: Tue Jan 17, 2012 5:18 am
x 67

Re: [ogre 13] WBOIT / early-z / rendering opaque objects only?

Post by loath »

You can certainly do early-z the same way. The "PSSM/shadow_caster" material does exactly what you want as it "just writes depth".
great, thanks!
the WBOIT sample puts the transparent objects on a non-standard render-queue manually:
oh ok that makes sense. am i correctly understanding how render queues and compositors work?

render queues:
1. each render queue is executed and drawn into the render target in order.
2. compositors first_render_queue / last_render_queue default to essentially "all queues" (except overlays etc) so this is why compositors are typically run at the end. (ex. for post processing)
3. you can override first_render_queue / last_render_queue to run a compositor between a specific set of render queues.

WBOIT example:
1. render queues from 0 to 95 are drawn into the "default" render target.
2. the WBOIT compositor is triggered for render queues 96 and 97
  • a. WBOIT compositor copies the "default" RT into "opaque" RT.
  • b. WBOIT renders queues 96 and 97 into "accum" RT.
  • c. "opaque" RT is copied back into the original render target.
  • d. a WBOIT fragment shader takes "accum" RT and using the WBOIT algorithm writes the transparent pixels into the "default" RT.
3. remaining render queues are drawn into "default" RT. (98+ until overlays)
4. any other "default" compositors may be executed. (ex. post processing)
5. overlay render queues executed.

final question:
does this copy from the "default" RT to "opaque" RT or is "opaque" just an alias? (from "compositor WBOIT" in ogre samples)

Code: Select all

 target opaque
        {
            input previous
        }
many thanks!
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: [ogre 13] WBOIT / early-z / rendering opaque objects only?

Post by paroj »

all is correct except that there is no implicitly copy: for the first compositor "input previous" is just a special alias for "pass render_scene", where the viewport parameters are used instead of overriding them.

also, internally there is only one "pass render_scene" per target section, so first_render_queue / last_render_queue simply set which renderqueues are executed.
loath
Platinum Sponsor
Platinum Sponsor
Posts: 290
Joined: Tue Jan 17, 2012 5:18 am
x 67

Re: [ogre 13] WBOIT / early-z / rendering opaque objects only?

Post by loath »

thanks! i had no idea this is how it worked.
Post Reply