Re: World to screen coord transforms

New Message Reply Date view Thread view Subject view Author view

Don Hatch (hatch++at++hell.engr.sgi.com)
Sat, 14 Mar 1998 16:29:52 -0800


On Mar 13, 2:18pm, Angus Dorbie wrote:
> Subject: Re: World to screen coord transforms
> Volz, Bill (wrvo) wrote:
> >
> > I need to transform a world coordinate point to screen coordinates. I know
> > that I need to call XformPt3 on the point, but I can't figure out where the
> > matrix (or matrices) come from. I tried pfGetChanViewMat and
> > pfGetChanOffsetViewMat, but they dont give the correct results. It seems
> > that I need to be transforming by two matrices - one from world to local
> > coords and then again from local to screen coords.
>
> They need to be transformed from object to world then from world to eye,
> then from eye to screen.
>
> The first two steps are done by the modelview matrix in OpenGL, but in
> the scene graph this is the held separately, so you need to xform a
> point through the matrices of all pfSCS and pfDCS nodes in ascending
> order above it in the scene graph and then through the pfChannel matrix
> (the viewing matrix).

The channel viewing matrix converts from eye space to world space,
so you'd need to multiply by the inverse
of the viewing matrix, not the viewing matrix itself.
(note that the matrix is orthonormal, so inverting it is easy.)

> This gives you a point in eye space but not yet in
> screen space. You must then transform the point through the projection
> matrix of the channel frustum to give a projected screen coordinate
> (nominally -1 to 1) which simple arithmetic will convert to viewport or
> screen coordinates.
>

Don

-- 
Don Hatch  hatch++at++sgi.com  (415) 933-5150  Silicon Graphics, Inc.
=======================================================================
List Archives, FAQ, FTP:  http://www.sgi.com/Technology/Performer/
            Submissions:  info-performer++at++sgi.com
        Admin. requests:  info-performer-request++at++sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:01 PDT

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