Quad buffer stereo

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.

Quad buffer stereo

Postby gen » Tue Sep 09, 2003 2:51 pm

Hi !

Is it possible to use quadbuffer stereo using OGRE?
We need it in order to use shutter glasses.

(As far as I know when using opengl directly you need to render to the left and the right buffer separelty and then swap the buffers. The render window needs to be initialized so that the graphics card sends sync signal to the emmiters in order to synchronize the shutter glasses)

If not, do you think it is possible to add such a feature in OGRE?

Thank you!
gen
Gnoblar
 
Posts: 6
Kudos: 0
Joined: 09 Sep 2003
Location: Mytilini, Greece

Postby sinbad » Tue Sep 09, 2003 5:28 pm

We don't support it directly because of a lack of hardware of this sort, and the relatively low demand for this sort of thing. However, I don't see any reason why you couldn't customise OGRE to do it, perhaps through the use of multiple render targets (which we support).
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
 
Posts: 19261
Kudos: 69
Joined: 06 Oct 2002
Location: Guernsey, Channel Islands

Postby gen » Wed Sep 10, 2003 10:07 am

Could you give me some tips?
I might be able to do something usefull in the opengl part.
(Don't have an idea about DX)
Which classes should I look into to initialize the window properly for quadbuffer stereo?
Where should I look to select the OGL drawing buffer?
A couple of starting points could be really usefull.

Thanks!
gen
Gnoblar
 
Posts: 6
Kudos: 0
Joined: 09 Sep 2003
Location: Mytilini, Greece

Postby sinbad » Wed Sep 10, 2003 2:13 pm

Look at the subclasses of Ogre::RenderWindow for details of surface creation - each subclass does it it's own way and you'll find the GL and D3D specific details in there.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
 
Posts: 19261
Kudos: 69
Joined: 06 Oct 2002
Location: Guernsey, Channel Islands

Postby Proton » Wed Sep 10, 2003 8:04 pm

I have the Geforce2 GTS with the 3d shutter glasses. The stereo driver from the nvidia website makes ANY opengl or directx program work correctly with them.

I have played half-life, unreal tournament, quake, and even my own Ogre projects in stereo 3d. It looks cool if you dont mind the eye strain and headache.

Im not really sure what quadbuffer means. But you could probably pick up a cheap gf2 with the shutter glasses included.
-Proton
User avatar
Proton
Halfling
 
Posts: 41
Kudos: 0
Joined: 22 Apr 2003
Location: Alberta, Canada

Postby gen » Thu Sep 11, 2003 8:41 am

The stereo driver from the nvidia website makes ANY opengl or directx program work correctly with them.


Hm! this could be a quick solution... I have to try it.

But this is not a general solution it will work only on nvidia and it might be difficult to control parameters (such as eye distance) using your application. (you will have to use the nvidia drivers window)...

Thanks.
I have to look both cases and find out which is better in my case
gen
Gnoblar
 
Posts: 6
Kudos: 0
Joined: 09 Sep 2003
Location: Mytilini, Greece

nvidia stereo driver could do this

Postby marcus » Fri Sep 19, 2003 8:36 am

Hi

I've tested ogre with a nvidia quadro card and a 3D monitor.

I got this running with a tweaked Nvidia stereo driver.

If you don't find them - I can try to find one.
The biggest problem I think is that you'll need the latest nvidia driver.
But I can't imagine that there are latest tweaked driver around.
Maybe nvidia got their stereo driver running.

Good luck
Marcus
marcus
Gnoblar
 
Posts: 8
Kudos: 0
Joined: 03 Aug 2003

Postby gen » Thu Oct 02, 2003 11:48 am

Hi to all,

Sorry for not responding for some time, but I wanted to have some results. Well finally I tried both methods. Using the nvidia drivers and modifying subclasses of Ogre::RenderWindow.

Unfortunately the nVidia stereo drivers are not working with the shutter glasses that I have :( . (The synchronization emitter did not start)

Fortunately modifying OpenGL render window classes worked fine :).
I modified Win32Window::create, and GLRenderSystem::StartRendering.

the create function
the pixel format descriptor is changed ( PFD_STEREO is added and stencil buffer is set to 1),
In case of start rendering it is a little bit more complicated

Code: Select all
         Viewport *currentViewPort;
         Camera *currentCamera;
         static float Offset=-0.1;
         Offset+=0.1;
         glDrawBuffer(GL_BACK_LEFT);
         
            RenderTargetPriorityMap::iterator itarg, itargend;
            itargend = mPrioritisedRenderTargets.end();
         for( itarg = mPrioritisedRenderTargets.begin(); itarg != itargend; ++itarg )
            {
            if( itarg->second->isActive() )
            {
               // get the camera of each viewPort and add an offset for the eyes //
               unsigned short nViewPorts = itarg->second->getNumViewports();
               unsigned short nvp;
               for (nvp=0; nvp<nViewPorts ; nvp++)
               {
                  currentViewPort =   itarg->second->getViewport(nvp);
                  currentCamera =currentViewPort->getCamera() ;
                  currentCamera->moveRelative(Vector3(-Offset,0,0));
               }
               itarg->second->update();
               for (nvp=0; nvp<nViewPorts ; nvp++)
               {
                  currentViewPort =   itarg->second->getViewport(nvp);
                  currentCamera =currentViewPort->getCamera() ;
                  currentCamera->moveRelative(Vector3(Offset,0,0));
               }
            }
            }

//            RenderTargetPriorityMap::iterator itarg, itargend;
         glDrawBuffer(GL_BACK_RIGHT);
// The same loop follows for the right eye


I suppose that OpenGL render window classes should not change. (Enabling the quad buffer stereo makes rendering slower (rendering is performed two times) so it should not be enabled when it is not used). Changes to the code are minor so another rendering system seems too much. :?

Also, I do not like changing the camera position inside the startRendering function but I could not understand the way the camera is updated so I ended up to with this solution.
gen
Gnoblar
 
Posts: 6
Kudos: 0
Joined: 09 Sep 2003
Location: Mytilini, Greece

Postby koutsi » Fri Oct 03, 2003 8:45 am

Perhaps this addon should be imported in OGRE and used only for GL (for the momment) and maybe it could be an additional option at the config dialog for OpenGL rendering..
Informatics and Telematics Institute -
Augmented and Virtual Reality Laboratory
User avatar
koutsi
Gnoblar
 
Posts: 14
Kudos: 0
Joined: 03 Sep 2003
Location: Greece

Postby vhpgomes » Fri Jun 04, 2004 12:31 am

Hi,

I can't find GLRenderSystem::StartRendering... Maybe it's name had changed...
where should I put this code now???

thanks,

Victor
vhpgomes
Gnoblar
 
Posts: 8
Kudos: 0
Joined: 04 Jun 2004
Location: São Paulo / Brazil

Postby gen » Fri Jun 04, 2004 12:37 pm

You are right GLRenderSystem::StartRendering does not exist anymore.

I am afrraid it will not be straight forward to copy this code now
and I have not made the appropriate changes for the 0.14 version.

A !! a couple of questions.
Have you tried the other method that uses the nVidia drivers for the stereo projection ?
The stereo driver from the nvidia website makes ANY opengl or directx program work correctly with them.


What kind of stereo projection system do you have?

Well as soon as I manage to update the code for the quadbuffer stereo I will post the new source (or maybe upload them as patches)
gen
Gnoblar
 
Posts: 6
Kudos: 0
Joined: 09 Sep 2003
Location: Mytilini, Greece

Postby vhpgomes » Fri Jun 04, 2004 4:42 pm

Hi, thanks for your answer.

I haven't tried the nVidia drivers because I couldn't find a Linux version. I think that there is no Linux support for it.

As for our system, we have a 5-wall CAVE, with active stereo projectors. Here is a picture of our system:
Image

This application wasn't made using OGRE, I'm actually working on the first one. This was a port that we made of the program called Celestia:
http://www.shatters.net/celestia/


Thanks for your time,

Victor
vhpgomes
Gnoblar
 
Posts: 8
Kudos: 0
Joined: 04 Jun 2004
Location: São Paulo / Brazil

Postby vhpgomes » Mon Jun 14, 2004 7:28 am

Hello again,

I wasn't able to make the GLRendersystem (SDL) display the stereo correctly, but at least I managed to create a Window with stereo... I'll keep trying but I don't know, maybe I'm too dumb for this... :)

