[osg-users] clipping problem with PagedLODs--RESOLVED

Jason Jerald jason at dartforms.com
Tue Apr 19 11:18:48 PDT 2011


Hi Robert.  I actually did successfully get clip planes working with your
help via this list in June of last year (in the same way that you explain
below).  My concern was that it did not seem to be working with PagedLOD
models.  However, it turned out that I was looking in the wrong place.  The
pagedLOD geometry was using a different vertex shader than I was expecting.
This shader did not calculate
gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
Now that I added this line to the vertex shader, the reuseable clip plans
(as you suggest below) does indeed work with PagedLODs.

Thanks,

Jason



-----Original Message-----
From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Robert
Osfield
Sent: Tuesday, April 19, 2011 1:33 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] clipping problem with PagedLODs

Hi Jason,

The wa that the OSG handles positional state like clip planes is pair
the a specific modelview matrix with the positional state, the
modelview matrix used in provided when the cull traversal encounters a
positional state node like ClipNode, TexGenNode or LightSource, and
the pairing is done such that there is only one posible modelview
matrix per positional state, on per RenderStage basis.  This approach
ensures that clip planes, eye linear texgen and light sources all have
a single place in space for rendering a whole stage, but it does mean
you can't reuse a clip plane, eye linear tex gen, or light within on
stage.

The only ways to support multiple clip planes or other positional
state is to dispense with the positional state nodes completely and
have custom state attribute that binds a specific modelview matrix to
that state and applies this before applying the state, but straight
away after applying the state will need to restore the original
modelview matrix.   You will also need to geneate the specific
modelview matrix somehow, a custom node like ClipNode might be
approrpriate.

How this all relates to what you have done I can't say, there is no
way for me to comment as the code is infront of you not me.

Robert.


On Mon, Apr 18, 2011 at 11:48 PM, Jason Jerald <jason at dartforms.com> wrote:
>
>
> I created two new classes:  ClipNodeReused inherited from ClipNode, and
> ClipPlaneReused from ClipPlane (basically just overriding
> apply(osg::State&)).  These classes enable me to reuse the OpenGL clipping
> planes so that I can do more than the graphics hardware limit of 6-8
> clipping planes.  This has worked well.  However, I recently discovered
that
> some model files do not get clipped correctly.  The only thing that I see
is
> different about these files is that they contain PagedLODs.  I am not sure
> of the details of LODs to know if some form of clipping (perhaps as part
of
> some form of culling?) might be happening that is keeping my custom
clipping
> from occurring.  Have others been able to clip PagedLODs successfully? 
Any
> ideas what might be going wrong here?
>
>
>
> Thanks!
>
>
>
> Jason
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org





More information about the osg-users mailing list