Re: Picking with asymmetric Viewing Frustum

New Message Reply Date view Thread view Subject view Author view

Daniel Williams (dwilliams++at++sarnoff.com)
Tue, 03 Nov 1998 09:31:47 -0500


Marc Erich Latoschik wrote:
>
> Wolfgang Trog wrote:
> >
> > Hi Performers,
> >
> > sorry, I hit the wrong button. Next try !
> >
> > I try to do picking in a channel with an asymmetric viewing frustum. The
> > viewing frustum is set by pfMakePerspChan. E.g. to values 30 deg to
> > left, 32 deg to right and 22.5 top and bottom. Then, I do picking with
> >
> > NrHits = pfChanPick( Channel,
> > PFPK_M_NEAREST |
> > PFTRAV_IS_PRIM |
> > PFTRAV_IS_PATH |
> > PFTRAV_LOD_CUR,
> > ChannelX, ChannelY, 0.0f, PickList );
> >
> > The picking calculation seems to use only the smallest value of
> > right/left and top/bottom. So the picking results are shifted to the
> > left/right and top/bottom. In case of my example, the picking results
> > are shifted to the right (looks like a 2 deg shift).
> > When I supply symmetric values to pfMakePerspChan, this works fine.
> >
> > Can anybodye help me ?
> >
> Yes and no Wolfgang ;),
> sorry the answer comes late, but im currently running into the same
> problem.
> To disaapoint you, read the relnotes of Performer 2.2
> under the section Bugs and Workarounds it is said that picking
> in an asymetric frustum is not currently supported.
> Sorry for that.
> I still try to figure out how to do it. Right now it seems that the only
> possibility is to hold all scene geometrie in a seperate process and to
> apply object and viewpoint transformation on my own. :( That is of
> course
> the worst thing but i have no other ideas...
>
> Does anyone have a good one for that problem?
>
> bye
>
> Marc
>
> ********************************************************************************
> Marc Erich Latoschik, AG-WBS, Technische Fakultaet der Universitaet
> Bielefeld
>
> Universitaetsstrasse 25
> Postfach 100 131
> 33501 Bielefeld
> Raum M4-122
> Fon: (0521) 106 2919
> Fax: (0521) 106 2962
>
> marcl++at++techfak.uni-bielefeld.de
> http://www.TechFak.Uni-Bielefeld.DE/techfak/persons/marcl/
>

Here's my workaround for the problem. I encountered this problem
during the Performer 2.2 alpha and sent SGI this code at that time.
I had to subclass pfChannel for other reasons, so this is a new
method that is like pfChannel::pick but works for off-axis view
frustra. No guarantees, but it's been working for me.

//
// apparently the pfChannel::pick method doesn't work for off-axis
// viewing projections (as of Performer 2.2 alpha), so here is a
// method with the same signature and semantics that works. notice
// that radius is not used.
//
int pfDWChannel::pickOffAxis (int mode, float px, float py, float
radius, pfHit **pickList[])
{
    //
    // compute point picked on near clip plane
    //
    pfVec3 near_ll, near_lr, near_ul, near_ur;
    getNear (near_ll, near_lr, near_ul, near_ur);
    pfVec3 screen_point;
    screen_point.combine (px, near_lr - near_ll, py, near_ul - near_ll);
    screen_point += near_ll;

    //
    // make a line segment from the eye to the point picked
    //
    pfVec3 xyz, hpr;
    getView (xyz, hpr);
    pfSeg segment;
    segment.makePts (xyz, screen_point);
    //
    // and effectively turn it into a ray
    //
    segment.length = FLT_MAX;

    //
    // intersect the segment with the near clipping plane
    //
    pfPlane near_plane;
    near_plane.makePts (near_ll, near_lr, near_ul);
    float near_point;
    if (near_plane.isect (&segment, &near_point) != PFIS_FALSE)
        segment.clip (&segment, near_point, FLT_MAX);

    //
    // intersect the segment with the far clipping plane
    //
    pfVec3 far_ll, far_lr, far_ul, far_ur;
    getFar (far_ll, far_lr, far_ul, far_ur);
    pfPlane far_plane;
    far_plane.makePts (far_ll, far_lr, far_ul);
    float far_point;
    if (far_plane.isect (&segment, &far_point) != PFIS_FALSE)
        segment.clip (&segment, 0.0f, far_point);

    pfSegSet segset;
    segset.mode = mode;
    segset.userData = NULL;
    segset.activeMask = 1;
    segset.isectMask = PFIS_SET_PICK;
    segset.bound = NULL;
    segset.discFunc = NULL;
    segset.segs[0] = segment;

    return (isect (getScene (), &segset, pickList, NULL));
}

--
Daniel Williams, Systems & Scientific Software
Voice: (215) 885-1573 Email: sass++at++acm.com
Independent Consultant to: Sarnoff Corporation
Voice: (609) 734-2153 Email: dwilliams++at++sarnoff.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Tue Nov 03 1998 - 06:31:52 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.