In the meantime, I came up with a solution that if not ideal, it's working for now. I created a SceneManager plugin, StereoSceneManager, and with this plugin I was able to render in stereo.

If anyone is interested I can post the code...
vhpgomes
Gnoblar
 
Posts: 8
Kudos: 0
Joined: 04 Jun 2004
Location: São Paulo / Brazil

Postby supersuper » Tue Jun 15, 2004 12:18 am

i'm interested in seeing the quad buffer stereo :)
supersuper
Greenskin
 
Posts: 114
Kudos: 0
Joined: 11 Feb 2004
Location: England!

Postby vhpgomes » Tue Jun 15, 2004 2:22 am

I basically made 3 changes:

1) added an option to the OpenGL RenderSystem, just like " fullscreen"

in SDLGLSupport::addConfig() :
Code: Select all
 
    optStereo.name = "Stereo Projection";
    optStereo.possibleValues.push_back("Yes");
    optStereo.possibleValues.push_back("No");
    optStereo.currentValue = "Yes";
    optStereo.immutable = false;
   
    mOptions[optStereo.name] = optStereo;


2) added stereo support in Window creation (if requested)
in SDLWindow::create()
Code: Select all
    if(stereo)
            SDL_GL_SetAttribute( SDL_GL_STEREO, 1 );


