Re: [osg-users] Deep cloning an active root scene node

2019-03-01 Thread Robert Lockyer
Hey Chris, Just had a chat with Matt and he reminded me of the Raspberry Pi
light field rig Mike was working on a while back. Very cool stuff. I don't
think we were aware that he was working with OSG.

If you can put me in touch, sounds like we would have lots to talk about.

Thanks,
Rob

On Fri, Mar 1, 2019 at 11:10 AM Chris Hanson  wrote:

>
> Hey Rob (Lockyear). You know, Mike Weiblen has already done this stuff
> you're doing in OSG. Last year, I put him in touch with Matthew Hamilton
> and Russ Baker an email suggesting you guys all mind-meld to see if his
> wisdom could save you all some effort. Perhaps they didn't know he was
> working with OSG, but it seems like based on the questions you're asking,
> you're following paths he's already navigated.
>
> I'd be happy to put you in touch again.
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>

-- 
_This email and any attachments are confidential and may be privileged. Any 
unauthorized use, disclosure, copying or distribution of the information 
received is prohibited. If you are not the intended recipient please 
contact the sender immediately by return email confirming that you have and 
will delete all communications related to the email and any attachments 
sent to you in error._
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Deep cloning an active root scene node

2019-03-01 Thread Chris Hanson
Hey Rob (Lockyear). You know, Mike Weiblen has already done this stuff
you're doing in OSG. Last year, I put him in touch with Matthew Hamilton
and Russ Baker an email suggesting you guys all mind-meld to see if his
wisdom could save you all some effort. Perhaps they didn't know he was
working with OSG, but it seems like based on the questions you're asking,
you're following paths he's already navigated.

I'd be happy to put you in touch again.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Deep cloning an active root scene node

2019-03-01 Thread Daniel Emminizer, Code 5773
Hi Rob,

Be sure that if you’re using cloning that everything in the scene supports 
cloning.  If you have custom (non-OSG) nodekit elements in the scene, cloning 
may only be partially supported.  That can certainly cause issues with that 
approach.  Though OSG nodes supports cloning, not all custom nodekits 
necessarily implement the copy constructors properly.

- Dan



From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Lockyer
Sent: Friday, March 1, 2019 7:56 AM
To: OpenSceneGraph Users 
Subject: Re: [osg-users] Deep cloning an active root scene node

Thanks Robert, that's good advise for a more efficient approach in the long 
term. I just figure it might be a simple proof of concept to just blindly clone 
the whole graph. Sounds like there's no fundamental reason I can't do that, so 
probably just some silly thing I'm getting wrong.

Robert Lockyer
Software Developer
[Image removed by sender.]
Office: 1-709-701-0281
Email: 
robert.lock...@avalonholographics.com<mailto:robert.lock...@avalonholographics.com>


On Fri, Mar 1, 2019 at 8:36 AM Robert Osfield 
mailto:robert.osfi...@gmail.com>> wrote:
Hi Rob,

There is a limit to how well you'll be able to get things to scale given the 
hardware limits you have to work around.  If you don't want the main rendering 
loop to wait for the rendering of all these extra views then you'll need to use 
a separate viewer(or compositeviewer) with it's own threading.  You'll need to 
manage your own frame loops in the secondary viewer.

The only reason to copy data is if it the data is being modified by the 
different threads, I wouldn't recommend avoiding any modifications of the scene 
graph so you can simply share it all without copying.  If there are 
modifications you currently need I would suggest looking at ways to move this 
work elsewhere - often you can move to the GPU and just pass a Uniform per View 
to select the settings that are approriate so the shaders can do the right 
thing.

Cheers,
Robert.


___
osg-users mailing list
osg-users@lists.openscenegraph.org<mailto:osg-users@lists.openscenegraph.org>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

This email and any attachments are confidential and may be privileged. Any 
unauthorized use, disclosure, copying or distribution of the information 
received is prohibited. If you are not the intended recipient please contact 
the sender immediately by return email confirming that you have and will delete 
all communications related to the email and any attachments sent to you in 
error.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Deep cloning an active root scene node

2019-03-01 Thread Robert Lockyer
Thanks Robert, that's good advise for a more efficient approach in the long
term. I just figure it might be a simple proof of concept to just blindly
clone the whole graph. Sounds like there's no fundamental reason I can't do
that, so probably just some silly thing I'm getting wrong.

Robert Lockyer
Software Developer

Office: 1-709-701-0281
Email: robert.lock...@avalonholographics.com


On Fri, Mar 1, 2019 at 8:36 AM Robert Osfield 
wrote:

> Hi Rob,
>
> There is a limit to how well you'll be able to get things to scale given
> the hardware limits you have to work around.  If you don't want the main
> rendering loop to wait for the rendering of all these extra views then
> you'll need to use a separate viewer(or compositeviewer) with it's own
> threading.  You'll need to manage your own frame loops in the secondary
> viewer.
>
> The only reason to copy data is if it the data is being modified by the
> different threads, I wouldn't recommend avoiding any modifications of the
> scene graph so you can simply share it all without copying.  If there are
> modifications you currently need I would suggest looking at ways to move
> this work elsewhere - often you can move to the GPU and just pass a Uniform
> per View to select the settings that are approriate so the shaders can do
> the right thing.
>
> Cheers,
> Robert.
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>

-- 
_This email and any attachments are confidential and may be privileged. Any 
unauthorized use, disclosure, copying or distribution of the information 
received is prohibited. If you are not the intended recipient please 
contact the sender immediately by return email confirming that you have and 
will delete all communications related to the email and any attachments 
sent to you in error._
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Deep cloning an active root scene node

2019-03-01 Thread Robert Osfield
Hi Rob,

