Re: World to screen coord transforms
Angus Dorbie (dorbie++at++sgi.com)
Mon, 16 Mar 1998 12:10:45 -0800
Don Hatch wrote:
>
> 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.)
Yep, I had already explained this to the customer in an offline
conversation. Performer hides the single OpenGL modelview matrix
from the programmer allowing a DCS to be used to position a channel
rather than it's inverse as you'd expect in OpenGL which creates
this quirk.
Cheers,Angus.
--
"Only the mediocre are always at their best." -- Jean Giraudoux
For advanced 3D graphics Performer + OpenGL based examples and tutors:
http://www.dorbie.com/
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2
on Mon Aug 10 1998 - 17:57:01 PDT