Re: [osg-users] reuse of clipping planes?

2010-12-03 Thread Yuri Vanzine
Hi,

Robert,

You outlined how to use a custom osg::ClipPlane to enable multiple ClipNodes 
per scene:

“You can create you own equivilant by subclassing from osg::ClipPlane and 
overriding the apply() then setting the modelview matrix you want and applying 
the clipplanes and then restoring it afterwards before the end of the apply()”

What goes into the apply method? Simply pushing the modelview
matrix and calling the osg::ClipNode::apply method and then popping it does not 
work. The ModelViewMatrix appears to be correctly set.

You also mention in other responses to other engineers about using  RenderStage 
per ClipNode.


Since it has been a few years since some of these conversations, what would be 
your recommendation to best extend osg to allow multiple ClipNodes be active in 
one scene?

Thank you,

Yuri

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





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


Re: [osg-users] reuse of clipping planes?

2010-12-03 Thread Yuri Vanzine
Hi,

My Apologies. The sentence in the middle should read:


What goes into the apply method? Simply pushing the modelview 
matrix and calling the osg::ClipPlane::apply method and then popping it does 
not work. The ModelViewMatrix appears to be correctly set.

Cheers,
Yuri

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





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


Re: [osg-users] reuse of clipping planes?

2010-06-17 Thread Robert Osfield
Hi Jason,

The number of clip planes supported by OpenGL is typically limited to
6, so for a single subgraph this is the hard limit your can't work
around without doing your own shaders.  The advantage your own custom
clip plan class has is that it'd allow you to decorate multiple
subgraphs each with it's own setting for the 6 clip planes, this
overcomes the limitation the OSG adds by restricting you to 6 clip
planes per RenderStage.

Robert.

On Thu, Jun 17, 2010 at 3:44 AM, Jason Jerald ja...@digitalartforms.com wrote:
 Ok, I created my own subclass from osg::ClipPlane and override apply().  I
 confirmed that the code is actually entering my new apply() method and
 successfully set the clipping planes with the correct transforms.  However,
 it seems I am still limited to 6 clipping planes.  I do not see how
 pushing/popping the modelview matrix and setting a new modelview matrix gets
 around the 6 clip plane limit.  The modelview matrix already includes what I
 need (including the local geometric transform), so how does setting the
 matrix myself help?  I must be missing something or perhaps I misunderstood
 your suggestion.

 The only thing I did was override ClipPlane::apply(State).  I am not clear
 in your suggestion if you are saying this is the only thing that is needed
 or if I also need to set up a RenderBin (or a new RenderStage?) for each set
 of 6 clipping planes. Or perhaps I need to call apply() in a different way
 than how osg is already doing it? Or is there something else I am missing?

 Thanks!

 Jason









 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org
 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert
 Osfield
 Sent: Tuesday, May 18, 2010 12:58 AM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] reuse of clipping planes?

 Hi Jason,

 RenderBin's don't have any positional state setup so you can't use
 them directly to enable more clipping planes.  Only RenderStage's set
 up the positional state.

 The FlightGear's workaround isn't a general purpose approach so isn't
 appropriate for the core OSG, so there hasn't been any changes merged
 for this in any OSG version.  You can create you own equivilant by
 subclassing from osg::ClipPlane and overriding the apply() then
 setting the modelview matrix you want and applying the clipplanes and
 then restoring it afterwards before the end of the apply().

 Robert.

 On Tue, May 18, 2010 at 1:26 AM, Jason Jerald ja...@digitalartforms.com
 wrote:
 Thank you Robert, this is some very useful information.

 The most recent related thread I could find on this topic is from Aug/Sept
 2007:
 RFC: Positional state container in the render bin, was: clip planes

 There is discussion in that thread about using renderbins.  What are the
 advantages of using renderbins versus renderstages?  The code attached in
 that thread modifies RenderBin, RenderStage, CullVisitor, and osgClip.
 However, it appears from doing a diff that those changes have not been
 integrated into OSG 2.8.2.  Is this the FlightGear emulate solution you
 mention below, and it is just not integrated into OSG 2.8.2, or are you
 talking about a different solution implemented in a different way?
 Unfortunately simgear.org which contains much of the osg code for
 flightgear
 (at least from my understanding) has not been available for at least the
 last few days.

 Thanks!

 Jason







 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org
 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert
 Osfield
 Sent: Thursday, May 13, 2010 1:21 AM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] reuse of clipping planes?

 Hi Jason,

 Clip planes are an example of positional state, other examples are
 lights and eye linear texgen.  All positional state requires a
 specific modelview matrix to be bound to them to position them
 correctly in space, so unlike other OpenGL/OSG state you can't just
 push/pop and state sort their state and expect to get the correct
 results.

 This difference is handled by the OSG by binding the positional state
 together with a modelview matrix found when encountering the
 ClipNode/TexGenNode/LightSource nodes, and these positional state are
 then applied once at the start of each RenderStage.  Applying the
 state just once for whole RenderStage does enable us to position the
 state uniquely but unfortauntely also means that the positional state
 can only be in one place for the whole stage - you can't nest it.

 You can emulate having multiple sets of Clip planes/texgen/lights by
 having multiple stages, or do what is currently done in FlightGear, to
 use a custom StateAttribute that does the binding to the required
 modelview matrix in the CustomAttribute::apply() method taking care to
 push back the current modelview matrix to prevent the rest of the
 scene being affected.

 Robert.

 On Thu, May 13, 2010 at 2:14 AM, Jason Jerald ja...@digitalartforms.com
 wrote