There is a limit to how well you'll be able to get things to scale given
the hardware limits you have to work around.  If you don't want the main
rendering loop to wait for the rendering of all these extra views then
you'll need to use a separate viewer(or compositeviewer) with it's own
threading.  You'll need to manage your own frame loops in the secondary
viewer.

The only reason to copy data is if it the data is being modified by the
different threads, I wouldn't recommend avoiding any modifications of the
scene graph so you can simply share it all without copying.  If there are
modifications you currently need I would suggest looking at ways to move
this work elsewhere - often you can move to the GPU and just pass a Uniform
per View to select the settings that are approriate so the shaders can do
the right thing.

Cheers,
Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Deep cloning an active root scene node

2019-03-01 Thread Robert Lockyer
Thanks Robert, that's actually what I tried initially and it renders fine,
however there's a usability issue. For more background I'm rendering light
fields. In order to do this I set up an array of thousands of slightly
offset cameras in a rectangular grid pattern. Because I'm capturing so many
views when I call osgViewer::Viewer::frame() it locks the main thread and
the application becomes unresponsive for a long time.

Ideally what I'd like is for the main application to continue rendering its
single 3d view, while I render these thousands of cameras to a texture in a
background thread. I'm rendering to a texture now without issue, but what's
eluded me so far is how I can run this process without locking up the
application.

I'd like to have a snapshot of the scene graph for this background thread
so that the user can continue to use the main 3d view while the background
thread renders a static copy of the scene graph. This is why I've been
attempting to clone the root scene node recursively and pass it to my
thread. Any concerns with that approach?

Cheers,
Rob


Message: 9
Date: Thu, 28 Feb 2019 18:53:19 +
From: Robert Osfield 
To: OpenSceneGraph Users 
Subject: Re: [osg-users] Deep cloning an active root scene node
Message-ID:

Content-Type: text/plain; charset="UTF-8"

Hi Rob,

The OSG is design to allow you to rendering multiple views at once,
there is no need to clone the scene graph, you simply add another View
to a CompositeView to add the extra rendering.  You can toggle
optional View's on/off as you need them.

Robert.

Message: 7
Date: Thu, 28 Feb 2019 14:20:46 -0330
From: Robert Lockyer 
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Deep cloning an active root scene node
Message-ID:

Content-Type: text/plain; charset="utf-8"

Hi all, my name is Rob.

I'm currently writing a plugin for an OSG based application. I effectively
want to create a snapshot of the application's scene graph state and pass
it to another thread where I can render to a texture, while the main
rendering thread continues with minimal interruption.

I'd like to do this because blocking the main thread with a
osgViewer::Viewer::frame() call causes the application to lock up and
prevents me from displaying a progress dialog. The scene I render takes a
long time because I render many camera views to a single texture.

I'm currently trying to do this:

osg::Node* sceneCopy =
dynamic_cast(sceneData_->clone(osg::CopyOp::DEEP_COPY_ALL));

Then passing this to another thread where I run:

viewer_ = new osgViewer::Viewer();
viewer_->setSceneData(sceneCopy);

However the behavior seems inconsistent. It either dies on a null reference
inside osgEarth somewhere or it renders an empty scene. I don't think I
fully understand the threading model of OSG, I've read a bit here and
there, but I think there's a lot I'm still missing.

Is there a safe way to copy the scene data and use it to run an isolated
viewer like this in parallel? Is it even safe to run two viewers in
parallel like this at all?

Cheers,
Rob

Robert Lockyer
Software Developer

Office: 1-709-701-0281
Email: robert.lock...@avalonholographics.com

-- 
_This email and any attachments are confidential and may be privileged. Any 
unauthorized use, disclosure, copying or distribution of the information 
received is prohibited. If you are not the intended recipient please 
contact the sender immediately by return email confirming that you have and 
will delete all communications related to the email and any attachments 
sent to you in error._
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Deep cloning an active root scene node

2019-02-28 Thread Robert Osfield
Hi Rob,

The OSG is design to allow you to rendering multiple views at once,
there is no need to clone the scene graph, you simply add another View
to a CompositeView to add the extra rendering.  You can toggle
optional View's on/off as you need them.

Robert.

On Thu, 28 Feb 2019 at 17:51, Robert Lockyer
 wrote:
>
> Hi all, my name is Rob.
>
> I'm currently writing a plugin for an OSG based application. I effectively 
> want to create a snapshot of the application's scene graph state and pass it 
> to another thread where I can render to a texture, while the main rendering 
> thread continues with minimal interruption.
>
> I'd like to do this because blocking the main thread with a 
> osgViewer::Viewer::frame() call causes the application to lock up and 
> prevents me from displaying a progress dialog. The scene I render takes a 
> long time because I render many camera views to a single texture.
>
> I'm currently trying to do this:
>
> osg::Node* sceneCopy = 
> dynamic_cast(sceneData_->clone(osg::CopyOp::DEEP_COPY_ALL));
>
> Then passing this to another thread where I run:
>
> viewer_ = new osgViewer::Viewer();
> viewer_->setSceneData(sceneCopy);
>
> However the behavior seems inconsistent. It either dies on a null reference 
> inside osgEarth somewhere or it renders an empty scene. I don't think I fully 
> understand the threading model of OSG, I've read a bit here and there, but I 
> think there's a lot I'm still missing.
>
> Is there a safe way to copy the scene data and use it to run an isolated 
> viewer like this in parallel? Is it even safe to run two viewers in parallel 
> like this at all?
>
> Cheers,
> Rob
>
> This email and any attachments are confidential and may be privileged. Any 
> unauthorized use, disclosure, copying or distribution of the information 
> received is prohibited. If you are not the intended recipient please contact 
> the sender immediately by return email confirming that you have and will 
> delete all communications related to the email and any attachments sent to 
> you in error.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org