[osg-users] Multiple render passes and multithreading

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Wed May 3 09:11:44 PDT 2017

Hi Glenn,

> Sebastian,
> Have you tried setting the data variance to DYNAMIC on the StateSet
> containing the Uniform?
> That's the first thing I would try -- not sure whether it works on
> Uniforms though.

Thanks, that indeed did the trick :-)
Thinking twice makes it obvious; declaring it dynamic will prevent it 
from being written to while being read.


> Glenn Waldron
> On Wed, May 3, 2017 at 11:49 AM, Sebastian Messerschmidt
> <sebastian.messerschmidt at gmx.de <mailto:sebastian.messerschmidt at gmx.de>>
> wrote:
>     Hi,
>     I've just stumbled upon something I find hard to understand.
>     My setup contains multiple cameras (using FBO and MRT) with a
>     specific render-order set to them. The first camera is essentially a
>     render-scene-to-MRT pass.
>     In the simplest case a second camera will pick up the textures
>     rendered to and use them to draw to the framebuffer.
>     A cull-callback is attached to the group containing the cameras. The
>     callback simply extracts the current ViewMatrix and passes it to the
>     stateset as a uniform. This uniform is used in one of later
>     cameras/passed to reconstruct worldspace from the depth buffer.
>     Now while this all works great when setting the viewer to
>     SingleThreaded, it seems that using multithreading in the viewer
>     causes the Uniform for the ViewMatrix to be from the previous frame
>     in some cases. From my understanding the cull-visitor runs
>     asynchronously to the drawing, causing the uniform to be either from
>     the correct or from another frame.
>     What would be the multithreaded-cull/draw alternative to get the
>     ViewMatrix (or any other camera-related values) used for rendering
>     in the first camera down the chain reliably?
>     Cheers
>     Sebastian
>     _______________________________________________
>     osg-users mailing list
>     osg-users at lists.openscenegraph.org
>     <mailto:osg-users at lists.openscenegraph.org>
>     http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>     <http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list