Re: [osg-users] reuse of clipping planes?

2010-06-16 Thread Jason Jerald
Ok, I created my own subclass from osg::ClipPlane and override apply().  I
confirmed that the code is actually entering my new apply() method and
successfully set the clipping planes with the correct transforms.  However,
it seems I am still limited to 6 clipping planes.  I do not see how
pushing/popping the modelview matrix and setting a new modelview matrix gets
around the 6 clip plane limit.  The modelview matrix already includes what I
need (including the local geometric transform), so how does setting the
matrix myself help?  I must be missing something or perhaps I misunderstood
your suggestion. 

The only thing I did was override ClipPlane::apply(State).  I am not clear
in your suggestion if you are saying this is the only thing that is needed
or if I also need to set up a RenderBin (or a new RenderStage?) for each set
of 6 clipping planes. Or perhaps I need to call apply() in a different way
than how osg is already doing it? Or is there something else I am missing?

Thanks!

Jason









-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert
Osfield
Sent: Tuesday, May 18, 2010 12:58 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] reuse of clipping planes?

Hi Jason,

RenderBin's don't have any positional state setup so you can't use
them directly to enable more clipping planes.  Only RenderStage's set
up the positional state.

The FlightGear's workaround isn't a general purpose approach so isn't
appropriate for the core OSG, so there hasn't been any changes merged
for this in any OSG version.  You can create you own equivilant by
subclassing from osg::ClipPlane and overriding the apply() then
setting the modelview matrix you want and applying the clipplanes and
then restoring it afterwards before the end of the apply().

Robert.

On Tue, May 18, 2010 at 1:26 AM, Jason Jerald ja...@digitalartforms.com
wrote:
 Thank you Robert, this is some very useful information.

 The most recent related thread I could find on this topic is from Aug/Sept
 2007:
 RFC: Positional state container in the render bin, was: clip planes

 There is discussion in that thread about using renderbins.  What are the
 advantages of using renderbins versus renderstages?  The code attached in
 that thread modifies RenderBin, RenderStage, CullVisitor, and osgClip.
 However, it appears from doing a diff that those changes have not been
 integrated into OSG 2.8.2.  Is this the FlightGear emulate solution you
 mention below, and it is just not integrated into OSG 2.8.2, or are you
 talking about a different solution implemented in a different way?
 Unfortunately simgear.org which contains much of the osg code for
flightgear
 (at least from my understanding) has not been available for at least the
 last few days.

 Thanks!

 Jason







 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org
 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert
 Osfield
 Sent: Thursday, May 13, 2010 1:21 AM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] reuse of clipping planes?

 Hi Jason,

 Clip planes are an example of positional state, other examples are
 lights and eye linear texgen.  All positional state requires a
 specific modelview matrix to be bound to them to position them
 correctly in space, so unlike other OpenGL/OSG state you can't just
 push/pop and state sort their state and expect to get the correct
 results.

 This difference is handled by the OSG by binding the positional state
 together with a modelview matrix found when encountering the
 ClipNode/TexGenNode/LightSource nodes, and these positional state are
 then applied once at the start of each RenderStage.  Applying the
 state just once for whole RenderStage does enable us to position the
 state uniquely but unfortauntely also means that the positional state
 can only be in one place for the whole stage - you can't nest it.

 You can emulate having multiple sets of Clip planes/texgen/lights by
 having multiple stages, or do what is currently done in FlightGear, to
 use a custom StateAttribute that does the binding to the required
 modelview matrix in the CustomAttribute::apply() method taking care to
 push back the current modelview matrix to prevent the rest of the
 scene being affected.

 Robert.

 On Thu, May 13, 2010 at 2:14 AM, Jason Jerald ja...@digitalartforms.com
 wrote:


 Evidently most graphics hardware only supports 6-8 clipping planes and
our
 application requires more than that so I  need to somehow reuse clipping
 planes.  I searched the archives and saw there was some discussion of
this
 back in 2007 (something about possibly using the render bin instead of
the
 render stage but it is not clear how to do so).  Has reuse of clipping
 planes since been implemented?  If so how do I do so (I have not been
able
 to figure out how to do so by looking through clipnode)?  Or if not, does
 anyone have any ideas/example of how

Re: [osg-users] reuse of clipping planes?

2010-05-18 Thread Robert Osfield
Hi Jason,

RenderBin's don't have any positional state setup so you can't use
them directly to enable more clipping planes.  Only RenderStage's set
up the positional state.

The FlightGear's workaround isn't a general purpose approach so isn't
appropriate for the core OSG, so there hasn't been any changes merged
for this in any OSG version.  You can create you own equivilant by
subclassing from osg::ClipPlane and overriding the apply() then
setting the modelview matrix you want and applying the clipplanes and
then restoring it afterwards before the end of the apply().

Robert.

On Tue, May 18, 2010 at 1:26 AM, Jason Jerald ja...@digitalartforms.com wrote:
 Thank you Robert, this is some very useful information.

 The most recent related thread I could find on this topic is from Aug/Sept
 2007:
 RFC: Positional state container in the render bin, was: clip planes

 There is discussion in that thread about using renderbins.  What are the
 advantages of using renderbins versus renderstages?  The code attached in
 that thread modifies RenderBin, RenderStage, CullVisitor, and osgClip.
 However, it appears from doing a diff that those changes have not been
 integrated into OSG 2.8.2.  Is this the FlightGear emulate solution you
 mention below, and it is just not integrated into OSG 2.8.2, or are you
 talking about a different solution implemented in a different way?
 Unfortunately simgear.org which contains much of the osg code for flightgear
 (at least from my understanding) has not been available for at least the
 last few days.

 Thanks!

 Jason







 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org
 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert
 Osfield
 Sent: Thursday, May 13, 2010 1:21 AM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] reuse of clipping planes?

 Hi Jason,

 Clip planes are an example of positional state, other examples are
 lights and eye linear texgen.  All positional state requires a
 specific modelview matrix to be bound to them to position them
 correctly in space, so unlike other OpenGL/OSG state you can't just
 push/pop and state sort their state and expect to get the correct
 results.

 This difference is handled by the OSG by binding the positional state
 together with a modelview matrix found when encountering the
 ClipNode/TexGenNode/LightSource nodes, and these positional state are
 then applied once at the start of each RenderStage.  Applying the
 state just once for whole RenderStage does enable us to position the
 state uniquely but unfortauntely also means that the positional state
 can only be in one place for the whole stage - you can't nest it.

 You can emulate having multiple sets of Clip planes/texgen/lights by
 having multiple stages, or do what is currently done in FlightGear, to
 use a custom StateAttribute that does the binding to the required
 modelview matrix in the CustomAttribute::apply() method taking care to
 push back the current modelview matrix to prevent the rest of the
 scene being affected.

 Robert.

 On Thu, May 13, 2010 at 2:14 AM, Jason Jerald ja...@digitalartforms.com
 wrote:


 Evidently most graphics hardware only supports 6-8 clipping planes and our
 application requires more than that so I  need to somehow reuse clipping
 planes.  I searched the archives and saw there was some discussion of this
 back in 2007 (something about possibly using the render bin instead of the
 render stage but it is not clear how to do so).  Has reuse of clipping
 planes since been implemented?  If so how do I do so (I have not been able
 to figure out how to do so by looking through clipnode)?  Or if not, does
 anyone have any ideas/example of how to implement reuse of clipping
 planes?



 Thanks so much!



 Jason



 ___
 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

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


Re: [osg-users] reuse of clipping planes?

2010-05-17 Thread Jason Jerald
Thank you Robert, this is some very useful information.

The most recent related thread I could find on this topic is from Aug/Sept
2007:
RFC: Positional state container in the render bin, was: clip planes

