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.

Cheers
Sebastian


Glenn Waldron

On Wed, May 3, 2017 at 11:49 AM, Sebastian Messerschmidt
<[email protected] <mailto:[email protected]>>
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
    [email protected]
    <mailto:[email protected]>
    http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
    <http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org>




_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to