From: David Geldreich (David.Geldreich++at++sophia.inria.fr)
Date: 06/05/2002 05:59:27
Hi pfers,
I am using a Barco Baron table (which is tiltable) and I have implemented head tracking in my
application (using Polhemus Fastrak device).
I was wondering how to take into account the fact that projection screen is not perpendicular to
the viewing direction. My coordinate system is defined to have the origin at the center of screen
and -Y normal to the screen.
Without tilt, I use something like this :
-------------------------------------------------------------
// gets view.xyz from the tracker
Shared->view.hpr = pfVec3(0.0f, 0.0f, 0.0f);
chanL->setView(Shared->view.xyz, Shared->view.hpr);
...
pfVec3 eye;
float winL, winR, winT, winB, projFact;
const float halfH = TABLE_WIDTH/2.f;
const float halfW = TABLE_HEIGHT/2.f;
// Frustum for the left eye
Shared->chanL->getEye(eye);
projFact = Shared->near / (-eye[1]);
winL = (-halfW - eye[0]) * projFact;
winR = (halfW - eye[0]) * projFact;
winT = (halfH - eye[2]) * projFact;
winB = (-halfH - eye[2]) * projFact;
Shared->chanL->makePersp(winL, winR, winB, winT);
// Frustum for the right eye
Shared->chanR->getEye(eye);
projFact = Shared->near / (-eye[1]);
winL = (-halfW - eye[0]) * projFact;
winR = (halfW - eye[0]) * projFact;
winT = (halfH+t*eye[1] - eye[2]) * projFact;
winB = (-halfH+t*eye[1] - eye[2]) * projFact;
Shared->chanR->makePersp(winL, winR, winB, winT);
-------------------------------------------------------------
With TABLE_ANGLE tilt on the table, I will do something like :
- view looks up by TABLE_ANGLE angle
- displace the screen by tan(TABLE_ANGLE)*view.y
(TABLE_ANGLE = 0 -> screen is vertical
TABLE_ANGLE = 90 -> screen is horizontal = table position)
------------------------------------------------------------
// gets view.xyz from the tracker
Shared->view.hpr = pfVec3(0.0f, TABLE_ANGLE, 0.0f);
chanL->setView(Shared->view.xyz, Shared->view.hpr);
pfVec3 eye;
float winL, winR, winT, winB, projFact;
const float halfH = TABLE_WIDTH/2.f;
const float halfW = TABLE_HEIGHT/2.f;
float t = pfTan(TABLE_ANGLE);
Shared->chanL->getEye(eye);
projFact = Shared->near / (-eye[1]);
winL = (-halfW - eye[0]) * projFact;
winR = (halfW - eye[0]) * projFact;
winT = (halfH+t*eye[1] - eye[2]) * projFact;
winB = (-halfH+t*eye[1] - eye[2]) * projFact;
Shared->chanL->makePersp(winL, winR, winB, winT);
Shared->chanR->getEye(eye);
projFact = Shared->near / (-eye[1]);
winL = (-halfW - eye[0]) * projFact;
winR = (halfW - eye[0]) * projFact;
winT = (halfH+t*eye[1] - eye[2]) * projFact;
winB = (-halfH+t*eye[1] - eye[2]) * projFact;
Shared->chanR->makePersp(winL, winR, winB, winT);
------------------------------------------------------------
The documentation pfChannel::makePersp is not clear about how the screen is projected in the
near plane.
Thanks in advance.
This archive was generated by hypermail 2b29 : Wed Jun 05 2002 - 05:59:43 PDT