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
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Post by Thieum »

I maintain you still have some color perception with anaglyph glasses :P
Look at the ogre logo or the debug panel, you clearly see they are yellow or green. you don't have a monochromatic view with the glasses, but an altered view (maybe because the filters are not perfect ? or your glasses are better than mine ?)

(ok, the rest of the scene is not very colorfull)

anyway, thank you for the glsl scripts :D
barkas
Halfling
Posts: 90
Joined: Thu Feb 15, 2007 5:50 pm

Post by barkas »

In fact I can't get a real 3D effect out of your pictures at all, because the eye parameters aren't chosen very well.

I'll soon post one of my screens with better parameters.
barkas
Halfling
Posts: 90
Joined: Thu Feb 15, 2007 5:50 pm

Post by barkas »

Unexpected difficulties ... I use the high resolution tiled screenshot technique described in the wiki, which doesn't work with a custom projection matrix, so I have to adjust the projection matrix directly in StereoManager, I think.
futnuh
Goblin
Posts: 225
Joined: Sun Sep 25, 2005 3:22 am
Location: Calgary, Alberta
x 1

Post by futnuh »

Thieum wrote:I maintain you still have some color perception with anaglyph glasses
Yellow is certainly perceptible through red/blue anaglyphic glasses, as is purple. That's not to say that these colours are passed by each eye in equal amounts - they likely aren't. Still, the brain seems to compensate.
barkas
Halfling
Posts: 90
Joined: Thu Feb 15, 2007 5:50 pm

Post by barkas »

To have stereo and color, both eyes must be able to correlate the pictures and focus on them.
For that, the parts of the picture you want to look at must be visible to both eyes, so pure red or pure cyan are right out. I suspect that if the difference is too big, it won't work either.
Of course, that may be compensated by other parts of the picture that are more similar in the two images.
barkas
Halfling
Posts: 90
Joined: Thu Feb 15, 2007 5:50 pm

Post by barkas »

The promised screenshot ...

Image
peanutbooy
Gnoblar
Posts: 4
Joined: Fri Jan 25, 2008 10:41 pm

python-ogre?

Post by peanutbooy »

Is it possible to use this in python-ogre?
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Post by Thieum »

I have never used Python Ogre, thus there is no bindings for the stereo manager in Python but it can be easily reimplemented in python if you understand c++ code.
However, if you want to use a polarized screen with two projectors you must use a non-official patch for ogre. And being non official, this patch is not used in Python Ogre.
But if you can use the compositor in Python Ogre (and I think you can) you can use anaglpyh (red/blue) stereo :)
peanutbooy
Gnoblar
Posts: 4
Joined: Fri Jan 25, 2008 10:41 pm

an unofficial Patch, eh?

Post by peanutbooy »

would you mind pointing me in the right direction towards this unofficial patch? It would be greatly appreciated.
skullmunky
Gnoblar
Posts: 20
Joined: Wed Jun 13, 2007 6:09 am

Post by skullmunky »

is the multihead patch only needed in DX, or would that be need in linux/GL also?

i'm just guessing, actually, but is something like this about right for what's needed with quad buffer?

(if one were using GLUT ... )
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE | GLUT_STEREO);

glDrawBuffer(GL_BACK_LEFT);

glDrawBuffer(GL_BACK_RIGHT);

+ set the stereo mode to quadbuffer in xorg.conf
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Post by Thieum »

Multihead is only needed for DirectX. It is the equivalent of quad buffer for OpenGL
nirvana_searcher
Gnoblar
Posts: 1
Joined: Mon Mar 10, 2008 10:21 am

Apply Patch

Post by nirvana_searcher »

I am interested to use StereoManager but i am Unable to apply the patch for Multihead,can someone help me please?..or there's another simple method for stereoscopic Vision?

I've got the CVS Version of Ogre but i can not apply the file Patch.txt..i don't know how do it. :oops:

(Sorry for my bad english and for my "newbie question") :oops:
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Post by Thieum »

Hi! No problem, don't worry.

You will need a program to apply the patch, I used GNU patch
Copy patch.exe in c:\windows\ (it may not be the best solution but it is the simplest)
Copy the patch in the orgrenew folder, open a command window here and use this command :

Code: Select all

patch -p0 -i multihead_wip2.patch
This should work fine. but i did not tested the patch on ogre 1.4.7, only on ogre 1.4.6. Can you tell me if patch reports any conflict when applying the patch ?
But you can still have red/blue anaglyph stereoscopic vision without the patch
murderv
Greenskin
Posts: 105
Joined: Tue Jun 26, 2007 12:20 pm

Post by murderv »

hello,
im working on a application to be ran with a head mounted display.
ive noticed this stereomanager, been able to compile it and run but it crashes on this line:

RenderTarget *rttTex = mTexture->getBuffer()->getRenderTarget();

