Stereo vision manager [now as a plugin]

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Stereo vision manager [now as a plugin]

Post by al2950 »

OK, I understand! I will give the nvidia drivers ago.

Thanks for you help

Angus
ogre3duser5
Gnoblar
Posts: 3
Joined: Sat Mar 28, 2009 4:12 am

Re: Stereo vision manager [now as a plugin]

Post by ogre3duser5 »

I am having trouble compiling the plugin in the UNIX environment. I am using the gcc compiler.

Could someone please tell me how I could compile it? Or whether changes have to be made in the code?
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Re: Stereo vision manager [now as a plugin]

Post by Thieum »

That's true I am not providing any makefile for the compilation.
But there is anything specific in the project file, you can easily modify a project file for linux from the samples or from a plugin from ogre.
you will need StereoManager.h, StereoManager.cpp, Demo_Fresnel/Fresnel.cpp to build Demo_Fresnel_stereo and StereoManager.h, StereoManager.cpp, Plugin/StereoPlugin.h, Plugin/StereoPlugin.cpp, Plugin/StereoPluginDll.cpp to build Plugin_StereoManager
I hope this will help you

But I am sorry I cannot create the project files for you, I have no access to a linux computer at the moment.
okasugandi
Gnoblar
Posts: 15
Joined: Fri Mar 20, 2009 8:01 am

Re: Stereo vision manager [now as a plugin]

Post by okasugandi »

