[osg-users] [osgOcean] Cylinder/Skydome flicker when using CompositeView

66 views
Skip to first unread message

Ben Strukus

unread,
Mar 17, 2015, 11:20:17 PM3/17/15
to osg-...@lists.openscenegraph.org
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-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Ben Strukus

unread,
Mar 18, 2015, 6:43:50 PM3/18/15
to osg-...@lists.openscenegraph.org
Hi,

I've done some more poking around and I've found out a few things.

If I disable the cylinder completely by simply not adding the _oceanCylinderMT child to the _oceanTransform group in OceanScene.cpp, then the flashing stops.

The flashing occurs over the water. The effect is seemingly random, but the color that is shown seems to be the _aboveWaterFogColor, which is odd because the cylinder uses the _underWaterWaterFogColor. I set the above to pure green and the under to pure red and the color that flashes is green.

The problem goes away if I reduce my cylinder/skydome size. My application requires a far viewing distance so I've set the respective sizes to 30,000. When I bump the size back down to 1,900 (as is set in the ocean example), the flashing doesn't occur. However, I'd like the flexibility to set my viewing distance to be much farther than 1,900.


Thank you!

Cheers,
Ben

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=63162#63162
Reply all
Reply to author
Forward
0 new messages