Note: I don't know why, but if I create a window in SDL with the flag SDL_FULLSCREEN, the stereo is disabled. Instead, I must first create a regular one and then call SDL_WM_ToggleFullScreen(screen);
This way the stereo works just fine... strange...

3) created the StereoSceneManager
This overrides just one method: _renderScene() , and the only change in it is:
Code: Select all
    float offset = 0.1;
    glDrawBuffer(GL_BACK_LEFT);
        camera->moveRelative(Vector3(-offset,0,0));
   
        mDestRenderSystem->_beginFrame();
        mDestRenderSystem->_setRasterisationMode(camera->getDetailLevel());
       _renderVisibleObjects();
        mDestRenderSystem->_endFrame();
    camera->moveRelative(Vector3( offset,0,0));

    glDrawBuffer(GL_BACK_RIGHT);
    camera->moveRelative(Vector3( offset,0,0));
     
        mDestRenderSystem->_beginFrame();
        mDestRenderSystem->_setRasterisationMode(camera->getDetailLevel());
        _renderVisibleObjects();
        mDestRenderSystem->_endFrame();
    camera->moveRelative(Vector3(-offset,0,0));


I know this is stupid, ugly, inneficient, etc... but it works... It was a desperate solution, since I must have a working demo and the deadline is closing in, and I yet have to put Ogre to work on a cluster, but that's a different story...

Oh, I also overriden the SDLWindow::getCustomAttribute(const String& name, void* pData); so I can do this (I don know if this is the best way...) :
Code: Select all
void CaveApplication::chooseSceneManager(void)
{
    bool stereo;

    // check if we should load the Stereo plugin or not
    _window->getCustomAttribute("Stereo",&stereo);
    if(stereo)
        _sceneMgr = _root->getSceneManager(ST_EXTERIOR_FAR);
    else
        _sceneMgr = _root->getSceneManager(ST_GENERIC); // no, get the generic
}


I registered the StereoSceneManager with ST_EXTERIOR_FAR.

Well that's it... I really hope this helps someone.. any doubts or suggestions?

Victor
vhpgomes
Gnoblar
 
Posts: 8
Kudos: 0
Joined: 04 Jun 2004
Location: São Paulo / Brazil

Postby SilverRat » Wed Sep 01, 2004 8:14 pm

Hello,

Thanks for the advice. It is helping us much in our progress to get a game engine with stereo abilities on our VR equipment.

Yet I am having some trouble figuring out where you placed the StereoSceneManager code and some of the other overrides. Can you give a few more specifics on part 3 or links to complete code chunks?

Please forgive me if this request is obvious. I am an old C ond OpenGL programmer fumbling his way through C++ and Ogre.

Thanks,
SilverRat
SilverRat
Gnoblar
 
Posts: 1
Kudos: 0
Joined: 01 Sep 2004

Postby PeterNewman » Tue Apr 26, 2005 6:16 am

Has any-one done anything more with QuadBuffer rendering? Can it be done with Direct3D? I'm about to start in on this myself, we've got a demonstration machine using Quatro FX and passive stereo (each eye on each video out). Looks brilliant, but since it's not active stereo (as done by the nVIDIA drivers technique) we need to add support to Ogre for the QuadBuffer to show off OUR applications, rather then just the sample ones.

I'll be working on this, and if we get it, will submit the changes back up to the patch tracker, of course.

I'm looking at customising the Render System(s), since this seems to me to be a logical place for it. OpenGL first because there is example code for the buffer selects for that, then I'm going to try and hunt it up in Direct3D (since we have shader issues with OpenGL), although I'm not holding out hope.

Edit: Oh, it'll be only on Win32, BTW.
User avatar
PeterNewman
Greenskin
 
