OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Cylinder/Skydome flicker when using CompositeView


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgOcean [osgOcean]
View previous topic :: View next topic  
Author Message
bstru
Newbie


Joined: 05 Feb 2015
Posts: 3

PostPosted: Tue Mar 17, 2015 10:04 pm    Post subject:
Cylinder/Skydome flicker when using CompositeView
Reply with quote

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]
Back to top
View user's profile Send private message
bstru
Newbie


Joined: 05 Feb 2015
Posts: 3

PostPosted: Wed Mar 18, 2015 9:30 pm    Post subject:
Reply with quote

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
Back to top
View user's profile Send private message
Paradox
Appreciator


Joined: 19 Apr 2010
Posts: 127

PostPosted: Tue Jun 30, 2015 9:50 am    Post subject:
Reply with quote

Hi,

...same or similar problem here...have you found some workaround or solution?

In particular, this happens with one camera also, for me (without composite viewer). If the cylinder radius is around 2000, when I place an object around 4000 I can see the sky behind in some camera setup. In practice, it's impossible to move object over 2000 units from 0 without this problem. If I set the cylinder value over 2000 the problem is visible also even if the distance setted is low (for example, cylinder at 20.000 and object in 0 show the sky behind underwater).

Thank you!

Cheers,
Dario
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgOcean [osgOcean] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Visual flicker when using multi-pass ... hartwigw General 3 Sat Jan 07, 2017 6:21 pm View latest post
No new posts How to draw 3D cylinder and 3D band? Daven Hem General 2 Wed Jan 04, 2017 1:44 am View latest post
No new posts compositeview and offscreen rendering p3m4n General 9 Sat Jan 16, 2016 7:59 am View latest post
No new posts I created 10000 cylinder, osg run ver... calvin General 10 Tue Jul 21, 2015 1:22 am View latest post
No new posts Cylinder underwater problem with dime... Paradox osgOcean [osgOcean] 1 Tue Jun 30, 2015 10:40 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP