---------------------------- Stereoscopy manager for Ogre ---------------------------- By Mathieu Le Ber m.leber@axyz.fr Ogre forum's thread : http://www.ogre3d.org/forums/viewtopic.php?f=5&t=32284 Distributed under the BSD license. ---------- Contents : ---------- I - Presentation II - Quick instructions a) Compilation b) How to run the example c) How to use the plugin III - How to use the manager a) Using the code in you project b) Using the plugin IV - Stereo settings V - Misc a) Note about the dual output mode ---------------- I - Presentation ---------------- This addon allows stereoscopic rendering in Ogre. It will render one image for the left eye and one image for the right eye. There are three modes depending on the type of 3D display you are using : - Anaglyph mode The image is made of a red and a cyan layer representing the left and the right eye. This can be viewed with simple red/cyan glasses. - Dual output mode The left and the right image are rendered and displayed independently. This can be viewed with a head mounted display or with two projectors with polarized filters and polarized glasses. - Interlaced mode. The left and the right images are mixed with a checkboard or with a strips pattern. This can be viewed with screens equipped lenticular lenses. No glasses are needed to perceive the depth in the image. ----------------------- II - Quick instructions ----------------------- a) Contents of the addon The main files of this addon are the stereo manager and its resources files. There is also a demo and a plugin to illustrate and ease the use of the manager. The demo includes direcly the manager whereas the plugin allows to use the manager with an application without any modification. You should not use the plugin with the demo as the manager will be created twice and bad things will happen. b) Compilation It compiles with Visual Studio 2005 or 2008 You need either the source release or the SDK of Ogre. If you use the SDK, you must set the environment variable OGRE_SDK to the location of the SDK. If you use the source release, set OGRE_SRC to the location of the sources. It compiles only with Ogre 1.6. Ogre 1.4.9 is no longer supported. c) How to run the example - Build Demo_Fresnel_stereo. The exe will be copied automaticaly in the bin folder of the Ogre samples. - Copy stereoscopy.compositor, .material and .cg to a resource directory of Ogre, for example stereoscopy.compositor and stereoscopy.material inside Samples/Media/materials/scripts and stereoscopy.cg inside Samples/Media/materials/programs - Be sure that StdQuad_vp.cg, StdQuad_vp.glsl and StdQuad_vp.program are also in your resources - Be sure that Plugin_CgProgramManager.dll is loaded in plugins.cfg - Run the demo (If you are using the source release, F5 should launch it directly) Controls : Numpad + and - : change the eye spacing Numpad 0 : set the eye spacing to 0 (no stereoscopic effect) Numpad / and * : change the focal length Numpad . : toggle the focal length to infinity O : toggle the visibility of the focal plane and the current settings I : save the settings to a file. These settings will be loaded the next time the demo is run U : change the stereo mode d) How to use the plugin - Build Plugin_StereoManager - Copy stereoscopy.compositor, .material and .cg to a resource directory - Add this line to plugins.cfg in Release mode : Plugin=Plugin_StereoManager or Plugin=Plugin_StereoManager_d in Debug mode - Be sure that StdQuad_vp.cg, StdQuad_vp.glsl and StdQuad_vp.program are also in your resources - Be sure that Plugin_CgProgramManager.dll is loaded in plugins.cfg - Run any ogre application - In the config dialog box, chose 'Yes' in 'Enable stereo rendering' You can change the settings of the plugin by editing stereo.cfg. This file will be created if it doesn't exist. Notes : - The plugin may not load with a third-party Ogre Application. However if you built both the plugin and the application, there will be no problem at all. - If you remove Plugin_StereoManager from plugins.cfg, Ogre applications crash at startup. This is because Ogre does no longer understand the setting 'Enable stereo rendering'. Just remove this line from ogre.cfg or delete ogre.cfg and everything will work fine again. ---------------------------- III - How to use the manager ---------------------------- Under Construction see StereoManager.h for additional details -------------------- IV - Stereo settings -------------------- Under Construction -------- V - Misc -------- a) Note about the dual output mode If you use this mode, you will most likely need to have two displays connected to your video card. (Each screen of you head-mounted display or each projector with a polarized filter) In the version 1.6, Ogre doesn't support out-of-the-box the rendering on two screens in fullscreen. This will be supported in ogre 1.7. There are two solutions : - There is a patch allowing Ogre 1.6 to use two fullscreen displays in DirectX mode. Apply it to the source release and rebuild ogre. The demo also shows how to setup your application when using the patch. Look at the comments about the multihead patch. The last version of the patch (for Ogre 1.6.3) is distributed with the Stereo Manager (MultipleRenderWindows_1.6.3_Source_release_v4.0.patch) Please note that this patch was merged in the Ogre 1.7 trunk and is no longer needed if you use this version. - If your video driver supports it, you may want to use the "Horizontal span" mode. You can set this in the graphical properties configuration panel of your system. In this mode, your desktop covers the two screens. Your system only sees one big screen that is two time wider. This solution applies to both DirectX and OpenGL, Windows and Linux Just create one fullscreen render window in Ogre. It should spread on the two screens. (if it doesn't, you will have to use the first solution) Then create two viewports side by side that will use each one half of the render window. Attach the same camera to the two viewports. However, depending on you configuration there may be a performance hit if you use this solution. With both solutions you will have two viewports. Pass them to the init method. Any questions or suggestions ? Feel free to contact me by posting in the thread, or by sending me a private message or an email.