Hello, stereo vision is a very great work, Thank you! But I have a problem when I used stereo vision in my project, the problem is exactly the same as my post in Using Ogre in practice [http://www.ogre3d.org/forums/viewtopic.php?f=5&t=48787]. The problem is about clean up resource regularly makes compositor are no longer usable. And if I am not wrong, Stereo Vision is also using Compositor, isn't it? Because when I implemented Stereo Vision with regular resource clean up, my project hanged. Thanks before!
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Re: Stereo vision manager [now as a plugin]

Post by Thieum »

Yes, the Stereo Manager uses the compositor exept in the dual output mode. I don't have a solution to your resource unloading problem but If you solve it, the Stereo Manager should work again.
Maybe I could also try to create the compositor resources in a specific group, but I am not very at ease with resource groups
ogre3duser5
Gnoblar
Posts: 3
Joined: Sat Mar 28, 2009 4:12 am

Re: Stereo vision manager [now as a plugin]

Post by ogre3duser5 »

Thieum wrote:That's true I am not providing any makefile for the compilation.
But there is anything specific in the project file, you can easily modify a project file for linux from the samples or from a plugin from ogre.
you will need StereoManager.h, StereoManager.cpp, Demo_Fresnel/Fresnel.cpp to build Demo_Fresnel_stereo and StereoManager.h, StereoManager.cpp, Plugin/StereoPlugin.h, Plugin/StereoPlugin.cpp, Plugin/StereoPluginDll.cpp to build Plugin_StereoManager
I hope this will help you

But I am sorry I cannot create the project files for you, I have no access to a linux computer at the moment.

Could you briefly describe the procedure for compiling plugins. I have checked the other forums and none of them tell you how to actually compile a plugin. I also tried to use the "Makefile.am" from the PlugIns directory and it doesn't seem to work very well. Probably, some modifications need to be made to those files except the very obvious ones.


Thank you.
User avatar
Florin
Kobold
Posts: 33
Joined: Thu Mar 19, 2009 3:15 am

Re: Stereo vision manager [now as a plugin]

Post by Florin »

Can anyone put a link to a valid patched Ogre, for newbies like me ? I did checkout the branch (1.6.1) which I have seen it's not patched, and the trunk which I don't know how to build with CMake. Or at least some more precise instructions, stp by step of how to build Ogre from trunk. Instructions from "BuildWithCMake.txt" are not enough for me. I f you care for a newbie please give some help. Thanks in advance.

P.S: I wonder why I get only 12 fps in "Demo_Fresnel_stereo.exe" while in stereo mode. I wish I could see on my laptop (Core Duo 2.2 GHz, GeForce 8400M - 128MB, 2GB RAM) values at least half of values displayed in some screenshots from this thread.
bt2008
Gnoblar
Posts: 1
Joined: Mon Mar 30, 2009 3:39 am

Re: Stereo vision manager [now as a plugin]

Post by bt2008 »

I promised Thieum that I would post our Makefile for his Stereo3D demo once our team got it working on Linux. Suffice to say that it works very well, so again many thanks to him.

Just a couple notes:
1. We used the automake and autoconf so we made Makefile.am files and ran ./bootstrap and ./configure (These files you can find in the Humble beginnings tutorial on the Ogre Wiki)
2. This makefile is just for the demo, not the plugin (So if anyone can tell us how to get the Stereo Plugin working, it would still be very very much appreciated)
3. Remember that paths are very important and this makefile is only an example, not something that is ready to use

EDIT: Bleh looks like the forums doesn't like it when I try to upload .txt files. Anyway, I'll direct anyone interested here: http://www.ogre3d.org/wiki/index.php/Humble_Beginnings

It'll show you how to use makefile.am files.
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Stereo vision manager [now as a plugin]

Post by al2950 »

Hi

Sorry to revive this thread, but i was trying to get ogre to work with certain Head mounted displays which used a single video streams with the left and right frames inserted one after the other. After spending half a day trying to get the nvidia drivers to do what i wanted I got bored and gave up!!

I have revived my interest in this and what i would like to do is extend Thieum's plugin to allow this sort of stereo. This is fairly simple apart from one thing...

I need to render two frames, one for the right then one for the left. This can be done by altering the camera on each render, however what i cant work out is how to stop any time from advancing between rendering the left eye and right eye. This could of course be easily done in a specific case, but i want to keep it in a plugin format.

I hope that make sense and does anyone have any ideas!?

Cheers

Angus
lukeneorm
Halfling
Posts: 61
Joined: Wed Apr 01, 2009 12:03 am

Re: Stereo vision manager [now as a plugin]

Post by lukeneorm »

Hi,
I just tried to implement the stereo compositor in my scene, using RedCyan mode: it works, but the 3D effect is very poor.
This is a screenshot of my scene:

Image

I noticed a strange behaviour in my scene: nearest objects in the scene got smaller parallax images, while in the farther ones the cyan and red images became more distant. Is it correct? It shouldn't be the opposite?
I mean: near objects should have more distance between their red and cyan images than the far objects.. or not?

I tried to play with Focal length value in stereo.cfg, but it doesn't improve the 3D effect.
My 3D glasses have left eye-red and right eye-blue: I tried also with Inverse stereo = true flag in stereo.cfg, without improvements.
The glasses worked instead very well on this example image:
http://cirius.seb.free.fr/OgreAnaglyph.png

..can someone help me? :?
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Stereo vision manager [now as a plugin]

Post by al2950 »

If you post your stereo.cfg file someone might be able to help. I had the same problem but i cant remember exactly why!
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Re: Stereo vision manager [now as a plugin]

Post by Thieum »

Hi again!
Sorry for not responding to this thread, I was a little busy.
bt2008 wrote:I promised Thieum that I would post our Makefile for his Stereo3D demo once our team got it working on Linux. Suffice to say that it works very well, so again many thanks to him.
Thank you for your work, it is very appreciated !
Could you send me you makefile ? I will install ubuntu in my computer and try to get it working for the plugin
al2950 wrote:I have revived my interest in this and what i would like to do is extend Thieum's plugin to allow this sort of stereo. This is fairly simple apart from one thing...
I thought about it, but I don't think this is possible. Your HMD needs to be synchronized with the rendering to know that a frame was just rendered. It can be done easily with vsnyc. But the device ha to know that this frame corresponds to the left or to the right eye. I read somewhere (but I can't remember where) that the drivers add some informations to the vga signal to tell what frame it is. Some other devices add a color line at the bottom of the image to differentiate the frames. I don't know how you device makes the synchronization but if it needs some kind of low level signal, neither the stereo manager nor Ogre can do anything.

