Hi, To clarify my last message, my point is that you get correct frame with interpolation, but by the time frame rendered your simulation results outdated. Follow this basic example: we render scene where box moving with 10 m\s 1st frame: box in initial position, frame rendered in 0.1 sec 2nd frame: box traveled 1m (simulation time 0.1 sec from start), frame rendered in 0.05 sec 3rd frame: box traveled 0.5m more (simulation time 0.05 from last frame), frame rendered in 0.15 sec etc... Now think about how do we see results of this render on display: there are delay of 0.05 sec between 1 and 2 frames as we see them, and box path is 1m, so as we see it on screen box speed seems to be 20m/s there are delay of 0.15 sec between 2 and 3 frames as we see them, and box path is 0.5m, so as we see it on screen box speed seems to be 6.6m/s Thats what i was talking about. If you have one frame delayed for some time, that will look like box almost stopped and then jumped forward. You dont actually need to cap framerate, you need smooth framerate, when frame time changes slowly then this problem almost unnoticable.
27.01.2011, 17:47, "Arif Yetkin Sarı" <[email protected]>: > Hi again > I got what you meant hybr. As i said, When my fps is the same with physx > freq, it all works well. However, > The thing is my slowest fps is like 20 - 25 on simulation, so i cannot cap > OSG to always work at that slow rates. > > So, i implemented an interpolation mechanism to get a generated frame for a > requested timestamp. I thought, in this way: > whatever freq physics and OSG run at, OSG will get a correct frame with > interpolation. But somehow, when > interpolation is active, it causes additional jittering! I think > interpolation between frames takes more time > than i think, and delays the frame() call. > > Additionally, > > I implemented a test bed. In my test bed, i just read a physx log file, and > created > the same scene of our driving simulation with OSG. Then I updated the cars' > pos and > ori at each frame with regards to physx data. There is still jitter if fps > changes. > But, there is almost no jitter when both physx and osg works in perfectly > 60Hz. > > In the test bed, before the rendering starts, each frame on the physx log is > placed > in a queue. *What i mean by frame: it is a snapshot of physics world (all > entities) > at every 16.6 ms (60Hz) timestamps. And since my osg works with 60 fps in my > test bed, > and since after every time viewer->frame() function is called OSG dequeued > another > frame and updated the entity matrices, there is no jittering. However if the > fps drops > somehow, there is a slow down in motions, it is completely comprehensable > because it consumes a > 60Hz physics output in a slower Hz, when fps drops. > > In our simulation I implemented the same queue to store the incoming frames, > and consume them > when the frame() ends. My strategy is, if the queue is empty, i simply do not > update the scene. > If the queue is filled more than 4 frames, i delete some of the old frames > and shrink the queue so that > we dont get a delay. However, this poses some little teleportations due to > frame drops when > OSG cannot consume the data, as expected. Thus i cannot use this method > either. > > After your comments and my experiments, I think, there are two problems why i > get lots > of jitter in our simulation. First of all, simulation fps fluctuates more > than the test bed, > that is between 25 - 60. This converts the occasional "slow down" of car > motion into a "jitter". > Second problem, sometimes our queue contains no frames and this means a > freeze, > on the contrary sometimes our queue is filled with too many frames, which > means > we teleport in time and dequeue some of them to prevent delay. > > In summary only perfect smoothness i get during my experiments is: > when the queue is filled with tooo many 60Hz generated frames beforehand and > my test bed runs at 60 fps, > it consumes the already generated(read from file) physics frames at the > correct time stamp. And everything is smooth. > > Still, anything I assume may prove wrong, so I am waiting for your feedback > guys. > > By the way, is the way I update my scenegraph ok ? (after each frame(), i > call matrixtransform->setmatrix(matrix) for all > entities.). These calls are out of the frame(), so i thought i would be safe. > Do you suggest me to use nodeupdatecallbacks ? > Does it make any difference ? > > Thanks. > > ------------------------ > http://www.youtube.com/watch?v=naX3hOkDx8w > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=36033#36033 > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