Posts: 128
Kudos: 0
Joined: 21 Jun 2004
Location: Victoria, Australia

Postby PeterNewman » Wed May 11, 2005 2:15 am

OK, bumping my own post, but I thought I'd give an update.

It works! It's currently messy as, but I'll be cleaning it up now that I'm back from the trade show. Basically, I'm thinking to add a property to the RenderSystem that specifies how many repeats it wants. In the case of stereo, this is twice, for each eye. Possibly this could be used for rendering off to multiple displays in future, I'm not sure.
The SceneManager has to query the Renderer for how many repeats it wants, then redo the entire rendering process each time. This is because while each eye has it's own color buffer, they share the depth buffer and so on, so they need to be cleaned before alternating.

Incidently, the trade-show is the National Manufacturing Week being held at the Melbourne Exhibition Centre. Clicky.
Photo's of out booth are here
User avatar
PeterNewman
Greenskin
 
Posts: 128
Kudos: 0
Joined: 21 Jun 2004
Location: Victoria, Australia

Postby Kentamanos » Wed May 11, 2005 5:13 am

Neat stuff. Did you use 2 polarized projectors? It looks like it from the glasses and one shot looks like 2 projectors stacked...

[EDIT] Just saw your other post that mentions the polarized projectors.
User avatar
Kentamanos
Minaton
 
Posts: 980
Kudos: 0
Joined: 07 Aug 2004
Location: Dallas, TX

Postby PeterNewman » Wed May 11, 2005 7:50 am

Yeah, two projectors, like you saw.

OK, patch uploaded to http://sourceforge.net/tracker/index.php?func=detail&aid=1199623&group_id=2997&atid=302997

All class abstracted and API'd and stuff!
User avatar
PeterNewman
Greenskin
 
Posts: 128
Kudos: 0
Joined: 21 Jun 2004
Location: Victoria, Australia

Postby wwoelbel » Tue May 24, 2005 10:10 pm

Hi Peter;

I was guided by several folks to the Cygwin utilities in the hope of applying the patch you posted. I moved the patch file to the ogrenew directory and issued a command of "patch --dry-run -p0 < patch.txt". I was given a response that it could not find the file to patch and that I may have used the wrong -p or -strip option. Are you able to apply the patch? If so, how are you doing it?

Bill
wwoelbel
Halfling
 
Posts: 55
Kudos: 0
Joined: 31 Jan 2005

Postby PeterNewman » Wed May 25, 2005 12:03 am

You will probably want to look into the line endings. I think Cygwin uses the lines \n line endings, where the patch no doubt has the Windows \r\n line endings, which will confuse the "patch" program.

Should be an option there somewhere for switching between the two though... I think! I haven't actually tried applying the patch, as I made it from my modifications.
User avatar
PeterNewman
Greenskin
 
Posts: 128
Kudos: 0
Joined: 21 Jun 2004
Location: Victoria, Australia

Postby wwoelbel » Wed May 25, 2005 1:45 pm

Morning Peter;

I read up on the patch file format and did some experimenting this morning. I was moderately successful. Apparently, the --- and +++ lines needed to indicate the relative path to the file. Things got better. Then, apparently the version of patch in cygwin did not like multiple sections in the patch file. Each time it encountered an INDEX line after the first, it would bark about a malformed patch file. So I chopped the single patch file into six pieces. It was working until we got to patch4 which is the section on OgreGLRenderSystem.h. I get the deeply insightful error message that the line ends unexpectedly (without telling me which line).

Can you tell me what tool you used to generate the patch file? Perhaps I can solve this mystery by just installing the tool and letting it read its own patch.

Bill
wwoelbel
Halfling
 
Posts: 55
Kudos: 0
Joined: 31 Jan 2005

Postby PeterNewman » Thu May 26, 2005 12:41 am

I used WinCVS to create the patch. I'm not sure if it uses an external program (I dont think so).
User avatar
PeterNewman
Greenskin
 
Posts: 128
Kudos: 0
Joined: 21 Jun 2004
Location: Victoria, Australia

Postby wwoelbel » Thu May 26, 2005 12:56 pm

The WinCVS route ran dry. I can see how to make the patch but not how to reverse the process. You know what? There is one tool that I think I can get to work - the keyboard. The patch is not that huge and I think I understand how to "read" it. Thanks for the help though!

Bill
wwoelbel
Halfling
 
Posts: 55
Kudos: 0
Joined: 31 Jan 2005

Next

Return to General Discussion

Who is online

Users browsing this forum: Baidu [Spider] and 8 guests