I also thought of another difficulty with shutter glasses, I don't know if this would apply with your HMD. You need to present the left and right view at a sufficient rate if you don't want to see flickering. you need a 120Hz signal. Your application will have to run at 120fps.
But I don't know either how to render two frame without increasing the "time" variable without rewriting the update loop of ogre. I don't think I can do that only with a plugin.
lukeneorm wrote: I noticed a strange behaviour in my scene: nearest objects in the scene got smaller parallax images, while in the farther ones the cyan and red images became more distant. Is it correct? It shouldn't be the opposite?
the objects behind the screen (corresponding to the focal plane in the scene) and in front of the screen will get bigger parallax than the objects at the level of the screen. The objetcs behind will be blue on the left and the objects in front will be red on the left.
If you want to see the objects come out of the screen, they have to be in front of the focal plane. You have to increase the focal length enough.
But be careful because if an object comes out of the screen but is cropped by the border of the screen, like the sphere at the foreground of your screenshot, the stereoscopic effect will be ruined.

Maybe you need to adjust the focal length and the eye spacing accordingly to the scale of your scene
User avatar
Florin
Kobold
Posts: 33
Joined: Thu Mar 19, 2009 3:15 am

Re: Stereo vision manager [now as a plugin]

Post by Florin »

Hi,

Has anyone thought about creating a stereo plugin for the PlayerDemo http://www.ogre3d.org/forums/viewtopic.php?f=11&t=51802 ? I tried the stereo plugin with some demo applications and it works, but for PlayerDemo it doesn't. After all the example application demo framework is only recommended only for demos, not for advanced applications, and PlayerDemo seems like a more serious framework. If anyone wants to help with this please let me know.
Thanks.
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Re: Stereo vision manager [now as a plugin]

Post by Thieum »

Hi florin!

I tried to load the stereo Plugin with the player. You will need to add these files in order to load the plugin :
stereoscopy.material, stereoscopy.compositor, stereoscopy.cg, StdQuad_vp.cg, StdQuad_vp.glsl, StdQuad_vp.program, cg.dll, Plugin_CgProgramManager.dll, and of course Plugin_StereoManager.dll

But as you said the plugin is designed to work with very simple applications and won't work with the player :(
The login screen is black, the when logged-on, the rendering is not stereoscopic.

If you wand to add a stereoscopic effect to The Player, you will have to add the StereoManager directly to the source, and instantiate and initialize it yourself in order to have a full control

edit: yes, it is very straightforward.
add something like this at the end of WorldState::createScene and it will work :

Code: Select all

stereoMgr = new StereoManager();
stereoMgr->init(viewport, NULL, "stereo.cfg"); // get a stereo.cfg generated by the plugin
(do not forget to remove "Enable stereo rendering=Yes" from ogre.cfg and "Plugin=Plugin_StereoManager" from plugins.cfg)
lygyue
Greenskin
Posts: 122
Joined: Wed Nov 29, 2006 4:07 pm

Re: Stereo vision manager [now as a plugin]

Post by lygyue »

One question about your plugin.

1. "multihead_wip2.patch" can be patched to ogre1.49.
2. your "StereoManager" project just can be built in ogre1.6

So, I need a 1.63 patch or a 1.49 StereoManager, where is it?
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Re: Stereo vision manager [now as a plugin]

Post by Thieum »

