http://openig.compro.net

A Opensource Image generator for the masses !
It is currently Mon Oct 18, 2021 9:01 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Shaking camera behaviour
PostPosted: Tue Aug 25, 2015 6:07 am 
Offline

Joined: Tue May 26, 2015 5:46 am
Posts: 21
Hi,

I am getting a weird camera behaviour while using main.cpp from oig project and adding a threaded UDP position updated.
I must say that udp reader is backed up by a mutex that has been tested to be working, so, X, Y, Z, head, pitch, roll are all updated at the same time, and the camera update doesn't conflict with that.
What happens is the following:
I edited default.txt so that it will only load the aircraft. In the first frame the aircraft is at frame 1, in the second frame it fastly blinks at the wrong position and then goes to the right position. And then it follows to frame 3 correctly. This behaviour happens randomly, so I think it could be related to the synchronization of the rendering.
In the main rendering loop,
Code:
  while (!viewer->done())
    {
//process windows messages
...
//update camera position
mutex.unlock();


osg::Matrix xyzhprMat = createMatrixExt( longitudeDegrees, latitudeDegrees, altitudeMeters, headingDegrees, pitchDegrees, rollDegrees);
view->getCamera()->setViewMatrix( osg::Matrixd::inverse(xyzhprMat) );

ig->frame();


I am updating the camera before ig->frame(). Maybe it should be done through some callback so that it won't create racing conditions. Have you seen such a problem?
Thanks in advance,
Baggio
Image


Top
 Profile  
 
PostPosted: Thu Aug 27, 2015 3:40 am 
Offline

Joined: Tue May 12, 2015 6:11 pm
Posts: 16
Hi Mr. Baggio,

can you try the same from the code instead of adding the models from the config default.txt? In oigdemo there is code for this commented out ...

Even better is to add the model in the scene when the first UDP packet arrives so you ensure for sure the model will be placed correctly


Top
 Profile  
 
PostPosted: Mon Aug 31, 2015 9:11 am 
Offline

Joined: Tue May 26, 2015 5:46 am
Posts: 21
Hi Nick,

I think my screenshot didn't correctly explain the problem. This behaviour happens every couple seconds, it does not seem to be related to the loading of the models.
When I use osgviewer, I don't see this problem, but, when receiving packets, the flickering is there, and when the whole terrain is loaded, the effect makes it look very bad.
Have you got UDP and camera behaviour working properly?

Thanks in advance,
Baggio


Top
 Profile  
 
PostPosted: Mon Aug 31, 2015 12:57 pm 
Offline

Joined: Tue May 12, 2015 6:11 pm
Posts: 16
Hi Mr. Baggio,

I apologize to get this wrong :-( ......

Let me answer your question. Yes, we have the udp networking working with entities across clusters - there is a demo and a plugin supporting this. This is planned for the next release - we are preparing some Triton work (ocean support in OpenIG) so this sort of slowed down a bit the release date. But I believe Keith we agree if we send you the current snapshot.

This problem was discussed at Compro and here are some hints from Curtis and Roni, since they have seen this in the past, not with OpenIG though but it is related:

1. The positional data had so much resolution that it would occasionally
round the values and cause the model to jump positions. Roni reduced
the resolution of the data to less digits and this solved this...

2. The update of the player was not in sync with the update from the ownship
causing the player to appear to move due to its update happening out of
sync with the ownship.....

I hope this gives an idea. Also, can you send some code producing this behaviour so we all look at this and come up with solution? Send it to Keith or me, you should have my email address

Let us know how it goes

Cheers,
Nick


Top
 Profile  
 
PostPosted: Mon Aug 31, 2015 2:39 pm 
Offline

Joined: Tue May 12, 2015 6:11 pm
Posts: 16
Hi again Mr. Baggio,

I spoke to Keith and we will send you the current snapshot (please, have in mind, this one is still beta) with the networking framework (the protocol independent library and the networking plugin) and you can see how we are using it well - might help you and you are welcome to use the code for your own needs. Please give me a day or two, you will get a link

Thanks for the support and the patience :-)

Cheers,
Nick


Top
 Profile  
 
PostPosted: Tue Sep 01, 2015 6:51 am 
Offline

Joined: Tue May 26, 2015 5:46 am
Posts: 21
That sounds great, Nick :)

Thank you for the support.


Top
 Profile  
 
PostPosted: Tue Sep 01, 2015 7:23 am 
Offline

Joined: Tue May 26, 2015 5:46 am
Posts: 21
Hi Nick, I hadn't seen your previous answer, here goes my comments:

>1. The positional data had so much resolution that it would occasionally
round the values and cause the model to jump positions. Roni reduced
the resolution of the data to less digits and this solved this...

I do believe this can happen, but it is not the case, since the objects go to the correct position in the next frame and the camera position is not altered.

>2. The update of the player was not in sync with the update from the ownship
causing the player to appear to move due to its update happening out of
sync with the ownship.....

In my example, there is no update of the object, only the camera is moving, that's why I believe the camera update is not in sync with OSG pipeline.

Thanks for the insights.


Top
 Profile  
 
PostPosted: Tue Sep 01, 2015 11:00 am 
Offline

Joined: Tue May 12, 2015 6:11 pm
Posts: 16
Hi Mr. Baggio,

while preparing a tarball for you, I noticed same behavior when you have a camera manipulator attached to a viewer and bound to an entity - well, for fighting for a position, only attaching a camera manipulator to the viewer is enough .... Can you check if this is not the case?

Nick

p.s. The tarball is ready just some final checks .. We will ping you over email


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group