Re: World to screen coord transforms

New Message Reply Date view Thread view Subject view Author view

Angus Dorbie (dorbie++at++sgi.com)
Fri, 13 Mar 1998 14:18:19 -0800


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). 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.

Simple really :-)

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


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.