OGRE and Quad Buffer Stereo
-
- Kobold
- Posts: 25
- Joined: Sat Jul 13, 2013 1:12 am
- x 5
OGRE and Quad Buffer Stereo
Hi guys,
My name is Christian and I'm a software engineer at zSpace, Inc.. I've been asked to look into quad buffer support for OGRE using both OpenGL and Direct3D. After downloading the source, OGRE doesn't appear to support this today.
However, It seems like there is quite a bit of interest for this based on what I've been reading on the forums. I didn't see this on the OGRE road map, but I'd like to help develop a solution for everyone that is usable for OpenGL as well as Direct3D 9 and 11. Here's my design document proposal for adding stereo to OGRE.
What is the process for developing new features for OGRE in a way they be approved back into trunk? Who should I talk to?
Thanks,
Christian
My name is Christian and I'm a software engineer at zSpace, Inc.. I've been asked to look into quad buffer support for OGRE using both OpenGL and Direct3D. After downloading the source, OGRE doesn't appear to support this today.
However, It seems like there is quite a bit of interest for this based on what I've been reading on the forums. I didn't see this on the OGRE road map, but I'd like to help develop a solution for everyone that is usable for OpenGL as well as Direct3D 9 and 11. Here's my design document proposal for adding stereo to OGRE.
What is the process for developing new features for OGRE in a way they be approved back into trunk? Who should I talk to?
Thanks,
Christian
Last edited by crefvik on Wed Aug 14, 2013 1:15 am, edited 1 time in total.
-
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
Re: OGRE and Quad Buffer Stereo
Hi,
You can read this one http://www.ogre3d.org/developers/submit-patch for submitting patches. Furthermore we need a signed Contributor_License (http://www.ogre3d.org/downloads/OGRE_Co ... icense.pdf).
Best way would be to start a fork and when you did something you can make a pull request.
You can read this one http://www.ogre3d.org/developers/submit-patch for submitting patches. Furthermore we need a signed Contributor_License (http://www.ogre3d.org/downloads/OGRE_Co ... icense.pdf).
Best way would be to start a fork and when you did something you can make a pull request.
-
- Kobold
- Posts: 25
- Joined: Sat Jul 13, 2013 1:12 am
- x 5
Re: OGRE and Quad Buffer Stereo
Hi Murat,
Thanks for the reply - I will definitely submit the contributor license. I saw the Submit Patch or Bug / JIRA page, but there wasn't any mention of any design document that needed to be reviewed before just modifying the source and requesting it to be pulled back into the trunk.
In any case, I can certainly get started on forking the current source to get started.
Thanks for the help,
Christian
Thanks for the reply - I will definitely submit the contributor license. I saw the Submit Patch or Bug / JIRA page, but there wasn't any mention of any design document that needed to be reviewed before just modifying the source and requesting it to be pulled back into the trunk.
In any case, I can certainly get started on forking the current source to get started.
Thanks for the help,
Christian
-
- Kobold
- Posts: 25
- Joined: Sat Jul 13, 2013 1:12 am
- x 5
Re: OGRE and Quad Buffer Stereo
Hi guys,
I've created a design document for adding stereo to OGRE. My proposal covers both OpenGL and Direct3D.
Please take a look and let me know if you have any concerns. Please let me know if you have a problem accessing the document.
Thanks,
Christian
I've created a design document for adding stereo to OGRE. My proposal covers both OpenGL and Direct3D.
Please take a look and let me know if you have any concerns. Please let me know if you have a problem accessing the document.
Thanks,
Christian
-
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
Re: OGRE and Quad Buffer Stereo
Hi,
I just readed it looking good.
Here some points:
* This feature should be a compiletime option - so make sure you guard enum / code which belongs to it
* Make sure cmake can handle the new deps
Otherwise i am looking forward to see the your pull request.
I just readed it looking good.
Here some points:
* This feature should be a compiletime option - so make sure you guard enum / code which belongs to it
* Make sure cmake can handle the new deps
Otherwise i am looking forward to see the your pull request.
-
- Kobold
- Posts: 25
- Joined: Sat Jul 13, 2013 1:12 am
- x 5
Re: OGRE and Quad Buffer Stereo
Hi Murat,
I have made much progress on this project. Per your request, all the code related to this feature is a compile time option. Per your request, I have made sure that the CMakeLists.txt of the OGRE SDK handles these new dependencies similar to the other OGRE external dependencies. I have made sure that the new dependencies have also been added to the ogredeps repository in order to make it easier for developers to build with the Direct3D stereo related code.
At this point, I have the following configurations enabled for stereo:
Specifically, I've tested the following hardware:
If you have any questions, please let me know.
Thanks,
Christian
I have made much progress on this project. Per your request, all the code related to this feature is a compile time option. Per your request, I have made sure that the CMakeLists.txt of the OGRE SDK handles these new dependencies similar to the other OGRE external dependencies. I have made sure that the new dependencies have also been added to the ogredeps repository in order to make it easier for developers to build with the Direct3D stereo related code.
At this point, I have the following configurations enabled for stereo:
- OpenGL - Windows
- OpenGL - Linux
- OpenGL - Mac (Cocoa and Carbon)
- Direct3D 9 - NVIDIA
- Direct3D 11 - NVIDIA
Specifically, I've tested the following hardware:
- NVIDIA 3DVision Glasses
- NVIDIA 3DVision Pro Glasses
- Benq XL2420-B Display
- Acer GD235Hz Display
- NVIDIA Quadro 4000
- AMD Radeon HD 7700
- MacBook Pro with NVIDIA GeForce GT 330m
- MacBook Pro with AMD Radeon HD 6700m
- zSpace Display
If you have any questions, please let me know.
Thanks,
Christian
-
- Kobold
- Posts: 26
- Joined: Thu Nov 07, 2013 5:11 am
- Location: Guayaquil
Re: OGRE and Quad Buffer Stereo
Hello, I'm working on a project with nvidia 3d glasses on ubuntu and I'm using a quad GPU is your code available?
-
- Kobold
- Posts: 25
- Joined: Sat Jul 13, 2013 1:12 am
- x 5
Re: OGRE and Quad Buffer Stereo
Sure, if anyone is interested, my code is available here:
https://bitbucket.org/crefvik/ogre
https://bitbucket.org/crefvik/ogredeps
I've modified the ogredeps to add the NVAPI and AMD Quad Buffer SDK libraries. Currently, all my changes exist on the 1.8 branch. I'm working with Murat to see what we can do to get them ported to 1.10 and merged into the official repository.
If you have any questions about the code, please let me know.
Thanks,
Christian
https://bitbucket.org/crefvik/ogre
https://bitbucket.org/crefvik/ogredeps
I've modified the ogredeps to add the NVAPI and AMD Quad Buffer SDK libraries. Currently, all my changes exist on the 1.8 branch. I'm working with Murat to see what we can do to get them ported to 1.10 and merged into the official repository.
If you have any questions about the code, please let me know.
Thanks,
Christian
-
- Kobold
- Posts: 26
- Joined: Thu Nov 07, 2013 5:11 am
- Location: Guayaquil
Re: OGRE and Quad Buffer Stereo
Hello Christian. Thanks for sharing your work. Do you have any example code for the NVIDIA 3DVision Glasses using this version of ogre? Thanks
-
- Kobold
- Posts: 25
- Joined: Sat Jul 13, 2013 1:12 am
- x 5
Re: OGRE and Quad Buffer Stereo
Sure, no problem. The full sample code is below - its fairly simple. Its really the same kind of thing that you would do for any other OGRE sample application. The only new thing is the following:
The values of colourBuffer can be:
Anyway - the full code is below, so let me know if you have any questions or problems. There maybe some code that is commented out and feel free to play with the stereo settings.
Thanks,
Christian
Code: Select all
viewport->setDrawBuffer(colourBuffer);
- Ogre::CBT_BACK
Ogre::CBT_BACK_LEFT
Ogre::CBT_BACK_RIGHT
Anyway - the full code is below, so let me know if you have any questions or problems. There maybe some code that is commented out and feel free to play with the stereo settings.
Thanks,
Christian
Code: Select all
#include "Ogre/Ogre.h"
#include "OIS/OISEvents.h"
#include "OIS/OISInputManager.h"
#include "OIS/OISKeyboard.h"
#include "OIS/OISMouse.h"
class AnimationFrameListener : public Ogre::FrameListener
{
public:
AnimationFrameListener(Ogre::Entity* sinbadEntity, bool* isSinbadRunning)
{
// Cache the application state
m_isSinbadRunning = isSinbadRunning;
// Get the running animiations for the base of Sinbad and the top of Sinbad
m_sinbadRunBaseAnimationState = sinbadEntity->getAnimationState("RunBase");
m_sinbadRunTopAnimationState = sinbadEntity->getAnimationState("RunTop");
}
bool frameStarted(const Ogre::FrameEvent& evt)
{
// If Sinbad is running, enable the animation
m_sinbadRunBaseAnimationState->setEnabled(*m_isSinbadRunning);
m_sinbadRunTopAnimationState->setEnabled(*m_isSinbadRunning);
if (*m_isSinbadRunning)
{
// If Sinbad is running, reset the animation if necessary
if (m_sinbadRunBaseAnimationState->hasEnded())
m_sinbadRunBaseAnimationState->setTimePosition(0.0f);
if (m_sinbadRunTopAnimationState->hasEnded())
m_sinbadRunTopAnimationState->setTimePosition(0.0f);
}
else
{
// If Sinbad is not running, reset the animation
m_sinbadRunBaseAnimationState->setTimePosition(0.0f);
m_sinbadRunTopAnimationState->setTimePosition(0.0f);
}
m_sinbadRunBaseAnimationState->addTime(evt.timeSinceLastFrame);
m_sinbadRunTopAnimationState->addTime(evt.timeSinceLastFrame);
return true;
}
bool* m_isSinbadRunning;
Ogre::AnimationState* m_sinbadRunBaseAnimationState;
Ogre::AnimationState* m_sinbadRunTopAnimationState;
};
class OISFrameListener : public Ogre::FrameListener
{
public:
OISFrameListener(Ogre::RenderWindow* window, Ogre::SceneNode* sinbadNode, bool* isStereoEnabled, bool* isSinbadRunning)
{
// Cache the objects
m_window = window;
m_sinbadNode = sinbadNode;
m_isStereoEnabled = isStereoEnabled;
m_isSinbadRunning = isSinbadRunning;
// Reset the timer, rotation, and set the speeds
m_timer.reset();
m_sinbadRotation = Ogre::Radian(0);
m_sinbadRunningSpeed = 50.0f;
m_cameraSpeed = 200.0f;
// Get the OGRE window handle
size_t windowHnd = 0;
m_window->getCustomAttribute("WINDOW", &windowHnd);
// Convert the OGRE window handle to a string
std::stringstream windowHndStr;
windowHndStr << windowHnd;
// Create an OIS input manager from the OGRE window handle string
OIS::ParamList paramList;
paramList.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
m_inputManager = OIS::InputManager::createInputSystem(paramList);
// Create the OIS keyboard and mouse unbuffered input objects
m_keyboard = static_cast<OIS::Keyboard*>(m_inputManager->createInputObject(OIS::OISKeyboard, false));
m_mouse = static_cast<OIS::Mouse*>(m_inputManager->createInputObject(OIS::OISMouse, false));
}
~OISFrameListener()
{
// Cleanup the OIS keyboard, mouse, and input manager
m_inputManager->destroyInputObject(m_keyboard);
m_inputManager->destroyInputObject(m_mouse);
OIS::InputManager::destroyInputSystem(m_inputManager);
}
bool frameStarted(const Ogre::FrameEvent& evt)
{
// Capture keyboard and mouse input
m_keyboard->capture();
m_mouse->capture();
// Quit the application
if (m_keyboard->isKeyDown(OIS::KC_ESCAPE))
return false;
// Toggle fullscreen
if (m_keyboard->isKeyDown(OIS::KC_F) && m_timer.getMilliseconds() > 250)
{
bool isFullScreen = m_window->isFullScreen();
m_window->setFullscreen(!isFullScreen, 1920, 1080);
m_timer.reset();
}
// If stereo is enabled, swap left and right color buffers
if (m_keyboard->isKeyDown(OIS::KC_M) && m_timer.getMilliseconds() > 250)
{
if (m_window->isStereoEnabled())
{
for (unsigned short i = 0; i < m_window->getNumViewports(); i++)
{
Ogre::Viewport* viewport = m_window->getViewport(i);
if (Ogre::CBT_BACK_LEFT == viewport->getDrawBuffer())
viewport->setDrawBuffer(Ogre::CBT_BACK_RIGHT);
else if (Ogre::CBT_BACK_RIGHT == viewport->getDrawBuffer())
viewport->setDrawBuffer(Ogre::CBT_BACK_LEFT);
}
}
m_timer.reset();
}
// Enable / disable stereo
if (m_keyboard->isKeyDown(OIS::KC_Z) && m_timer.getMilliseconds() > 250)
{
*m_isStereoEnabled = !(*m_isStereoEnabled);
for (unsigned short i = 0; i < m_window->getNumViewports(); i++)
{
Ogre::Viewport* viewport = m_window->getViewport(i);
if (0 == i && Ogre::CBT_BACK == viewport->getDrawBuffer())
viewport->setDrawBuffer(Ogre::CBT_BACK_LEFT);
else if (1 == i && Ogre::CBT_BACK == viewport->getDrawBuffer())
viewport->setDrawBuffer(Ogre::CBT_BACK_RIGHT);
else
viewport->setDrawBuffer(Ogre::CBT_BACK);
}
m_timer.reset();
}
// Move Sinbad around the scene
Ogre::Vector3 sinbadTranslate(0, 0, 0);
if (m_keyboard->isKeyDown(OIS::KC_UP))
{
m_sinbadRotation = Ogre::Radian(Ogre::Math::PI);
sinbadTranslate += Ogre::Vector3(0, 0, -1);
}
if (m_keyboard->isKeyDown(OIS::KC_DOWN))
{
m_sinbadRotation = Ogre::Radian(0);
sinbadTranslate += Ogre::Vector3(0, 0, 1);
}
if (m_keyboard->isKeyDown(OIS::KC_LEFT))
{
m_sinbadRotation = Ogre::Radian(-Ogre::Math::HALF_PI);
sinbadTranslate += Ogre::Vector3(-1, 0, 0);
}
if (m_keyboard->isKeyDown(OIS::KC_RIGHT))
{
m_sinbadRotation = Ogre::Radian(Ogre::Math::HALF_PI);
sinbadTranslate += Ogre::Vector3(1, 0, 0);
}
*m_isSinbadRunning = !sinbadTranslate.isZeroLength();
m_sinbadNode->translate(sinbadTranslate * evt.timeSinceLastFrame * m_sinbadRunningSpeed);
m_sinbadNode->resetOrientation();
m_sinbadNode->yaw(Ogre::Radian(m_sinbadRotation));
// Move the camera around the scene
Ogre::Vector3 cameraTranslate(0, 0, 0);
if (m_keyboard->isKeyDown(OIS::KC_W))
cameraTranslate += Ogre::Vector3(0, 0, -1);
if (m_keyboard->isKeyDown(OIS::KC_S))
cameraTranslate += Ogre::Vector3(0, 0, 1);
if (m_keyboard->isKeyDown(OIS::KC_A))
cameraTranslate += Ogre::Vector3(-1, 0, 0);
if (m_keyboard->isKeyDown(OIS::KC_D))
cameraTranslate += Ogre::Vector3(1, 0, 0);
if (m_keyboard->isKeyDown(OIS::KC_PGDOWN))
cameraTranslate += Ogre::Vector3(0, -1, 0);
if (m_keyboard->isKeyDown(OIS::KC_PGUP))
cameraTranslate += Ogre::Vector3(0, 1, 0);
// Rotate the camera using the mouse
float rotX = m_mouse->getMouseState().X.rel * evt.timeSinceLastFrame * -1;
float rotY = m_mouse->getMouseState().Y.rel * evt.timeSinceLastFrame * -1;
for (unsigned short i = 0; i < m_window->getNumViewports(); i++)
{
Ogre::Camera* camera = m_window->getViewport(i)->getCamera();
camera->yaw(Ogre::Radian(rotX));
camera->pitch(Ogre::Radian(rotY));
camera->moveRelative(cameraTranslate * evt.timeSinceLastFrame * m_cameraSpeed);
}
return true;
}
bool* m_isStereoEnabled;
bool* m_isSinbadRunning;
float m_sinbadRunningSpeed;
float m_cameraSpeed;
OIS::InputManager* m_inputManager;
OIS::Keyboard* m_keyboard;
OIS::Mouse* m_mouse;
Ogre::Radian m_sinbadRotation;
Ogre::RenderWindow* m_window;
Ogre::SceneNode* m_sinbadNode;
Ogre::Timer m_timer;
};
void loadResources(const Ogre::String& configFilename)
{
// Add all the resources in the resource configuration file
Ogre::ConfigFile configFile;
configFile.load(configFilename);
Ogre::ConfigFile::SectionIterator sectionIter = configFile.getSectionIterator();
Ogre::String secName, typeName, archName;
while (sectionIter.hasMoreElements())
{
secName = sectionIter.peekNextKey();
Ogre::ConfigFile::SettingsMultiMap* settings = sectionIter.getNext();
Ogre::ConfigFile::SettingsMultiMap::iterator i;
for (i = settings->begin(); i != settings->end(); ++i)
{
typeName = i->first;
archName = i->second;
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
}
}
// Index all added resources
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
}
void createScene(Ogre::SceneManager* sceneManager, Ogre::Entity*& sinbadEntity, Ogre::SceneNode*& sinbadNode)
{
// Create a plane for the floor, attach a material, and add it to the scene
//Ogre::Plane plane(Ogre::Vector3::UNIT_Y, -50);
Ogre::Plane plane(Ogre::Vector3::UNIT_Y, -15);
Ogre::MeshManager::getSingleton().createPlane("Floor", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane, 1500, 1500, 200, 200, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);
Ogre::Entity* floorEntity = sceneManager->createEntity("FloorEntity", "Floor");
floorEntity->setMaterialName("Examples/BeachStones");
sceneManager->getRootSceneNode()->createChildSceneNode()->attachObject(floorEntity);
// Create a directional light
Ogre::Light* light = sceneManager->createLight("Light");
light->setType(Ogre::Light::LT_DIRECTIONAL);
light->setDiffuseColour(Ogre::ColourValue(1.0f, 1.0f, 1.0f));
light->setDirection(Ogre::Vector3(1, -1, 0));
// Create an instance of the Sinbad mesh and add it to the scene
sinbadEntity = sceneManager->createEntity("Sinbad", "Sinbad.mesh");
sinbadNode = sceneManager->getRootSceneNode()->createChildSceneNode("SinbadNode");
//sinbadNode->setPosition(Ogre::Vector3(0.0f, 5.0f, 0.0f));
sinbadNode->setPosition(Ogre::Vector3(0.0f, 0.0f, 0.0f));
sinbadNode->setScale(Ogre::Vector3(3.0f, 3.0f, 3.0f));
sinbadNode->attachObject(sinbadEntity);
// Add shadows to the scene
sceneManager->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
}
void createViewport
(
Ogre::RenderWindow* window,
Ogre::SceneManager* sceneManager,
const Ogre::String& name,
const Ogre::Real focalLength,
const Ogre::Vector2 frustumOffset,
int zOrder,
Ogre::ColourBufferType colourBuffer,
Ogre::Viewport*& viewport
)
{
// Create a camera and position it in the scene
Ogre::Camera* camera = sceneManager->createCamera(name);
camera->setPosition(0 + frustumOffset.x, 0, 100);
camera->lookAt(0, 0, 0);
camera->moveRelative(Ogre::Vector3(0, 25.0f, 30.0f));
camera->pitch(Ogre::Radian(Ogre::Degree(-60.0f)));
camera->setNearClipDistance(5.0f);
// Create a viewport, set the background color to black, and set the aspect ratio
viewport = window->addViewport(camera, zOrder);
viewport->setBackgroundColour(Ogre::ColourValue(0.0f, 0.0f, 0.0f, 1.0f));
camera->setAspectRatio(Ogre::Real(viewport->getActualWidth()) / Ogre::Real(viewport->getActualHeight()));
// Set the color buffer type that will be used during rendering
viewport->setDrawBuffer(colourBuffer);
}
int main(void)
{
// Create an instance of OGRE root
Ogre::Root* root = new Ogre::Root("plugins_d.cfg");
// Show the configuration dialog, but if it doesn't work close the app
if (!root->showConfigDialog())
return -1;
// Create a render window and verify that stereo is enabled
Ogre::RenderWindow* window = root->initialise(true, "zSpace Example");
bool isStereoEnabled = window->isStereoEnabled();
// Load the resources for the scene
loadResources("resources_d.cfg");
// Create the scene manager and the scene
Ogre::SceneManager* sceneManager = root->createSceneManager(Ogre::ST_GENERIC);
Ogre::Entity* sinbadEntity = NULL;
Ogre::SceneNode* sinbadNode = NULL;
createScene(sceneManager, sinbadEntity, sinbadNode);
// Create the cameras and viewports
Ogre::Real focalLength = 10.0f;
Ogre::Vector2 frustumOffset(-3.0f, 0.0f);
Ogre::Viewport* leftViewport = NULL;
createViewport(window, sceneManager, "LeftCamera", focalLength, frustumOffset, 0, Ogre::CBT_BACK_LEFT, leftViewport);
frustumOffset.x = 3.0f;
Ogre::Viewport* rightViewport = NULL;
createViewport(window, sceneManager, "RightCamera", focalLength, frustumOffset, 1, Ogre::CBT_BACK_RIGHT, rightViewport);
bool isSinbadRunning = false;
Ogre::FrameListener* animationFrameListener = new AnimationFrameListener(sinbadEntity, &isSinbadRunning);
root->addFrameListener(animationFrameListener);
Ogre::FrameListener* oisFrameListener = new OISFrameListener(window, sinbadNode, &isStereoEnabled, &isSinbadRunning);
root->addFrameListener(oisFrameListener);
// Start OGRE rendering
root->startRendering();
root->removeFrameListener(animationFrameListener);
delete animationFrameListener;
root->removeFrameListener(oisFrameListener);
delete oisFrameListener;
// Delete the root object
delete root;
return 0;
}
-
- Kobold
- Posts: 26
- Joined: Thu Nov 07, 2013 5:11 am
- Location: Guayaquil
Re: OGRE and Quad Buffer Stereo
Hello Christian,
Thanks for sharing your code. I ran it but I get errors like:
error: ‘class Ogre::Viewport’ has no member named ‘getDrawBuffer’ and error: ‘CBT_BACK_LEFT’ is not a member of ‘Ogre’
I've looked at OgreViewport.cpp and I can't find getDrawBuffer. I cloned the source code from the link you provided and I ran one of the tutorials and it works.
Maybe I don't have the same version as you? Or maybe I'm doing something wrong.
thanks
Thanks for sharing your code. I ran it but I get errors like:
error: ‘class Ogre::Viewport’ has no member named ‘getDrawBuffer’ and error: ‘CBT_BACK_LEFT’ is not a member of ‘Ogre’
I've looked at OgreViewport.cpp and I can't find getDrawBuffer. I cloned the source code from the link you provided and I ran one of the tutorials and it works.
Maybe I don't have the same version as you? Or maybe I'm doing something wrong.
thanks
-
- Kobold
- Posts: 25
- Joined: Sat Jul 13, 2013 1:12 am
- x 5
Re: OGRE and Quad Buffer Stereo
Hi v3_xd,
When you build OGRE using the source I pointed you to, you need to make sure the CMAKE argument for building the necessary stereo code is enabled, as shown in the screenshot below. This was done because it was requested by Murat initially when I created this post. Its also generally a good idea when adding new features.
You also need to make sure that you are using the v1-8 branch. I developed the code on that branch, because it was the most stable at the time. I can certainly merge the code to any newer release.
Hope that helps,
Christian
When you build OGRE using the source I pointed you to, you need to make sure the CMAKE argument for building the necessary stereo code is enabled, as shown in the screenshot below. This was done because it was requested by Murat initially when I created this post. Its also generally a good idea when adding new features.
You also need to make sure that you are using the v1-8 branch. I developed the code on that branch, because it was the most stable at the time. I can certainly merge the code to any newer release.
Hope that helps,
Christian
You do not have the required permissions to view the files attached to this post.
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: OGRE and Quad Buffer Stereo
Is there a major incompatibility between Stereo-enabled and non-enabled builds? Otherwise you should really avoid adding build options. It means you won't be able to use it with SDKs or Ogre builds packaged in repositories.
Unless the default would be changed to ON, but in that case, why are you adding the option anyway? No one will bother turning it off.
Unless the default would be changed to ON, but in that case, why are you adding the option anyway? No one will bother turning it off.
I strongly disagree.Its also generally a good idea when adding new features.
-
- Kobold
- Posts: 25
- Joined: Sat Jul 13, 2013 1:12 am
- x 5
Re: OGRE and Quad Buffer Stereo
Hi Scrawl,
You're right, the code doesn't automatically enable stereo, the application must do this. In fact, many people do not have stereo hardware, so I would never force stereo to be enabled. In order to create stereo OGRE application, you basically do two things:
Thanks,
Christian
You're right, the code doesn't automatically enable stereo, the application must do this. In fact, many people do not have stereo hardware, so I would never force stereo to be enabled. In order to create stereo OGRE application, you basically do two things:
- Enable the stereo setting in the renderer (ie. enable the setting for the pixel format in OpenGL or enable the driver for Direct3D)
- Create at least two viewports in the application - set one viewport to the left buffer and another viewport to the right buffer
Thanks,
Christian
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: OGRE and Quad Buffer Stereo
Yeah the thing is, the RTSS is huge. Your feature has an extremely small amount of code. Therefore, I really don't see the point for a build option. Having to manually fiddle with the build for something trivial like that is not a good idea.
-
- Kobold
- Posts: 26
- Joined: Thu Nov 07, 2013 5:11 am
- Location: Guayaquil
Re: OGRE and Quad Buffer Stereo
Hello Christian,
https://bitbucket.org/crefvik/ogre
might be ogre 1.9. or 1.10 I was working on version 1.8.1 and I had to do the overlay modification to my project to work with the ogre I downloaded from your link.
I searched the cmakelist for the OGRE_STEREO_ENABLE option and didn't find it. Also, your last comment on bitbucket was
The source I got from this link:You also need to make sure that you are using the v1-8 branch
https://bitbucket.org/crefvik/ogre
might be ogre 1.9. or 1.10 I was working on version 1.8.1 and I had to do the overlay modification to my project to work with the ogre I downloaded from your link.
I searched the cmakelist for the OGRE_STEREO_ENABLE option and didn't find it. Also, your last comment on bitbucket was
thanksMerge v1-9 to v1-10
-
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
Re: OGRE and Quad Buffer Stereo
This must be a build time option because it depends on NV / AMD headers which we do not include in our prebuilds. Also our StateCache is a compiletime option which also not huge - not everybody need QuadBufferStereo the prebuilds are for the main stream.
-
- Kobold
- Posts: 26
- Joined: Thu Nov 07, 2013 5:11 am
- Location: Guayaquil
Re: OGRE and Quad Buffer Stereo
does this work for nvidia 3d vision under linux? quad GPU
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: OGRE and Quad Buffer Stereo
The headers are only needed for the DirectX implementation. GL supports it natively, so for the GL version at least, we could make the default option "On". Or better yet, remove the option and add another option ENABLE_DIRECTX_STEREO. Also, you can check in CMake if the headers are found and if so, enable the option automatically (which is how most CMake build options work).This must be a build time option because it depends on NV / AMD headers which we do not include in our prebuilds
StateCache is still a compile option because it was (and perhaps on some platforms still is) buggy (masterfalcon answered this somewhere).
-
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
Re: OGRE and Quad Buffer Stereo
Without any testing on our side this will still stay a compile time option for 1.10 and optional. The state cache is optional because we need a ground truth for testing it was my idea to create a NullStateCacheManager in the first so we do not break too much in the first iteration and it still has bugs - so it means its not stable and should stay optional until we are 200% sure it wont break anything.
-
- Kobold
- Posts: 25
- Joined: Sat Jul 13, 2013 1:12 am
- x 5
Re: OGRE and Quad Buffer Stereo
Hi v3_xd,
https://bitbucket.org/crefvik/ogre/src?at=v1-8
https://bitbucket.org/crefvik/ogre/commits/branch/v1-8
You should be able to look at the source code and any code wrapped around OGRE_STEREO_ENABLE belongs to the feature.
However, I did not use the NVIDIA 3DVision glasses. However, my understanding is that you would need to install the Linux USB driver for the 3DVision glasses and they should work. If you are finding this is not the case, I can try it. I have both the 3DVision and 3DVision Pro glasses. Let me know the hardware you are using.
Thanks,
Christian
The source and the commits can be found below:I searched the cmakelist for the OGRE_STEREO_ENABLE option and didn't find it
https://bitbucket.org/crefvik/ogre/src?at=v1-8
https://bitbucket.org/crefvik/ogre/commits/branch/v1-8
You should be able to look at the source code and any code wrapped around OGRE_STEREO_ENABLE belongs to the feature.
I have tested Linux (Ubuntu 12.04 LTS) using OpenGL quad buffer stereo using an NVIDIA Quadro 4000. I used the Onboard DIN connector to enable the stereo output, as shown below.does this work for nvidia 3d vision under linux? quad GPU
However, I did not use the NVIDIA 3DVision glasses. However, my understanding is that you would need to install the Linux USB driver for the 3DVision glasses and they should work. If you are finding this is not the case, I can try it. I have both the 3DVision and 3DVision Pro glasses. Let me know the hardware you are using.
Thanks,
Christian
You do not have the required permissions to view the files attached to this post.
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: OGRE and Quad Buffer Stereo
As crefvik wrote, his code doesn't enable stereo unless you request it in the parameters. So it is optional in any case.Wolfmanfx wrote:Without any testing on our side this will still stay a compile time option for 1.10 and optional.
One level of indirection is enough here. The process for testing should be "change your program's code to set the Stereo option to true", rather than "change build option, recompile Ogre, then change your program's code". With the latter, it's unlikely to receive much testing at all, tbh.
I'm not completely sure about your point with NV/AMD headers not being included in the SDK (what's the reason for that? Are they too big?), so that may warrant a build option on the DX side, but on the GL side where it's natively supported: please do not hide features behind a build option unless you absolutely need to.
-
- Kobold
- Posts: 26
- Joined: Thu Nov 07, 2013 5:11 am
- Location: Guayaquil
Re: OGRE and Quad Buffer Stereo
Hi Christian,
I have tested the code and it works well for me. Thanks for sharing
I have tested the code and it works well for me. Thanks for sharing
-
- Greenskin
- Posts: 114
- Joined: Mon Oct 14, 2013 1:41 am
- Location: Chile
- x 3
Re: OGRE and Quad Buffer Stereo
Hi!
I've implemented the Stereo Vision Manager of this post, I still haven't ported it to Ogre 1.8 or even 1.9:
http://www.ogre3d.org/forums/viewtopic.php?f=5&t=32284
So, may I ask what is the difference of this new Quad Buffer Stereo compared to the older version I mentioned above? is it faster, more accurate, more realistic, or just newer?
Don't take me wrong, I'm just asking...
Besides, is this new code easily portable to Ogre 1.9??
I've implemented the Stereo Vision Manager of this post, I still haven't ported it to Ogre 1.8 or even 1.9:
http://www.ogre3d.org/forums/viewtopic.php?f=5&t=32284
So, may I ask what is the difference of this new Quad Buffer Stereo compared to the older version I mentioned above? is it faster, more accurate, more realistic, or just newer?
Don't take me wrong, I'm just asking...
Besides, is this new code easily portable to Ogre 1.9??
Integrated: Ogre3D + dotScene (Blender loader) + MyGUI (UI) + RakNet (Client/Server) + Leap Motion (The future is here!) + StereoManager (3D Anaglyph red-cyan)
WIP: StereoManager (Real 3D) + CCS (Camera Control System) + Sound, experimenting with Android.
WIP: StereoManager (Real 3D) + CCS (Camera Control System) + Sound, experimenting with Android.
-
- Kobold
- Posts: 25
- Joined: Sat Jul 13, 2013 1:12 am
- x 5
Re: OGRE and Quad Buffer Stereo
Hi RigoCL,
The way I supported OGRE stereo was in my design document that I posted at the top of this thread. Basically I wanted allow the developer to create two separate viewports and indicate whether each viewport is dedicated to the left buffer or the right buffer. This also allows the application to support a unique camera and frustum per eye. Also, if you create multiple viewports, you can also create a stereo PIP window. Also, allowing the application to control the left and right buffer setting on the viewport solves the swapped eyes problem which is a common problem with frame sequential (ie. quad buffer) displays. There is also a flag to indicate whether stereo is supported in case the user moves the window from a stereoscopic display to a non-stereoscopic display, which is common in multi-monitor system setups. Render system wise I supported both Direct3D and OpenGL so you can easily use either implementation.
How did you implement stereo in your patch? Is it similar? I certainly appreciate any feedback - especially if you have stereo knowledge
If you have any questions about the implementation, please let me know.
Thanks,
Christian
I didn't look at your patch, but from the post it looks like you support anaglyph stereo. The first version I'm posting supports quad buffer, so I could try to work with you in order to incorporate anaglyph.So, may I ask what is the difference of this new Quad Buffer Stereo compared to the older version I mentioned above? is it faster, more accurate, more realistic, or just newer?
Don't take me wrong, I'm just asking...
The way I supported OGRE stereo was in my design document that I posted at the top of this thread. Basically I wanted allow the developer to create two separate viewports and indicate whether each viewport is dedicated to the left buffer or the right buffer. This also allows the application to support a unique camera and frustum per eye. Also, if you create multiple viewports, you can also create a stereo PIP window. Also, allowing the application to control the left and right buffer setting on the viewport solves the swapped eyes problem which is a common problem with frame sequential (ie. quad buffer) displays. There is also a flag to indicate whether stereo is supported in case the user moves the window from a stereoscopic display to a non-stereoscopic display, which is common in multi-monitor system setups. Render system wise I supported both Direct3D and OpenGL so you can easily use either implementation.
How did you implement stereo in your patch? Is it similar? I certainly appreciate any feedback - especially if you have stereo knowledge
Yes, but right now I've got it working in 1.8 and the latest default. I can port it to 1.9, if you're interested.Besides, is this new code easily portable to Ogre 1.9??
If you have any questions about the implementation, please let me know.
Thanks,
Christian