anyone or the author has any idea why? im using lastest version of ogre..

this is the crash error i get:

---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Error!

Program: c:\Work\VR\Fresnel\Debug\fresnel.exe
Module: c:\Work\VR\Fresnel\Debug\fresnel.exe
File: c:\work\vr\fresnel\fresnel.cpp
Line: 432

Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
murderv
Greenskin
Posts: 105
Joined: Tue Jun 26, 2007 12:20 pm

Post by murderv »

ok it seems i had libs compiled with different version of compiler im using.. its running still i dont see any stereo rendering.

i shall try the patch and see if that works. maybe its not implemented in ogre core yet. i will post some news if it works
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Post by Thieum »

yes, you should use the multihead patch with mounted head display and dual output mode
murderv
Greenskin
Posts: 105
Joined: Tue Jun 26, 2007 12:20 pm

Post by murderv »

hello,

i havent been able to get the anaglyph to work.

using the U key to change between modes only gets me thru dual output (i notice there are difference in both monitors of the eye position) and none.

i would also like to know if anyone got Ogre to work with quad stereo.
i own a ATI FirelGL 8600 and i wanted to be able to get ogre to use this mode.

i am not sure but i guess it should be better than rendering 2 cameras in two different viewports.

any ideas ?

BTW very nice work on the stereomanager !
murderv
Greenskin
Posts: 105
Joined: Tue Jun 26, 2007 12:20 pm

Post by murderv »

ok, i've fixed the shaders and got anaglyph rendering to work with the stereo manager.

still i would like to hear your ideas on the quadstereo and what advantages and what could it bring that would be better to an application ?
murderv
Greenskin
Posts: 105
Joined: Tue Jun 26, 2007 12:20 pm

Post by murderv »

hmm weird, when in anaglyph mode the reflections look wrong.
inverted or something. any idea why ?
Last edited by murderv on Tue Apr 22, 2008 11:57 am, edited 1 time in total.
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Post by Thieum »

Hi!

There is indeed a strange bug with the anaglyph compositing script with directx. I have a workaround to fix this bug, but the shader would be less efficient I think. If I cant fix it, I will use the workaround (see this topic)

And the reflections are inverted when the compositor is used under opengl. with directx the reflections are ok. I still don't know why

I'm trying to fix this, but it worked fine with previous versions of ogre :(
I rewrote the example and I added more comments in both the example and the manager
murderv
Greenskin
Posts: 105
Joined: Tue Jun 26, 2007 12:20 pm

Post by murderv »

you are right,

i have converted the shaders from cg to hlsl and running in dx everything worked just fine..
i did not notice anything weird in dx.

im using firegl 8600
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Post by Thieum »

you should check the first post, I updated the archive.
I corrected the anaglyph bug but not the reflection bug. I think it is a bug in ogre or in the openGL rendersystem.
I made a few improvements in the code and added some useful explanations
murderv
Greenskin
Posts: 105
Joined: Tue Jun 26, 2007 12:20 pm

Post by murderv »

hi,

i have a big problem.

my application when running in normal mode seems to be ok and has no crash.. whenever i enable stereo rendering (dual output or anaglyph), meaning creating 2 renderwindows and all like the sample you made with fresnel it just CRASHES when uninstalling DX plugin, at the very end of the application end.

is pretty strange. i already compiled ogre again (im using VS2008) and keeps happening the same crash.

im using your patch, not the one from sinbad. im not sure which one is the most recent one.

im hoping anyone have any idea why this is happening ?
User avatar
Thieum
Gnome
Posts: 342
Joined: Wed Apr 26, 2006 5:13 pm
Location: Bordeaux, France
x 2
Contact:

Post by Thieum »

Hi!

you should use the patch named "multihead_wip2.patch", it fixes the crash with alt+tab

Is there any message in the log ? Have you tried in debug mode ? Can you tell me here in the code does it crash
I don't really have any idea with is it crashing, it works fine here. Have you installed the instrumented nvidia drivers ?
murderv
Greenskin
Posts: 105
Joined: Tue Jun 26, 2007 12:20 pm

Post by murderv »

thieum,

i have some questions about stereo vision.

for my experience rendering 2 images for a head mounted display the effect of stereo wasnt impressive.

for the best effect we must count with the distance between the eyes, usually about 4cm (0.04) and using a focal plane (near) of about one meter (1).

ive tried to change values but still the effect using the HMD wasnt good enough. not much of a stereoscopic view.

with ogre what is done is offset the frustum by half of the eyespacing and set a focal plane, which is the distance to the near plane if im not mistaken. you also change the FOVy using the focallength and aspect ratio.

my question and doubt is how do we set up the stereovision to fit the different methods and what to take into account for all this different views (monitor, projection, HMD, glasses)

any help appreciated
Post Reply