180 likes | 339 Views
Stereoscopic : How to implement it?. Namgyu Kim ( ngkim@postech.ac.kr ) VR Labs. CSE POSTECH. 발표 순서. Stereoscopic methods’ classification Implementation Maverik OpenGL Direct3D Maverik Programming tip Transparent texture in Maverik No maverik’s logo animation start.
E N D
Stereoscopic :How to implement it? Namgyu Kim (ngkim@postech.ac.kr) VR Labs. CSE POSTECH
발표 순서 • Stereoscopic methods’ classification • Implementation • Maverik • OpenGL • Direct3D • Maverik Programming tip • Transparent texture in Maverik • No maverik’s logo animation start
Classification (1) • Time-Multiplexed • Frame sequential, Page flipping • Field sequential, Interlaced Active Stereo Passive Stereo
Classification (2) • Time Parallel • Anaglyph • Parallax Barrier • Lenticular Sheet • Side-by-Side Slits L R lens L R
Implementation • Possible hardware • Time multiplexed -> Active stereo • Crystal Eyes, VR joy • Time parallel -> Side-by-side, Anaglyph • HMDs (VR4, Glasstron) • Handmade ^^;
Maverik (1) • Time parallel -> Side-by-side • In twin-view graphic card platform • HMDs Eg. stereo.c #include "maverik.h“ #include <stdio.h> int main(int argc, char *argv[]) { MAV_box box; MAV_object *obj; MAV_SMS *sms; mav_opt_stereo= MAV_STEREO_TWO_WINS; mav_initialise(&argc, argv); ….. }
Maverik (2) • Time multiplexed -> Active stereo • Quad-buffer: Front-left, Back-left, Front-right, Back-right • Graphics card supports: FireGL series Eg. stereo.c #include "maverik.h“ #include <stdio.h> int main(int argc, char *argv[]) { MAV_box box; MAV_object *obj; MAV_SMS *sms; mav_opt_stereo= MAV_STEREO_QUAD_BUFFERS; mav_initialise(&argc, argv); … }
Maverik (3) • Stereo configuration options: Global vars • Offset void mav_windowViewModifierSet(MAV_window *w, MAV_viewModifierParams *vmp, MAV_viewModifierFn fn); typedef struct { float offset; float angle; void *userdef; } MAV_viewModifierParams; mav_stp_default.offset= 0.5; mav_windowViewModifierSet(mav_win_left, &mav_stp_default, mav_eyeLeft); mav_windowViewModifierSet(mav_win_right, &mav_stp_default, mav_eyeRight);
Maverik (4) • int mav_opt_right_x • int mav_opt_right_y • int mav_opt_right_width • int mav_opt_right_height • Maverik Programming Manual 참조
OpenGL (1) • Time multiplexed -> Active stereo • Back buffer is divided for L/R image • At first, set OpenGL state to stereo mode Win32 & OpenGL Glut PIXELFORMATDESCRIPTOR pfd; pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_STEREO; pfd… … choosePixelFormat(…) selectPixelFormat(…) glutInit(&argc, argv); glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_STEREO); glutCreateWindow("rect");
OpenGL (2) • Select left buf -> render left img ->select right buf -> render right img ->swap to front buffer glDrawBuffer(GL_BACK); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Draw the image for the left eye. glDrawBuffer(GL_BACK_LEFT); // Draw Left Scene: Projection & Model View Matrix glClear (GL_DEPTH_BUFFER_BIT); // Select back right buffer to recieve drawing glDrawBuffer(GL_BACK_RIGHT); // Draw Right Scene: Projection & Model View Matrix
OpenGL (3) • Time parallel -> Anaglyph • Draw object in white color • glColorMask(R, G, B, A) glDrawBuffer(GL_BACK); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Left eye filter (Blue) glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE); glColorMask(GL_FALSE,GL_FALSE,GL_TRUE,GL_TRUE); // Draw object in white color glFlush(); glDrawBuffer(GL_BACK); // Right eye filter (Red) glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE); glColorMask(GL_TRUE,GL_FALSE,GL_FALSE,GL_TRUE); // Draw object in white color glFlush() // Swap Buffers
Direct3D • I’m a novice !! ^^; • Show some examples • Graphics card dependent • Nvidia Geforce series • Nvidia platform SDK : NVSDK5.2 • http://developer.nvidia.com • Other development tool • Winx3D SDK • http://www.win3d.com
Implementation • Possible solutions • Maverik, Side-by-Side, HMDs • Maverik, Active, Crystal Eyes • OpenGL, Side-by-Side, HMDs • OpenGL, Active, Crystal Eyes • Direct3D, Active, VR Joys Easy Difficult
Conclusion • Visit VR Labs. PIRL 438 • You can see/do it
Maverik Programming Tip (1) • Transparent texture • Portable Network Graphics (PNG format) • Add MAV_PNG options in Maverik proj. • Link libpng.lib libz.lib -> Recompile • Add path libpng.dll and libz.dll • How to make transparent texture • Use photoshop… ^.^
Maverik Programming Tip (2) • No maverik’s logo animation start • mav_opt_splash = MAV_FALSE; • Good luck… ^^; … mav_opt_splash = MAV_FALSE; mav_initialise(&argc, argv); …