OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Multiple render passes and multithreading


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 725

PostPosted: Wed May 03, 2017 3:53 pm    Post subject:
Multiple render passes and multithreading
Reply with quote

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


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
gwaldron (Glenn Waldron)
Appreciator


Joined: 25 Aug 2011
Posts: 196

PostPosted: Wed May 03, 2017 3:57 pm    Post subject:
Multiple render passes and multithreading
Reply with quote

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.


Glenn Waldron




On Wed, May 3, 2017 at 11:49 AM, Sebastian Messerschmidt < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
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
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 725

PostPosted: Wed May 03, 2017 4:16 pm    Post subject:
Multiple render passes and multithreading
Reply with quote

Hi Glenn,


Quote:
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 Smile
Thinking twice makes it obvious; declaring it dynamic will prevent it
from being written to while being read.

Cheers
Sebastian

Quote:

Glenn Waldron

On Wed, May 3, 2017 at 11:49 AM, Sebastian Messerschmidt
< <mailto:>>
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

<mailto:>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org>








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Render to texture with GL3. Raizel General 3 Tue May 23, 2017 10:33 am View latest post
No new posts Recommended way to render a scene fro... Hannes Naude General 6 Tue Apr 11, 2017 11:12 am View latest post
No new posts How do cameras handle the render target? wernerM General 3 Wed Mar 15, 2017 9:59 am View latest post
No new posts Multiple cameras sharing multisample fbo ravidavi General 1 Sat Mar 11, 2017 8:17 am View latest post
No new posts How to improve frame rate when loadin... vinothrajendran4 General 9 Wed Feb 22, 2017 2:01 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP