http://openig.compro.net
https://www.compro.net/openig_forum/

Shaking camera behaviour
https://www.compro.net/openig_forum/viewtopic.php?f=10&t=94
Page 1 of 1

Author:  baggiodlb [ Tue Aug 25, 2015 6:07 am ]
Post subject:  Shaking camera behaviour

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

Author:  trajce.nikolov.nick [ Thu Aug 27, 2015 3:40 am ]
Post subject:  Re: Shaking camera behaviour

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

Author:  baggiodlb [ Mon Aug 31, 2015 9:11 am ]
Post subject:  Re: Shaking camera behaviour

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

Author:  trajce.nikolov.nick [ Mon Aug 31, 2015 12:57 pm ]
Post subject:  Re: Shaking camera behaviour

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

Author:  trajce.nikolov.nick [ Mon Aug 31, 2015 2:39 pm ]
Post subject:  Re: Shaking camera behaviour

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

Author:  baggiodlb [ Tue Sep 01, 2015 6:51 am ]
Post subject:  Re: Shaking camera behaviour

That sounds great, Nick :)

Thank you for the support.

Author:  baggiodlb [ Tue Sep 01, 2015 7:23 am ]
Post subject:  Re: Shaking camera behaviour

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.

Author:  trajce.nikolov.nick [ Tue Sep 01, 2015 11:00 am ]
Post subject:  Re: Shaking camera behaviour

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

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/