[osg-users] Layered rendering with a geometry shader

Robert Osfield robert.osfield at gmail.com
Wed May 15 00:54:07 PDT 2019

Hi Chris,

On Wed, 15 May 2019 at 00:32, Chris Djali <krizdjali at gmail.com> wrote:
> I'm investigating using a geometry shader to render multiple shadow map cascades in one pass in OpenMW. While I've heard conflicting (but mostly negative) accounts of how much additional performance this can bring, I reckon it's likely to help, as OpenMW uses a ridiculous quantity of tiny drawables, causing a ridiculous number of draw calls when RTT passes are used, and there's no easy batching implementation as user/game scripts can add, remove, replace and relocate object with no notice. There are solutions in the works for this, but layered rendering may be low-hanging fruit that can be done in the meantime.

Both OpenGL and OSG suffer from lots of small grained drawables. so
avoiding lots of drawables can be crucial to improving performance.
This may be resolvable at the high level in your application with
exsiting OSG features, or tackled by subclass from vsg::Drawable or
vsg::Geometry to provide a custom drawImplementation() that is able to
juggle the dynamic changes in a more lightweight way.  For instance if
you can keep the vertex arrays pretty constant but add/remove
PrimitiveSet in a dynamic way then should be avoid much of the cost of
the alternative of lots separate drawables.

> Anyway, onto the problem at hand...
> In order to do this, I need to bind a layered depth texture as a render target. When I looked into doing this in OSG, the two threads I found claimed it wasn't possible yet, but as they were from a long time ago, it's possible support has been implemented since them. Can this be done yet? I'd rather not have to spend a long time investigating only to determine that it's still impossible.

I don't know enough of what you are thinking of to be able to make any
suggestions here, it's too open ended.


More information about the osg-users mailing list