1 / 19

Modeling & Simulation

Modeling & Simulation. Stereographics. Active stereoscopic projection. ※ Needs Glasses with active components(Electronics, batteries..) Single Projector or monitor, fast phosphor required for a good result. 120Hz to minimize flicker.

aliza
Download Presentation

Modeling & Simulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Modeling & Simulation

  2. Stereographics

  3. Active stereoscopic projection • ※ Needs • Glasses with active components(Electronics, batteries..) • Single Projector or monitor, fast phosphor required for a good result. • 120Hz to minimize flicker. • Wired or infrared synchronization between the glasses & video card.

  4. Passive stereoscopic projection (..we have) ※ Needs - Cheap polaroid glasses, Two projectors & Special projection surface

  5. Parallax and perceived depth

  6. Parallax - The distance between screen and virtual object- Positive : objects behind the screen- Zero : objects appear at the screen- Negative : objects appear in front of the screen • Divergent parallax- Projection screen에 생성되는 두점 사이의 거리 P가 두 눈사이의 거리보다 큰 경우 불편함을 느낌- | P | > | left_eye – right_eye | 를고려하여 Stereo Implementation

  7. To understand the stereo display implementation • Perspective projection

  8. Use a view of side & top

  9. Use a view of mono – side & Stereo - top

  10. Core of Stereo viewing code at left & right

  11. void setStereoPerspective(GLdouble fovy, GLdouble aspect, GLdouble near, GLdouble far, GLdouble focalLenght, GLdouble eyeSep, EyeMode eyeMode) { GLdouble left; GLdouble right; GLdouble top = near*tan(DTOR*fovy/2); // y clipping plane의 0부터의 거리를 계산 GLdouble bottom = -top; GLdouble halfNearWidth = aspect*top; // aspect에 기초한 x clipping의 0부터의 거리를 계산 // aspect : viewport의 종횡비 GLdouble stereoAdjustment = eyeSep/2*near/focalLenght; // equation 연립에 의한 계산식 if(RIGHT == eyeMode) { left = -halfNearWidth - stereoAdjustment; // 오른쪽눈의 left, right 정의 right = halfNearWidth - stereoAdjustment; } else { left = -halfNearWidth + stereoAdjustment; // 왼쪽눈의 left, right 정의 right = halfNearWidth + stereoAdjustment; } glFrustum(left, right, bottom, top, near, far); /*glFrustum 절두체 즉, 전체공간상에서 랜더링해야하는 공간만을 잘라낸 것, 6개의 인자를 가지며, 첫번째와 두번째는 절두체를 구성하는 왼쪽과 오른쪽의 수직 평면이며 세번째와 네번째는 위와 아래의 수평평면, 다섯번째와 여섯번째는 절두체를 구성하는 시선과 수직인 평면으로써 가장 가까운것과 먼것(반드시 양수)*/ } • setStereoPerspective

  12. setStereoLookAt

  13. void setStereoLootAt(GLdouble eyeX,GLdouble eyeY, GLdouble eyeZ, GLdouble centreX, GLdouble centreY, GLdouble centreZ, GLdouble upX, GLdouble upY, GLdouble upZ, GLdouble eyeSep, GLdouble eyeMode) /*단순히 카메라는 약간씩 왼쪽 그리고 오른쪽으로 이동한다. 불행히도 어느방향이 왼쪽 오른쪽인지 3D 모델 공간에서는 사실상 알 수 없다. 그러나 우리는 이런 약간의 방향들을 데이터를 Input하여 계산해 LookAt함수에 기존의 좌표에 더해줄 수 있다. 그렇게 해서 stereoLookAt 함수값이 셋팅된다.*/ { GLdouble inX = centreX - eyeX; GLdouble inY = centreY - eyeY; GLdouble inZ = centreZ - eyeZ; GLdouble factor = (eyeMode == RIGHT)?1:-1; GLdouble realEyeCorX = factor*(inY*upZ - upY*inZ); GLdouble realEyeCorY = factor*(inZ*upX - upZ*inX); GLdouble realEyeCorZ = factor*(inX*upY - upX*inY); //vector cross product of "in" with "up" GLdouble length = sqrt(realEyeCorX*realEyeCorX + realEyeCorY*realEyeCorY + realEyeCorZ*realEyeCorZ); //realEyeCor 벡터의 길이(스칼라)값 계산 GLdouble corLengthFactor = eyeSep/(2*length); // 축소비 지정 realEyeCorX *=corLengthFactor; realEyeCorY *=corLengthFactor; realEyeCorZ *=corLengthFactor; // 각 realEyeCor 좌표에 축소비를 곱해서 누적연산 gluLookAt(eyeX + realEyeCorX, eyeY + realEyeCorY, eyeZ + realEyeCorZ, centreX, centreY, centreZ, upX, upY, upZ); /* EyeMode가 right이면 realEyeCor은 양수 , left이면 음수*/ /*모델과 Eye와의 거리값에 따른 카메라 시선의 위치가 약간씩 변함*/ /*첫번째 xyz좌표는 바라보는 시선의 위치, 두번째xyz죄표는 모델의 위치, 세번째는 모델의 top 좌표(모델의 꼭대기부분이 바라보는 좌표위치)*/ }

  14. Considering the Parallax

  15. Void stereoproj(float xmin, float xmax, float ymin, float ymax,, float znear, float zfar, float zzps, float dist, float eye) /*stereoproj(-6.0, 6.0, -3, 4.8, 12.0, -12.0, 0.0, 14.5, -0.1) left stereoproj(-6.0, 6.0, -3, 4.8, 12.0, -12.0, 0.0, 14.5, 0.1); right*/ { float xmid, ymid, clip_near, clip_far, top, bottom, left, right, dx, dy, n_over_d; dx = xmax – xmin; dy = ymax – ymin; xmid = (xmax + xmin) / 2.0; ymid = (ymax + ymin) / 2.0; clip_near = dist + zzps - znear; clip_far = dist + zzps - zfar; // stereo에 맞는 near & far 재정의 n_over_d = clip_near / dist; // near와 dist와의 비 top = n_over_d * dy / 2.0; bottom = -top; right = n_over_d * (dx / 2.0 - eye); left = -n_over_d * (-dx / 2.0 + eye); // n_over_d와 right or left와의 삼각비에 의해 계산 glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(left, right, bottom, top, clip_near, clip_far); //전체공간상에서 랜더링해야 하는 공간만을 잘라내는 절차*/ glTranslatef(-xmid - eye, -ymid, -zzps - dist); // 좌표의 이동 } • setStereoPerspective (with considering of parallax)

  16. Stereo Display Implementation by OpenGL

More Related