There is discussion in that thread about using renderbins.  What are the
advantages of using renderbins versus renderstages?  The code attached in
that thread modifies RenderBin, RenderStage, CullVisitor, and osgClip.
However, it appears from doing a diff that those changes have not been
integrated into OSG 2.8.2.  Is this the FlightGear emulate solution you
mention below, and it is just not integrated into OSG 2.8.2, or are you
talking about a different solution implemented in a different way?
Unfortunately simgear.org which contains much of the osg code for flightgear
(at least from my understanding) has not been available for at least the
last few days.  

Thanks!

Jason


 




-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert
Osfield
Sent: Thursday, May 13, 2010 1:21 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] reuse of clipping planes?

Hi Jason,

Clip planes are an example of positional state, other examples are
lights and eye linear texgen.  All positional state requires a
specific modelview matrix to be bound to them to position them
correctly in space, so unlike other OpenGL/OSG state you can't just
push/pop and state sort their state and expect to get the correct
results.

This difference is handled by the OSG by binding the positional state
together with a modelview matrix found when encountering the
ClipNode/TexGenNode/LightSource nodes, and these positional state are
then applied once at the start of each RenderStage.  Applying the
state just once for whole RenderStage does enable us to position the
state uniquely but unfortauntely also means that the positional state
can only be in one place for the whole stage - you can't nest it.

You can emulate having multiple sets of Clip planes/texgen/lights by
having multiple stages, or do what is currently done in FlightGear, to
use a custom StateAttribute that does the binding to the required
modelview matrix in the CustomAttribute::apply() method taking care to
push back the current modelview matrix to prevent the rest of the
scene being affected.

Robert.

On Thu, May 13, 2010 at 2:14 AM, Jason Jerald ja...@digitalartforms.com
wrote:


 Evidently most graphics hardware only supports 6-8 clipping planes and our
 application requires more than that so I  need to somehow reuse clipping
 planes.  I searched the archives and saw there was some discussion of this
 back in 2007 (something about possibly using the render bin instead of the
 render stage but it is not clear how to do so).  Has reuse of clipping
 planes since been implemented?  If so how do I do so (I have not been able
 to figure out how to do so by looking through clipnode)?  Or if not, does
 anyone have any ideas/example of how to implement reuse of clipping
planes?



 Thanks so much!



 Jason



 ___
 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] reuse of clipping planes?

2010-05-13 Thread Robert Osfield
Hi Jason,

Clip planes are an example of positional state, other examples are
lights and eye linear texgen.  All positional state requires a
specific modelview matrix to be bound to them to position them
correctly in space, so unlike other OpenGL/OSG state you can't just
push/pop and state sort their state and expect to get the correct
results.

This difference is handled by the OSG by binding the positional state
together with a modelview matrix found when encountering the
ClipNode/TexGenNode/LightSource nodes, and these positional state are
then applied once at the start of each RenderStage.  Applying the
state just once for whole RenderStage does enable us to position the
state uniquely but unfortauntely also means that the positional state
can only be in one place for the whole stage - you can't nest it.

You can emulate having multiple sets of Clip planes/texgen/lights by
having multiple stages, or do what is currently done in FlightGear, to
use a custom StateAttribute that does the binding to the required
modelview matrix in the CustomAttribute::apply() method taking care to
push back the current modelview matrix to prevent the rest of the
scene being affected.

Robert.

On Thu, May 13, 2010 at 2:14 AM, Jason Jerald ja...@digitalartforms.com wrote:


 Evidently most graphics hardware only supports 6-8 clipping planes and our
 application requires more than that so I  need to somehow reuse clipping
 planes.  I searched the archives and saw there was some discussion of this
 back in 2007 (something about possibly using the render bin instead of the
 render stage but it is not clear how to do so).  Has reuse of clipping
 planes since been implemented?  If so how do I do so (I have not been able
 to figure out how to do so by looking through clipnode)?  Or if not, does
 anyone have any ideas/example of how to implement reuse of clipping planes?



 Thanks so much!



 Jason



 ___
 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] reuse of clipping planes?

2010-05-12 Thread Jason Jerald
 

Evidently most graphics hardware only supports 6-8 clipping planes and our
application requires more than that so I  need to somehow reuse clipping
planes.  I searched the archives and saw there was some discussion of this
back in 2007 (something about possibly using the render bin instead of the
render stage but it is not clear how to do so).  Has reuse of clipping
planes since been implemented?  If so how do I do so (I have not been able
to figure out how to do so by looking through clipnode)?  Or if not, does
anyone have any ideas/example of how to implement reuse of clipping planes?

 

Thanks so much!

 

Jason

 

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