[osg-users] Having an issue with OSG plugins error.

2017-04-11 Thread Brigham Keys, Esq.
Hello all,

I have OpenSceneGraph set up in my project, however when I try to load
any files I always get this error

Error reading file build/untitled.osgt: read error (Could not find
plugin to read objects from file "build/untitled.osgt".)

Which I did not think I needed a plugin set up for the native format, it
does this on .obj and on .dae parsing as well and the 3D model never
gets loaded into the scene. I tried doing this with files that could not
possibly be real and it gives me the exact same error (and not an error
relating to the file not existing). Has anyone else experienced this issue?


-- 
*Brigham Keys, Esq.*
|Software Maintainer|
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Recommended way to render a scene from multiple independent viewpoints

2017-04-11 Thread Hannes Naude
Robert

Thanks so much for your help. That makes a lot of sense. I'll go implement
the approach where the traversal is stopped at the shared subgraph root.

Regards
Hannes

On Tue, Apr 11, 2017 at 8:08 PM, Robert Osfield 
wrote:

> HI Hannes,
>
> The osgViewer has a mechanism for avoid multiple traversals of shared
> scene graphs if mutlple View's share the same root node of the scene
> graph.  If shared component isn't the topmost node then the OSG has no
> straight forward way to know whether a subgraph has been traversed or
> not that frame.  One could implement a mechanism to avoid this
> visiting a node multiple times in one frame but it would be really
> costly to do, an expense that would only be a benefit for a very small
> number of users, but would slow performance for everyone else.
>
> The most efficient way to avoid this multiple traversals issue is to
> implement to have a custom callback that is tailored to the specific
> usage case that a user has.  I don't know enough about the specific
> callbacks and scene graph set up you have so I can't pinpoint the best
> route.
>
> If you have a shared subgraph that you don't want traversed multiple
> times per frame then use an UpdateCallback that has a frameNumber
> member variable that keep track of the the frameNumber (use
> NodeVisitor::getFrameStamp()'s FrameNumber) of the last traversal,
> when a traversal calls the update callback you only traverse the
> subgraph if the frameNumber is different and then set the frameNumber
> to the present frame,  if the frameNumber is the same then you just
> return immediately.  This custom UpdateCallback you'd place as high as
> you can in your scene graph to make sure the traversal stops as soon
> as possible.
>
> Another approach is to move this frameNumber tracking into your
> existing update callbacks, and simple return right away with the
> frameNumber is the same.  This requires a small tweak to the callbacks
> but is such a small change it's generally pretty easy to integrate.
>
> Finally you can simple make your callbacks resilient so that the are
> no ill effects from being called multiple times.
>
> Robert.
>
> On 11 April 2017 at 18:48, Hannes Naude  wrote:
> > Thanks Riccardo and Robert for your inputs.
> >
> > Robert, yes you are correct that the only issue I had with the
> > CompositeViewer was that the same Node's callback would get called as
> many
> > times as views that it appeared in. This means that for example if I
> have a
> > simple update that would translate a node a fixed amount, then nodes that
> > appear in mulitple views would move faster than those that appear in a
> > single view only. Also, as I add more cameras nodes end up moving faster.
> >
> > Obviously I can fix this in the update callback itself, by checking
> > something like simulationTime (and I would ultimately have to do this
> anyway
> > to make my motion happen at the same speed, irrespective of frame rate),
> but
> > I would prefer to not have the callbacks called at all when not required.
> >
> > Incidentally, I found that the (non-composite) viewer did not immediately
> > solve this. It would only go away if all my cameras shared the exact same
> > root node. Now I have some symbology that I wish to display on one
> camera,
> > but not the others, but I managed to achieve this by setting the nodemask
> > appropriately.
> >
> > I am not really doing anything fancy with the callbacks. I created a
> class
> > which extends osg::Callback and overrode the run method to update a
> > MatrixTransform node (via getMatrix and setMatrix). I then created
> another
> > class which extends MatrixTransform and in the constructor I call
> >
> > this->setUpdateCallback
> >
> > providing an instance of my callback class as the argument. Now whenever
> I
> > add an instance of my MatrixTransform class to the scenegraph, it
> implements
> > the motion I want.
> >
> > This seems to work, except for the multiple update problem.
> >
> > Hannes
> >
> >
> > On Tue, Apr 11, 2017 at 3:09 PM, Robert Osfield <
> robert.osfi...@gmail.com>
> > wrote:
> >>
> >> HI Hannes,
> >>
> >> The CompositeViewer was written specifically for your usage case -
> >> i.e. multiple Views.
> >>
> >> I wouldn't recommend using slave Camera's for doing multiple views,
> >> while possible it's just a mess in terms of management.  slave
> >> Camera's are tools for helping rendering a single view, but with a
> >> view that is composed of several components - either spread across
> >> multiple windows, or a view that requires multiple passes such as
> >> distortion correction, field of view etc.
> >>
> >> The only reason you drawback you state about using CompositeViewer is
> >> multiple update traversals. Is this correct?  If so then the
> >> discussion should be about what problems you are having with
> >> callbacks, as the solution will likely related to how you are doing
> >> callbacks rather high level viewer 

[osg-users] Screen Space 2D Axis Alligned Bounding Box (AABB)

2017-04-11 Thread James Takarashy
Hi,

I have some trouble generating a screen space 2D bounding box for my nodes. 


Code:

Matrix viewMat = camera->getViewMatrix();
Matrix projMat = camera->getProjectionMatrix();
Viewport* vp = camera->getViewport();
Matrix vpMa = vp->computeWindowMatrix();

// Returns root scene graph node of the Object.
osg::Node* node = data.object->getRoot();

osg::ComputeBoundsVisitor cbv;
node->accept(cbv);
osg::BoundingBox bb = cbv.getBoundingBox();

// Skipping node since BB is invalid
if (!bb.valid())
{
 continue;
}

notify("World BBox x: %f %f, y:%f %f, z:%f %f", bb.xMin(), bb.xMax(), 
bb.yMin(), bb.yMax(), bb.zMin(), bb.zMax());

// Generate all 8 points of our AxisAligned BoundingBox in World Space
typedef std::vector BBoxPoints;
BBoxPoints bBoxPoints;

bBoxPoints.push_back(osg::Vec3d(bb.xMin(), bb.yMin(), bb.zMin()));
bBoxPoints.push_back(osg::Vec3d(bb.xMin(), bb.yMin(), bb.zMax()));
bBoxPoints.push_back(osg::Vec3d(bb.xMin(), bb.yMax(), bb.zMin()));
bBoxPoints.push_back(osg::Vec3d(bb.xMin(), bb.yMax(), bb.zMax()));
bBoxPoints.push_back(osg::Vec3d(bb.xMax(), bb.yMin(), bb.zMin()));
bBoxPoints.push_back(osg::Vec3d(bb.xMax(), bb.yMin(), bb.zMax()));
bBoxPoints.push_back(osg::Vec3d(bb.xMax(), bb.yMax(), bb.zMin()));
bBoxPoints.push_back(osg::Vec3d(bb.xMax(), bb.yMax(), bb.zMax()));

BBoxPoints::iterator it = bBoxPoints.begin();
for (; it != bBoxPoints.end(); ++it)
{
osg::Vec3d& point = *it;

// Transform world space point -> view space -> clip space -> screen space
point = point * viewMat * projMat * vpMat;
}

bool pointsInitialized = false;
osg::Vec3d minScreenSpace(0.0, 0.0, 0.0), maxScreenSpace(0.0, 0.0, 0.0);
for (it = bBoxPoints.begin(); it != bBoxPoints.end(); ++it)
{
osg::Vec3d& point = *it;

if (pointsInitialized)
{
minScreenSpace = osg::Vec3d(min(minScreenSpace.x(), point.x()),
 
min(minScreenSpace.y(), point.y()),
 
min(minScreenSpace.z(), point.z()));

maxScreenSpace = osg::Vec3d(max(maxScreenSpace.x(), point.x()),
  
max(maxScreenSpace.y(), point.y()),
  
max(maxScreenSpace.z(), point.z()));
}
else
{
 minScreenSpace = point;
 maxScreenSpace = point;
 pointsInitialized = true;
}
}

notify("minScreenSpace: %f %f %f, maxScreenSpace: %f %f %f",
  minScreenSpace.x(), minScreenSpace.y(), minScreenSpace.z(),
  maxScreenSpace.x(), maxScreenSpace.y(), maxScreenSpace.z());




If I draw my BoundingBox, the results I get are wrong since they are positioned 
higher than the actual object. Also, they seem bigger than the actual BBox.
Is there something I'm missing in my calculation? Some rotation of the object 
or flipping of coordinates when the object is facing away from the camera? I 
thought my code is rotation independent, but one never knows.

So if you spot something missing I would be really happy!
Thank you!

Cheers,
James

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70741#70741





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


Re: [osg-users] Recommended way to render a scene from multiple independent viewpoints

2017-04-11 Thread Robert Osfield
HI Hannes,

The osgViewer has a mechanism for avoid multiple traversals of shared
scene graphs if mutlple View's share the same root node of the scene
graph.  If shared component isn't the topmost node then the OSG has no
straight forward way to know whether a subgraph has been traversed or
not that frame.  One could implement a mechanism to avoid this
visiting a node multiple times in one frame but it would be really
costly to do, an expense that would only be a benefit for a very small
number of users, but would slow performance for everyone else.

The most efficient way to avoid this multiple traversals issue is to
implement to have a custom callback that is tailored to the specific
usage case that a user has.  I don't know enough about the specific
callbacks and scene graph set up you have so I can't pinpoint the best
route.

If you have a shared subgraph that you don't want traversed multiple
times per frame then use an UpdateCallback that has a frameNumber
member variable that keep track of the the frameNumber (use
NodeVisitor::getFrameStamp()'s FrameNumber) of the last traversal,
when a traversal calls the update callback you only traverse the
subgraph if the frameNumber is different and then set the frameNumber
to the present frame,  if the frameNumber is the same then you just
return immediately.  This custom UpdateCallback you'd place as high as
you can in your scene graph to make sure the traversal stops as soon
as possible.

Another approach is to move this frameNumber tracking into your
existing update callbacks, and simple return right away with the
frameNumber is the same.  This requires a small tweak to the callbacks
but is such a small change it's generally pretty easy to integrate.

Finally you can simple make your callbacks resilient so that the are
no ill effects from being called multiple times.

Robert.

On 11 April 2017 at 18:48, Hannes Naude  wrote:
> Thanks Riccardo and Robert for your inputs.
>
> Robert, yes you are correct that the only issue I had with the
> CompositeViewer was that the same Node's callback would get called as many
> times as views that it appeared in. This means that for example if I have a
> simple update that would translate a node a fixed amount, then nodes that
> appear in mulitple views would move faster than those that appear in a
> single view only. Also, as I add more cameras nodes end up moving faster.
>
> Obviously I can fix this in the update callback itself, by checking
> something like simulationTime (and I would ultimately have to do this anyway
> to make my motion happen at the same speed, irrespective of frame rate), but
> I would prefer to not have the callbacks called at all when not required.
>
> Incidentally, I found that the (non-composite) viewer did not immediately
> solve this. It would only go away if all my cameras shared the exact same
> root node. Now I have some symbology that I wish to display on one camera,
> but not the others, but I managed to achieve this by setting the nodemask
> appropriately.
>
> I am not really doing anything fancy with the callbacks. I created a class
> which extends osg::Callback and overrode the run method to update a
> MatrixTransform node (via getMatrix and setMatrix). I then created another
> class which extends MatrixTransform and in the constructor I call
>
> this->setUpdateCallback
>
> providing an instance of my callback class as the argument. Now whenever I
> add an instance of my MatrixTransform class to the scenegraph, it implements
> the motion I want.
>
> This seems to work, except for the multiple update problem.
>
> Hannes
>
>
> On Tue, Apr 11, 2017 at 3:09 PM, Robert Osfield 
> wrote:
>>
>> HI Hannes,
>>
>> The CompositeViewer was written specifically for your usage case -
>> i.e. multiple Views.
>>
>> I wouldn't recommend using slave Camera's for doing multiple views,
>> while possible it's just a mess in terms of management.  slave
>> Camera's are tools for helping rendering a single view, but with a
>> view that is composed of several components - either spread across
>> multiple windows, or a view that requires multiple passes such as
>> distortion correction, field of view etc.
>>
>> The only reason you drawback you state about using CompositeViewer is
>> multiple update traversals. Is this correct?  If so then the
>> discussion should be about what problems you are having with
>> callbacks, as the solution will likely related to how you are doing
>> callbacks rather high level viewer configuration.
>>
>> Robert.
>>
>> On 11 April 2017 at 12:08, Hannes Naude  wrote:
>> > Hi all
>> >
>> > I am trying to render a single scene from multiple viewpoints. I
>> > initially
>> > implemented this with a compositeviewer as per the osgthirdpersonview
>> > example. This worked fine except that my update callbacks appeared to be
>> > getting called more than once per render cycle. I assumed that the
>> > update
>> > traversal was 

Re: [osg-users] Recommended way to render a scene from multiple independent viewpoints

2017-04-11 Thread Hannes Naude
Thanks Riccardo and Robert for your inputs.

Robert, yes you are correct that the only issue I had with the
CompositeViewer was that the same Node's callback would get called as many
times as views that it appeared in. This means that for example if I have a
simple update that would translate a node a fixed amount, then nodes that
appear in mulitple views would move faster than those that appear in a
single view only. Also, as I add more cameras nodes end up moving faster.

Obviously I can fix this in the update callback itself, by checking
something like simulationTime (and I would ultimately have to do this
anyway to make my motion happen at the same speed, irrespective of frame
rate), but I would prefer to not have the callbacks called at all when not
required.

Incidentally, I found that the (non-composite) viewer did not immediately
solve this. It would only go away if all my cameras shared the exact same
root node. Now I have some symbology that I wish to display on one camera,
but not the others, but I managed to achieve this by setting the nodemask
appropriately.

I am not really doing anything fancy with the callbacks. I created a class
which extends osg::Callback and overrode the run method to update a
MatrixTransform node (via getMatrix and setMatrix). I then created another
class which extends MatrixTransform and in the constructor I call

this->setUpdateCallback

providing an instance of my callback class as the argument. Now whenever I
add an instance of my MatrixTransform class to the scenegraph, it
implements the motion I want.

This seems to work, except for the multiple update problem.

Hannes


On Tue, Apr 11, 2017 at 3:09 PM, Robert Osfield 
wrote:

> HI Hannes,
>
> The CompositeViewer was written specifically for your usage case -
> i.e. multiple Views.
>
> I wouldn't recommend using slave Camera's for doing multiple views,
> while possible it's just a mess in terms of management.  slave
> Camera's are tools for helping rendering a single view, but with a
> view that is composed of several components - either spread across
> multiple windows, or a view that requires multiple passes such as
> distortion correction, field of view etc.
>
> The only reason you drawback you state about using CompositeViewer is
> multiple update traversals. Is this correct?  If so then the
> discussion should be about what problems you are having with
> callbacks, as the solution will likely related to how you are doing
> callbacks rather high level viewer configuration.
>
> Robert.
>
> On 11 April 2017 at 12:08, Hannes Naude  wrote:
> > Hi all
> >
> > I am trying to render a single scene from multiple viewpoints. I
> initially
> > implemented this with a compositeviewer as per the osgthirdpersonview
> > example. This worked fine except that my update callbacks appeared to be
> > getting called more than once per render cycle. I assumed that the update
> > traversal was being done for each view separately and therefore nodes
> that
> > are present in multiple views will have their update callbacks called
> > multiple times. So, at this point I tried to do the same thing but with a
> > single View, somewhat similar to the osgCamera example. But, I do not
> want
> > to add my cameras with viewer.addSlave as I want them to move
> independently
> > of one another. So I tried adding them into the scene graph and giving
> each
> > their own GraphicsContext, but even though the windows corresponding to
> > these GraphicsContexts get created, it appears as if all rendering is
> done
> > in a single window with multiple viewpoints being rendered over one
> another.
> >
> > Obviously there are many ways to skin this cat, but I would appreciate
> some
> > guidance on the recommended approach. To recap my requirements are :
> >  - Multiple cameras viewing the same scene.
> >  - Camera positions and orientations must be independently controlled.
> >  - Node update callbacks should be called only once per Node per render
> > cycle.
> >
> > Any help will be appreciated
> >
> > Regards
> > Hannes Naude
> >
> > ___
> > 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
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Recommended way to render a scene from multiple independent viewpoints

2017-04-11 Thread Robert Osfield
HI Hannes,

The CompositeViewer was written specifically for your usage case -
i.e. multiple Views.

I wouldn't recommend using slave Camera's for doing multiple views,
while possible it's just a mess in terms of management.  slave
Camera's are tools for helping rendering a single view, but with a
view that is composed of several components - either spread across
multiple windows, or a view that requires multiple passes such as
distortion correction, field of view etc.

The only reason you drawback you state about using CompositeViewer is
multiple update traversals. Is this correct?  If so then the
discussion should be about what problems you are having with
callbacks, as the solution will likely related to how you are doing
callbacks rather high level viewer configuration.

Robert.

On 11 April 2017 at 12:08, Hannes Naude  wrote:
> Hi all
>
> I am trying to render a single scene from multiple viewpoints. I initially
> implemented this with a compositeviewer as per the osgthirdpersonview
> example. This worked fine except that my update callbacks appeared to be
> getting called more than once per render cycle. I assumed that the update
> traversal was being done for each view separately and therefore nodes that
> are present in multiple views will have their update callbacks called
> multiple times. So, at this point I tried to do the same thing but with a
> single View, somewhat similar to the osgCamera example. But, I do not want
> to add my cameras with viewer.addSlave as I want them to move independently
> of one another. So I tried adding them into the scene graph and giving each
> their own GraphicsContext, but even though the windows corresponding to
> these GraphicsContexts get created, it appears as if all rendering is done
> in a single window with multiple viewpoints being rendered over one another.
>
> Obviously there are many ways to skin this cat, but I would appreciate some
> guidance on the recommended approach. To recap my requirements are :
>  - Multiple cameras viewing the same scene.
>  - Camera positions and orientations must be independently controlled.
>  - Node update callbacks should be called only once per Node per render
> cycle.
>
> Any help will be appreciated
>
> Regards
> Hannes Naude
>
> ___
> 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


Re: [osg-users] Recommended way to render a scene from multiple independent viewpoints

2017-04-11 Thread Riccardo Corsi
Hi Hannes,

for the camera setup you're after I recommend using a SlaveUpdateCallback,
which will be called once per frame for each slave camera, allowing you to
manipulate the camera position/orientation at will.

Here's a code snippet:

// implement a slave callback to place the camera as you want
class MySlaveCallback : public osg::View::Slave::UpdateSlaveCallback
{
   // implement update method
   virtual void updateSlave(osg::View& view, osg::View::Slave& slave){ ... }
}

// add the camera as slave
slaveCam->setGraphicsContext(gc);
viewer.addSlave(slaveCam, true);

// install your callback
osg::View::Slave* slave = viewer.findSlaveForCamera(slaveCam);
slave->_updateSlaveCallback = pMirrorCallback;

Ricky

On Tue, Apr 11, 2017 at 2:11 PM, Hannes Naude  wrote:

> I think I solved my own problem. I was planning to use
>
> viewer.addSlave(cam,...)
>
>
> and then use
>
> cam->setReferenceFrame(osg::Transform::ABSOLUTE_RF)
>
>
> to decouple the slave camera from the master. (If this is not the best
> approach, I would still like to hear, but it seems pretty clean)
>
> It turned out that I did not even need the second call. I think this is
> because I have an update callback attached to each of the slave cameras
> that explicitly sets the view matrix to match the world-to-local matrix of
> some node in the scenegraph and thereby overrides the slaving.
>
> By the way, this is something else that has bothered me. The requirement
> for a camera to track a node in the scenegraph seems like it should be
> extremely common. But in order to implement this I had to write my own
> little NodeTracker Callback as follows:
>
> class NodeTracker : public NodeCallback
>
> {
>
> public:
>
>NodePath _nodepath;
>
>
>NodeTracker(Node* node):_nodepath(node->getParentalNodePaths()[0]){}
>
>
>virtual void operator()(Node* node, NodeVisitor* nv)
>
>{
>
>  ref_ptr cam=node->asCamera();
>
>  if(cam)
>
>  {
>
>  Matrix mat2=cam->getViewMatrix();
>
>  Matrix mat=computeWorldToLocal(_nodepath);
>
> cam->setViewMatrix(mat);
>
>  }
>
>  traverse(node, nv);
>
>}
>
> };
>
> It feels like this is such a common requirement that something like it
> should be built into OSG. I had a look at the tutorial on the subject :
>
> http://trac.openscenegraph.org/projects/osg//wiki/Support/Tutorials/
> CameraControlNodeFollowing
>
> but it recommends a solution that seems even more generally useful and is
> quite verbose, yet is not included in osg. What am I missing here?
>
> Regards
> Hannes Naude
>
>
> On Tue, Apr 11, 2017 at 1:08 PM, Hannes Naude  wrote:
>
>> Hi all
>>
>> I am trying to render a single scene from multiple viewpoints. I
>> initially implemented this with a compositeviewer as per the
>> osgthirdpersonview example. This worked fine except that my update
>> callbacks appeared to be getting called more than once per render cycle. I
>> assumed that the update traversal was being done for each view separately
>> and therefore nodes that are present in multiple views will have their
>> update callbacks called multiple times. So, at this point I tried to do the
>> same thing but with a single View, somewhat similar to the osgCamera
>> example. But, I do not want to add my cameras with viewer.addSlave as I
>> want them to move independently of one another. So I tried adding them into
>> the scene graph and giving each their own GraphicsContext, but even though
>> the windows corresponding to these GraphicsContexts get created, it appears
>> as if all rendering is done in a single window with multiple viewpoints
>> being rendered over one another.
>>
>> Obviously there are many ways to skin this cat, but I would appreciate
>> some guidance on the recommended approach. To recap my requirements are :
>>  - Multiple cameras viewing the same scene.
>>  - Camera positions and orientations must be independently controlled.
>>  - Node update callbacks should be called only once per Node per render
>> cycle.
>>
>> Any help will be appreciated
>>
>> Regards
>> Hannes Naude
>>
>
>
> ___
> 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


Re: [osg-users] Recommended way to render a scene from multiple independent viewpoints

2017-04-11 Thread Hannes Naude
I think I solved my own problem. I was planning to use

viewer.addSlave(cam,...)


and then use

cam->setReferenceFrame(osg::Transform::ABSOLUTE_RF)


to decouple the slave camera from the master. (If this is not the best
approach, I would still like to hear, but it seems pretty clean)

It turned out that I did not even need the second call. I think this is
because I have an update callback attached to each of the slave cameras
that explicitly sets the view matrix to match the world-to-local matrix of
some node in the scenegraph and thereby overrides the slaving.

By the way, this is something else that has bothered me. The requirement
for a camera to track a node in the scenegraph seems like it should be
extremely common. But in order to implement this I had to write my own
little NodeTracker Callback as follows:

class NodeTracker : public NodeCallback

{

public:

   NodePath _nodepath;


   NodeTracker(Node* node):_nodepath(node->getParentalNodePaths()[0]){}


   virtual void operator()(Node* node, NodeVisitor* nv)

   {

 ref_ptr cam=node->asCamera();

 if(cam)

 {

 Matrix mat2=cam->getViewMatrix();

 Matrix mat=computeWorldToLocal(_nodepath);

cam->setViewMatrix(mat);

 }

 traverse(node, nv);

   }

};

It feels like this is such a common requirement that something like it
should be built into OSG. I had a look at the tutorial on the subject :

http://trac.openscenegraph.org/projects/osg//wiki/Support/Tutorials/CameraControlNodeFollowing

but it recommends a solution that seems even more generally useful and is
quite verbose, yet is not included in osg. What am I missing here?

Regards
Hannes Naude


On Tue, Apr 11, 2017 at 1:08 PM, Hannes Naude  wrote:

> Hi all
>
> I am trying to render a single scene from multiple viewpoints. I initially
> implemented this with a compositeviewer as per the osgthirdpersonview
> example. This worked fine except that my update callbacks appeared to be
> getting called more than once per render cycle. I assumed that the update
> traversal was being done for each view separately and therefore nodes that
> are present in multiple views will have their update callbacks called
> multiple times. So, at this point I tried to do the same thing but with a
> single View, somewhat similar to the osgCamera example. But, I do not want
> to add my cameras with viewer.addSlave as I want them to move independently
> of one another. So I tried adding them into the scene graph and giving each
> their own GraphicsContext, but even though the windows corresponding to
> these GraphicsContexts get created, it appears as if all rendering is done
> in a single window with multiple viewpoints being rendered over one another.
>
> Obviously there are many ways to skin this cat, but I would appreciate
> some guidance on the recommended approach. To recap my requirements are :
>  - Multiple cameras viewing the same scene.
>  - Camera positions and orientations must be independently controlled.
>  - Node update callbacks should be called only once per Node per render
> cycle.
>
> Any help will be appreciated
>
> Regards
> Hannes Naude
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Recommended way to render a scene from multiple independent viewpoints

2017-04-11 Thread Hannes Naude
Hi all

I am trying to render a single scene from multiple viewpoints. I initially
implemented this with a compositeviewer as per the osgthirdpersonview
example. This worked fine except that my update callbacks appeared to be
getting called more than once per render cycle. I assumed that the update
traversal was being done for each view separately and therefore nodes that
are present in multiple views will have their update callbacks called
multiple times. So, at this point I tried to do the same thing but with a
single View, somewhat similar to the osgCamera example. But, I do not want
to add my cameras with viewer.addSlave as I want them to move independently
of one another. So I tried adding them into the scene graph and giving each
their own GraphicsContext, but even though the windows corresponding to
these GraphicsContexts get created, it appears as if all rendering is done
in a single window with multiple viewpoints being rendered over one another.

Obviously there are many ways to skin this cat, but I would appreciate some
guidance on the recommended approach. To recap my requirements are :
 - Multiple cameras viewing the same scene.
 - Camera positions and orientations must be independently controlled.
 - Node update callbacks should be called only once per Node per render
cycle.

Any help will be appreciated

Regards
Hannes Naude
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] OsgParticles

2017-04-11 Thread Rambabu Repaka
Hi,Iam using Osgparticleeffects.cpp where smoke particles are generating in the 
top side how to change the direction of smoke particles ?

... 

Thank you!

Cheers,
Rambabu

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70733#70733





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