Thanks Robert for the detailed analysis. This is very helpful.
Is there a way for me to directly access the slave cameras in my Viewer object,
so I could, in the short term, hack in a change to the colorMasks, and thus
perhaps not need to recompile OpenSceneGraph?
Longer term, it might be nice to add an API for setting the color mask, in
DisplaySettings. The most direct approach would be to add methods something like
Code:
DisplaySettings.setLeftAnaglyphColorMask(bool, bool, bool)
Passing a bunch of boolean values like that smells a little bad, but it would
expose the full constellation of possibilities presented by the underlying
glColorMask() approach. I'm not sure what the corresponding getter method would
look like.
Regards,
Christopher
robertosfield wrote:
HI Christopher,
Currently the ANAGLYPHIC stereo support is hardwired to red-cyan. Curiously
you are the first to ask for anything else.
To implement for other interpretations of anaglyphic you'd need to implement
it using osgViewer::View slave Camera's, one slave Camera for the left eye
and one for the right - you'd attach the appropriate osg::ColorMask for each
slave Camera to get the effect you want.
The code that sets up stereo in svn/trunk can be found in
OpenSceneGraph/src/osgViewer/View.cpp assignStereoOrKeystoneToCamera(..)
method, the code block of interest looks like:
switch(ds-getStereoMode())
{
case(osg::DisplaySettings::QUAD_BUFFER):
{
// disconect the camera from the graphics context.
camera-setGraphicsContext(0);
// left Camera left buffer
osg::ref_ptrosg::Camera left_camera = assignStereoCamera(ds,
gc.get(), 0, 0, traits-width, traits-height, traits-doubleBuffer ?
GL_BACK_LEFT : GL_FRONT_LEFT, -1.0);
left_camera-setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
left_camera-setRenderOrder(osg::Camera::NESTED_RENDER, 0);
// right Camera right buffer
osg::ref_ptrosg::Camera right_camera = assignStereoCamera(ds,
gc.get(), 0, 0, traits-width, traits-height, traits-doubleBuffer ?
GL_BACK_RIGHT : GL_FRONT_RIGHT, 1.0);
right_camera-setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
right_camera-setRenderOrder(osg::Camera::NESTED_RENDER, 1);
You could implement this without going via the osg::DisplaySettings/default
configuration, the other alternative would be to extend DisplaySettings and
the View.cpp code to handle customization of the anaglyphic settings.
Robert.
On 31 July 2014 16:07, Christopher Bruns () wrote:
Hi,
Is it possible to display stereo 3D rendering for green-magenta anaglyph
glasses in OpenSceneGraph? (as opposed to red-cyan glasses)
I can get stereo working well with old-fashioned red-(blue-cyan) glasses.
Is there a way to change the color settings of anaglyph mode?
Below is a complete twelve line python program that renders in stereo for
red/cyan glasses.
Code:
from osgswig import osg, osgDB, osgViewer, osgGA
print %d.%d.%d % (osg.OSG_VERSION_MAJOR, osg.OSG_VERSION_MINOR,
osg.OSG_VERSION_PATCH) # prints 3.2.1
cow = osgDB.readNodeFile(cow.osg)
# Use custom DisplaySettings to create a stereoscopic view
display_settings = osg.DisplaySettings()
display_settings.setStereoMode(osg.DisplaySettings.ANAGLYPHIC) # Red-cyan
ONLY !?!?
display_settings.setStereo(True)
viewer = osgViewer.Viewer()
viewer.setSceneData(cow)
viewer.setUpViewInWindow(100, 100, 500, 500, 1)
viewer.setDisplaySettings(display_settings)
viewer.run()
How would I modify this program to display stereo for modern green-magenta
filtered glasses?
Thank you!
Cheers,
Christopher
___
osg-users mailing list
()
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
(http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
--
Post generated by Mail2Forum
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=60526#60526
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org