Hello everyone.

We have been using OSG with nvidia physx for a driving simulation and we have 
jitter problem, where the cars and other objects in the scene (controlled by 
the physics) jitter annoyingly :). We believe that we update the scenegraph in 
a wrong way.

In our code : 
There is a physx thread.
There is an OSG library thread where we can add new entities, remove them, 
start rain effects, call an animation of a skeleton character etc. 
There is an OSG render loop thread, where osgviewer::...frame() is called.

Our Nvidia physx thread produces new "x y z pitch head roll" values for the 
scene entities at 60Hz (or any other frequency we want). 
Physx thread calls the updateEntity() function of our OSG library thread.
This function simply updates scene entities with matrixtransform::void 
setMatrix(const Matrix& mat).

In other words, we move an object with this chunk of code:

Code:
osg::Matrixd mxT = createTransformMatrix(x,y,z,h,p,r);
mt->setMatrix(mx);



Here what we tried:
1-we fed OSG lib directly whenever a physx output is produced (every 16.6 ms or 
so - 60Hz): there is jitter.
2-we maintained a queue of frames on OSG lib, fed OSG at the end of each 
frame() : there is jitter.
3-we implemented a sampling mechanism on this queue, where OSG requests the 
interpolated frame from the queue for the current timestamp : there is jitter.
4-we saved a few minutes long log of the physx to a file  (many frames). 
Started a dummy thread, and fed OSG from this log. : there is jitter.

When OSG works with 60FPS, and physx thread is running at 60Hz, there seems to 
be quite low jitter (sometimes unnoticeable) .

Thanks in advance for any hints or advices.
Arif Yetkin

------------------------
http://www.youtube.com/watch?v=naX3hOkDx8w

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35912#35912





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to