Yes, this patch is outdated and I have not updated the documentaion
Please use the latest patch (no longer made by me) : http://sourceforge.net/tracker/?func=de ... tid=302997 or use Ogre 1.7 which include this patch
It is a much bigger patch and it can be tricky to apply and I only succeeded to apply it to the svn version of ogre and with the patch option of tortoise svn
checkout the 1.6 branch ( https://svn.ogre3d.org/svnroot/ogre/branches/v1-6 ) with a svn client (tortoisesvn for windows) and apply the patch with tortoise svn or gnu patch
If it doesn't work, try to checkout the revision 8567 (the patch was made froim this one) instead of the HEAD revision.
do not forget to apply the vc9 patch because the new files are missing from the vc9 projectfile

I hope it will help
lygyue
Greenskin
Posts: 122
Joined: Wed Nov 29, 2006 4:07 pm

Re: Stereo vision manager [now as a plugin]

Post by lygyue »

i need a fullscreen dual output example. i had downloaded "MultipleRenderWindows_1.6_Patch_002.patch", but it can't be patched to ogre1.63. anyone can give me a ogre1.49 patch?

Sorry for my poor english.
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Re: Stereo vision manager [now as a plugin]

Post by Thieum »

MultipleRenderWindows_1.6_Patch_002.patch is outdated, please download the version 4.0 and apply it to the the 1.6 branch you just got from svn. This patch will be hard to apply to the source release of ogre 1.6.3
lygyue
Greenskin
Posts: 122
Joined: Wed Nov 29, 2006 4:07 pm

Re: Stereo vision manager [now as a plugin]

Post by lygyue »

Thanks for your reply.

my project using ogre1.63, and the patch you Provide using ogre1.62.

I had changed your plugin to ogre1.49 and it can run at window mode with two output window, but can't be run at fullscreen mode. :(
lygyue
Greenskin
Posts: 122
Joined: Wed Nov 29, 2006 4:07 pm

Re: Stereo vision manager [now as a plugin]

Post by lygyue »

Thanks. i think i need to download ogre1.62.
But i don't understand why your plugin can't support two fullscreen output? It will be supported in ogre1.8?
lygyue
Greenskin
Posts: 122
Joined: Wed Nov 29, 2006 4:07 pm

Re: Stereo vision manager [now as a plugin]

Post by lygyue »

I am failed while patching 1.62.

Code: Select all

@@ -375,7 +375,7 @@
 		void setNumMultiRenderTargets(ushort num)
 		{
 			mNumMultiRenderTargets = num;
-		}
+		}		
 
 		ushort getNumWorldMatrices(void) const
 		{ 
This code can't be patch, and the app Terminated in an unusual way. :(
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Re: Stereo vision manager [now as a plugin]

Post by Thieum »

lygyue wrote:Thanks. i think i need to download ogre1.62.
But i don't understand why your plugin can't support two fullscreen output? It will be supported in ogre1.8?
My plugin does not support 2 fullscreen windows because the Directx9 rendersystem in ogre 1.6 does not support it. you need to patch it.
But the version 1.8 will support it without the need of a patch.
lygyue wrote:I am failed while patching 1.62.
This code can't be patch, and the app Terminated in an unusual way. :(
You must not download ogre 1.6.2, you must checkout the sources from the ogre SVN, because the patch was made from a specific revision of the code. (a revision is like a mini intermediate version of the code, there was a lot of revisions between ogre 1.6.2 and 1.6.3)
If you apply the patch to another revision, it might not work. The good revision is a bit newer than ogre 1.6.2 but older than ogre 1.6.3

Please try with the instructions in this previous post.
lygyue
Greenskin
Posts: 122
Joined: Wed Nov 29, 2006 4:07 pm

Re: Stereo vision manager [now as a plugin]

Post by lygyue »

There are so many revisions at svn(https://svn.ogre3d.org/svnroot/ogre/branches/v1-6), but which one is i need to patch? :cry:
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Re: Stereo vision manager [now as a plugin]

Post by Thieum »

Thieum wrote:Yes, this patch is outdated and I have not updated the documentaion
If it doesn't work, try to checkout the revision 8567 (the patch was made froim this one) instead of the HEAD revision.
this one :P

sorry I wasn't clear
lygyue
Greenskin
Posts: 122
Joined: Wed Nov 29, 2006 4:07 pm

Re: Stereo vision manager [now as a plugin]

Post by lygyue »

I had check out the right revision, but it can't be patched.

Code: Select all

H:\ogre\bak>patch -p0 -i MultipleRenderWindows_1.6_Patch_004.patch
patching file OgreMain/include/OgreCommon.h
patching file OgreMain/include/OgrePrerequisites.h
patching file OgreMain/include/OgreRenderSystem.h
patching file OgreMain/include/OgreRenderSystemCapabilities.h
missing header for unified diff at line 115 of patch
can't find file to patch at input line 115
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|7 +375,7 @@
|               void setNumMultiRenderTargets(ushort num)
|               {
|                       mNumMultiRenderTargets = num;
|-              }
|+              }
|
|               ushort getNumWorldMatrices(void) const
|               {
--------------------------
File to patch: OgreMain/include/OgreRenderSystemCapabilities.h
patching file OgreMain/include/OgreRenderSystemCapabilities.h
patching file OgreMain/include/OgreRenderWindow.h
patching file OgreMain/include/OgreRoot.h
patching file OgreMain/src/OgreRenderSystem.cpp
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.


I am very very sad. what can i do now?
Post Reply