Hi,
I'm using osgOcean in a multi-view, multi-graphics card configuration and I'm
encountering a problem with the ocean's cylinder and skydome causing
flickering effects.
Setup
My setup is that I have 6 cameras all looking into the same scene. They all
have the same position but different orientations and frustums. They all render
to different screens and they're all on their own graphics card. I've disabled
most advanced rendering effects such as:
Refractions
God rays
Silt
Underwater DOF
Glare
Distortion
I have the latest bits from the osgOcean repository and have no problem
compiling them. I'm using FFTSS 3.0.
Main Problem
My problem is that with multiple views and one ocean, I'm seeing that the
skydome and the cylinder tend to move around as if they're on a different
screen. For example, when I'm viewing the ocean at an angle (some degree of
roll), I tend to see one view's cylinder geometry appear on another view's
scene. This produces a brief one-frame flicker effect that is very distracting.
With the skydome, I imagine a similar problem is happening (due to how they're
both updated per view) but it just seems to flicker in and out of visibility.
Attempted Solution
I figured this was a threading issue where one thread would use the values of
another thread's operations. With that in mind, I added multiple
CameraTrackCallbacks to the ocean scene, each referencing the main camera of
one of the views. In operator(), I would check the stored Camera pointer
against the camera obtained through cv-getRenderStage()-getCamera() to see if
the pointers were equal. If so, I would continue to update the cylinder
position. If not, I would continue to traverse.
This seemed to work great for the skydome (no more flickering!) but not as well
for the cylinder.
Example code for adding a new CameraTrackCallback for the skydome:
Code:
void attachCamera(osg::Camera* camera) {
osg::MatrixTransform* transform = new osg::MatrixTransform;
transform-setDataVariance(osg::Object::DYNAMIC);
transform-setMatrix(osg::Matrixf::translate(osg::Vec3f(0.f, 0.f, 0.f)));
transform-setCullCallback(new CameraTrackCallback(camera));
transform-addChild(m_skyDome.get());
m_oceanScene-addChild(transform);
m_oceanScene-addCamera(camera);
}
Side Problem (with solution!)
A problem I did find a solution to was just using osgOcean with a Composite
Viewer set to ThreadPerContext or ThreadPerCamera. In OceanScene.cpp's
CameraTrackCallback::createOrReuseMatrix, I tended to get deletions on
allocated matrices that were already deleted within moments of running my app.
I threw in a mutex that would scope lock within the function which fixed this
but not the flicker.
Question
Has anyone else encountered this issue? Maybe I'm setting up my ocean wrong.
I'm using a modified version of the Scene in the oceanExample project to set up
the OceanScene.
Thank you!
Cheers,
Ben[/list]
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=63144#63144
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org