Re: [osg-users] getDistanceToViewPoint not implemented in osgUtil::IntersectionVisitor

2009-03-19 Thread Robert Osfield
Hi Jason,

2009/3/19 Jason Beverage 

> Hi Robert,
>
> I was looking through CullVisitor and trying to get my head around the
> difference between the eye point and the viewpoint.  Is the viewpoint stack
> is used to deal with internal camera nodes then?  Then the "eye" point is
> the main camera's position while the "view" point would be used for
> currently executing camera node.  If you don't have any internal camera
> nodes, then would the eye point and the viewpoint be equivalent?
>

It's actually the other way around.  The eye point is the local cameras eye
point, while the viewpoint is the viewer's master camera's eye point,
normally they coincide, but in the case of RTT effects like shadows you will
generate the shadow from the light source center/direction while you'll
still want LOD calculation done against the viewer's eye point.

In the case of intersection testing you sometime want to use a dummy eye
point, such as by setting the "eye" point to the end of
LineSegmentIntersector, this can be done to make sure that LOD setting are
selected appropriate for your needs, same goes to billboard rotations.

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


Re: [osg-users] getDistanceToViewPoint not implemented in osgUtil::IntersectionVisitor

2009-03-19 Thread Jason Beverage
Hi Robert,

I was looking through CullVisitor and trying to get my head around the
difference between the eye point and the viewpoint.  Is the viewpoint stack
is used to deal with internal camera nodes then?  Then the "eye" point is
the main camera's position while the "view" point would be used for
currently executing camera node.  If you don't have any internal camera
nodes, then would the eye point and the viewpoint be equivalent?

Do you think it would make sense to just copy the implemention from
CullVisitor for the viewpoint/eyepoint stack into IntersectionVisitor?

Thanks!

Jason

2009/3/19 Robert Osfield 

> Hi Jason,
>
> This change would be appropriate.  Although we might want to review the eye
> point management, and perhaps eye + view points as potentially they aren't
> the same.  An stack for eye/viewpoint point might be need as well to cope
> with internal camera nodes.
>
> Robert.
>
> 2009/3/18 Jason Beverage 
>
>> Hi Robert,
>>
>> I'm using LOD's in one of my apps to control the distance at which models
>> first begin to appear and noticed that the IntersectionVisitor will still
>> hit these nodes even if they are not visible.
>>
>> I tried setting the LODSelectionMode to
>> USE_EYE_POINT_FOR_LOD_LEVEL_SELECTION but it still selected invisible
>> nodes.  After looking through the code I noticed that the
>> getDistanceToViewPoint function is used by the LOD class but is not
>> implemented by the IntersectionVisitor, so will always have the value of 0.
>>
>> I made a small class deriving from IntersectionVisitor that just returned
>> getDistanceToEyePoint (which is overriden by IntersectionVisitor) and things
>> seemed to behave more appropriately.
>>
>> class MyIntersectionVisitor : public osgUtil::IntersectionVisitor
>> {
>> public:
>> MyIntersectionVisitor(osgUtil::Intersector* intersector=0,
>> osgUtil::IntersectionVisitor::ReadCallback* readCallback=0)
>> :IntersectionVisitor(intersector, readCallback)
>> {
>> }
>>
>> virtual float getDistanceToViewPoint(const osg::Vec3& pos, bool
>> useLODScale) const
>> {
>>return getDistanceToEyePoint(pos, useLODScale);
>> }
>> };
>>
>> Would this change, or something similar, be appropriate for inclusions in
>> OSG?
>>
>> Thanks!
>>
>> 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] getDistanceToViewPoint not implemented in osgUtil::IntersectionVisitor

2009-03-19 Thread Robert Osfield
Hi Jason,

This change would be appropriate.  Although we might want to review the eye
point management, and perhaps eye + view points as potentially they aren't
the same.  An stack for eye/viewpoint point might be need as well to cope
with internal camera nodes.

Robert.

2009/3/18 Jason Beverage 

> Hi Robert,
>
> I'm using LOD's in one of my apps to control the distance at which models
> first begin to appear and noticed that the IntersectionVisitor will still
> hit these nodes even if they are not visible.
>
> I tried setting the LODSelectionMode to
> USE_EYE_POINT_FOR_LOD_LEVEL_SELECTION but it still selected invisible
> nodes.  After looking through the code I noticed that the
> getDistanceToViewPoint function is used by the LOD class but is not
> implemented by the IntersectionVisitor, so will always have the value of 0.
>
> I made a small class deriving from IntersectionVisitor that just returned
> getDistanceToEyePoint (which is overriden by IntersectionVisitor) and things
> seemed to behave more appropriately.
>
> class MyIntersectionVisitor : public osgUtil::IntersectionVisitor
> {
> public:
> MyIntersectionVisitor(osgUtil::Intersector* intersector=0,
> osgUtil::IntersectionVisitor::ReadCallback* readCallback=0)
> :IntersectionVisitor(intersector, readCallback)
> {
> }
>
> virtual float getDistanceToViewPoint(const osg::Vec3& pos, bool
> useLODScale) const
> {
>return getDistanceToEyePoint(pos, useLODScale);
> }
> };
>
> Would this change, or something similar, be appropriate for inclusions in
> OSG?
>
> Thanks!
>
> 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] getDistanceToViewPoint not implemented in osgUtil::IntersectionVisitor

2009-03-18 Thread Jason Beverage
Hi Robert,

I'm using LOD's in one of my apps to control the distance at which models
first begin to appear and noticed that the IntersectionVisitor will still
hit these nodes even if they are not visible.

I tried setting the LODSelectionMode to
USE_EYE_POINT_FOR_LOD_LEVEL_SELECTION but it still selected invisible
nodes.  After looking through the code I noticed that the
getDistanceToViewPoint function is used by the LOD class but is not
implemented by the IntersectionVisitor, so will always have the value of 0.

I made a small class deriving from IntersectionVisitor that just returned
getDistanceToEyePoint (which is overriden by IntersectionVisitor) and things
seemed to behave more appropriately.

class MyIntersectionVisitor : public osgUtil::IntersectionVisitor
{
public:
MyIntersectionVisitor(osgUtil::Intersector* intersector=0,
osgUtil::IntersectionVisitor::ReadCallback* readCallback=0)
:IntersectionVisitor(intersector, readCallback)
{
}

virtual float getDistanceToViewPoint(const osg::Vec3& pos, bool
useLODScale) const
{
   return getDistanceToEyePoint(pos, useLODScale);
}
};

Would this change, or something similar, be appropriate for inclusions in
OSG?

Thanks!

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