Frame Synchronisation Issues

Please don't post Bullet support questions here, use the above forums instead.
User avatar
MrPuff
Posts: 14
Joined: Wed Oct 27, 2010 8:16 pm

Frame Synchronisation Issues

Post by MrPuff »

Hi, I've got a problem with my game at the moment which uses bullet physics, basically every now and then the game will jutter a bit as if the interpolation has gone wrong, I can't quite put my finger on the problem but if I describe my render loop below maybe one of you will be able to explain whats going on?

Okay so the render loop is called as fast as possible.

Also I am getting matrix transforms from motion states.

Here's the render loop:
//Render Game World
void GameWorld::Render(float interp)
{
//Tick Bullet Physics
BulletPhysics().Update();

RenderSystem().ClearRender();
RenderSystem().BeginRender();

/* Render SceneNode Graph */
SceneGraph().ChainRender();

/* Render Particle System */
ParticleSystem().Render(interp);

RenderSystem().EndRender();
RenderSystem().ShowRender();
}
Basically when I call "BulletPhysics().Update();" this is whats happening:

void BulletPhysics::Update()
{
const double dt = m_clock.getTimeMicroseconds() * 0.000001;
m_clock.reset();
m_dynamicsWorld->stepSimulation(btScalar(dt));
}

So why am I getting this strange, what I assume is, a frame synchronisation error? If you need any more information please do not hesitate to ask! :P
User avatar
MrPuff
Posts: 14
Joined: Wed Oct 27, 2010 8:16 pm

Re: Frame Synchronisation Issues

Post by MrPuff »

Can no one see a problem, should I not be getting these frame jutter issues? Have I not provided enough information? :S
bone
Posts: 231
Joined: Tue Feb 20, 2007 4:56 pm

Re: Frame Synchronisation Issues

Post by bone »

I'd probably log out your ETs and DTs into a file, play the game until you see the jutter, then stop and graph out the data real quick. Hopefully the jutter will stick out like a sore thumb.

My experience is that (for whatever reason) you've got a slowly drawn frame with a much bigger than usual DT, rather than some problem with the interpolation. I could be wrong.
User avatar
MrPuff
Posts: 14
Joined: Wed Oct 27, 2010 8:16 pm

Re: Frame Synchronisation Issues

Post by MrPuff »

ET is Elapsed Time and by DT you mean Delta Time?

If this is the problem, then something making the renderer hickup. Probably a cache issue?
bone
Posts: 231
Joined: Tue Feb 20, 2007 4:56 pm

Re: Frame Synchronisation Issues

Post by bone »

Yes, delta time. If indeed the problem is a slow graphics frame, the hard part will be figuring out why. I'm not a graphics expert nor do I know what you're rendering, but there's a long list of possible causes: cache misses for either RAM or video textures, vsync issues, another high-priority app running, (are the jutters evenly space in time or totally random?), etc. Any chance other parts of your game, including the physics, could have some heavy occasional processing, like a big collision happening?

These are just ideas, but first you want to confirm if it's actually a slow graphics frame or some other interpolation problem (but I haven't personally heard of any Bullet problems in that area).
User avatar
MrPuff
Posts: 14
Joined: Wed Oct 27, 2010 8:16 pm

Re: Frame Synchronisation Issues

Post by MrPuff »

So I limited the game to 60 fps and did as you said:
ET: 76016 - DT: 0.014496
ET: 76034 - DT: 0.018425
ET: 76049 - DT: 0.014872
ET: 76068 - DT: 0.018344
ET: 76082 - DT: 0.014911
ET: 76101 - DT: 0.018505
ET: 76116 - DT: 0.014697
ET: 76134 - DT: 0.018464
ET: 76149 - DT: 0.014819
ET: 76168 - DT: 0.018508
ET: 76182 - DT: 0.014807
76201: Interest Point Triggered.
ET: 76201 - DT: 0.018741
ET: 76216 - DT: 0.014633
ET: 76234 - DT: 0.018416
ET: 76249 - DT: 0.014851
ET: 76267 - DT: 0.018396
ET: 76282 - DT: 0.014864
ET: 76301 - DT: 0.018627
ET: 76316 - DT: 0.014739
ET: 76334 - DT: 0.018465
ET: 76349 - DT: 0.014756
ET: 76368 - DT: 0.018594
ET: 76382 - DT: 0.014735
ET: 76401 - DT: 0.018453
ET: 76416 - DT: 0.014866
ET: 76434 - DT: 0.018396
ET: 76449 - DT: 0.014898
ET: 76467 - DT: 0.018370
ET: 76482 - DT: 0.014897
ET: 76501 - DT: 0.018710
ET: 76516 - DT: 0.014603
ET: 76534 - DT: 0.018525
ET: 76549 - DT: 0.014767
ET: 76567 - DT: 0.018468
ET: 76582 - DT: 0.014854
ET: 76601 - DT: 0.018430
ET: 76616 - DT: 0.014908
ET: 76634 - DT: 0.018442
ET: 76649 - DT: 0.014841
ET: 76667 - DT: 0.018375
ET: 76682 - DT: 0.014898
ET: 76701 - DT: 0.018458
ET: 76716 - DT: 0.014820
ET: 76734 - DT: 0.018466
ET: 76749 - DT: 0.014834
ET: 76767 - DT: 0.018509
ET: 76782 - DT: 0.014804
ET: 76801 - DT: 0.018495
615: Interest Point Triggered.
ET: 76816 - DT: 0.014964
ET: 76834 - DT: 0.018792
ET: 76849 - DT: 0.014451
ET: 76867 - DT: 0.018368
ET: 76882 - DT: 0.014817
ET: 76901 - DT: 0.018517
ET: 76915 - DT: 0.014831
ET: 76934 - DT: 0.018535
ET: 76949 - DT: 0.014999
ET: 76967 - DT: 0.018231
ET: 76982 - DT: 0.014806
ET: 77001 - DT: 0.018522
ET: 77015 - DT: 0.014782
ET: 77034 - DT: 0.018398
ET: 77049 - DT: 0.014932
ET: 77067 - DT: 0.018348
ET: 77082 - DT: 0.014881
ET: 77101 - DT: 0.018623
ET: 77115 - DT: 0.014674
ET: 77134 - DT: 0.018540
ET: 77149 - DT: 0.014833
ET: 77167 - DT: 0.018445
ET: 77182 - DT: 0.014798
ET: 77201 - DT: 0.018496
ET: 77215 - DT: 0.014838
ET: 77234 - DT: 0.018384
ET: 77249 - DT: 0.014964
ET: 77267 - DT: 0.018438
ET: 77282 - DT: 0.014817
485: Interest Point Triggered.
ET: 77301 - DT: 0.018859
ET: 77315 - DT: 0.014455
ET: 77334 - DT: 0.018410
ET: 77349 - DT: 0.014824
ET: 77367 - DT: 0.018626
ET: 77382 - DT: 0.014722
ET: 77400 - DT: 0.018474
ET: 77415 - DT: 0.014811
ET: 77434 - DT: 0.018509
ET: 77449 - DT: 0.014826
ET: 77467 - DT: 0.018364
ET: 77482 - DT: 0.014859
ET: 77501 - DT: 0.018641
ET: 77517 - DT: 0.016440
ET: 77532 - DT: 0.014900
ET: 77550 - DT: 0.018384
ET: 77565 - DT: 0.014884
ET: 77584 - DT: 0.018541
ET: 77599 - DT: 0.014778
ET: 77617 - DT: 0.018600
ET: 77632 - DT: 0.014687
ET: 77650 - DT: 0.018580
ET: 77665 - DT: 0.014722
ET: 77684 - DT: 0.018468
ET: 77699 - DT: 0.014903
ET: 77717 - DT: 0.018369
ET: 77732 - DT: 0.014921
ET: 77750 - DT: 0.018389
ET: 77765 - DT: 0.014835
ET: 77784 - DT: 0.018465
ET: 77798 - DT: 0.014880
ET: 77817 - DT: 0.018503
ET: 77832 - DT: 0.014857
ET: 77851 - DT: 0.018842
ET: 77865 - DT: 0.014444
ET: 77884 - DT: 0.018477
ET: 77898 - DT: 0.014812
ET: 77917 - DT: 0.018366
631: Interest Point Triggered.
ET: 77932 - DT: 0.014983
ET: 77950 - DT: 0.018426
ET: 77965 - DT: 0.015035
ET: 77984 - DT: 0.018238
ET: 77998 - DT: 0.014812
ET: 78017 - DT: 0.018471
ET: 78032 - DT: 0.014834
ET: 78050 - DT: 0.018564
ET: 78065 - DT: 0.014714
ET: 78083 - DT: 0.018436
ET: 78098 - DT: 0.014901
ET: 78117 - DT: 0.018359
ET: 78132 - DT: 0.014914
ET: 78150 - DT: 0.018455
ET: 78165 - DT: 0.014807
ET: 78183 - DT: 0.018551
ET: 78198 - DT: 0.014792
ET: 78217 - DT: 0.018477
ET: 78232 - DT: 0.014791
ET: 78250 - DT: 0.018506
ET: 78265 - DT: 0.014780
ET: 78283 - DT: 0.018426
ET: 78298 - DT: 0.014962
ET: 78317 - DT: 0.018433
ET: 78332 - DT: 0.014942
ET: 78350 - DT: 0.018738
ET: 78365 - DT: 0.014487
ET: 78383 - DT: 0.018480
ET: 78398 - DT: 0.014772
ET: 78417 - DT: 0.018490
ET: 78432 - DT: 0.014777
ET: 78450 - DT: 0.018485
533: Interest Point Triggered.
ET: 78465 - DT: 0.014885
ET: 78483 - DT: 0.018455
ET: 78498 - DT: 0.014917
ET: 78517 - DT: 0.018382
ET: 78532 - DT: 0.014813
ET: 78550 - DT: 0.018436
ET: 78565 - DT: 0.014819
ET: 78583 - DT: 0.018524
ET: 78598 - DT: 0.014828
ET: 78617 - DT: 0.018482
ET: 78631 - DT: 0.014781
ET: 78650 - DT: 0.018808
ET: 78665 - DT: 0.014552
ET: 78683 - DT: 0.018439
ET: 78698 - DT: 0.014864
ET: 78717 - DT: 0.018400
ET: 78731 - DT: 0.014783
ET: 78750 - DT: 0.018424
ET: 78765 - DT: 0.014855
ET: 78783 - DT: 0.018511
ET: 78798 - DT: 0.014796
ET: 78816 - DT: 0.018440
ET: 78831 - DT: 0.014849
ET: 78850 - DT: 0.018618
ET: 78865 - DT: 0.015139
ET: 78883 - DT: 0.018083
ET: 78898 - DT: 0.014825
ET: 78916 - DT: 0.018396
ET: 78933 - DT: 0.016694
ET: 78948 - DT: 0.014784
ET: 78967 - DT: 0.018607
ET: 78982 - DT: 0.014985
ET: 79000 - DT: 0.018243
ET: 79015 - DT: 0.014818
ET: 79033 - DT: 0.018366
ET: 79048 - DT: 0.014917
ET: 79066 - DT: 0.018398
ET: 79081 - DT: 0.014871
ET: 79100 - DT: 0.018550
ET: 79116 - DT: 0.016602
ET: 79133 - DT: 0.016615
ET: 79148 - DT: 0.014818
701: Interest Point Triggered.
ET: 79166 - DT: 0.018567
ET: 79181 - DT: 0.014800
ET: 79200 - DT: 0.018477
ET: 79215 - DT: 0.014815
ET: 79233 - DT: 0.018446
ET: 79248 - DT: 0.014851
ET: 79266 - DT: 0.018440
ET: 79281 - DT: 0.014827
ET: 79300 - DT: 0.018681
ET: 79314 - DT: 0.014622
ET: 79333 - DT: 0.018479
ET: 79348 - DT: 0.014835
ET: 79366 - DT: 0.018528
ET: 79381 - DT: 0.014835
ET: 79400 - DT: 0.018483
ET: 79415 - DT: 0.014783
ET: 79433 - DT: 0.018422
ET: 79448 - DT: 0.014863
ET: 79466 - DT: 0.018393
ET: 79481 - DT: 0.014869
ET: 79500 - DT: 0.018637
ET: 79514 - DT: 0.014666
ET: 79533 - DT: 0.018532
ET: 79548 - DT: 0.014771
ET: 79566 - DT: 0.018438
ET: 79581 - DT: 0.014909
ET: 79600 - DT: 0.018448
ET: 79614 - DT: 0.014842
ET: 79633 - DT: 0.018436
ET: 79648 - DT: 0.014862
ET: 79666 - DT: 0.018501
ET: 79681 - DT: 0.014786
ET: 79700 - DT: 0.018522
ET: 79714 - DT: 0.014753
ET: 79733 - DT: 0.018484
ET: 79748 - DT: 0.014808
ET: 79766 - DT: 0.018437
ET: 79781 - DT: 0.014921
ET: 79799 - DT: 0.018457
ET: 79814 - DT: 0.014869
ET: 79833 - DT: 0.018409
ET: 79848 - DT: 0.014879
ET: 79866 - DT: 0.018512
ET: 79881 - DT: 0.015220
ET: 79900 - DT: 0.018114
ET: 79914 - DT: 0.014719
ET: 79933 - DT: 0.018495
ET: 79948 - DT: 0.014784
ET: 79966 - DT: 0.018452
ET: 79981 - DT: 0.014962
ET: 80000 - DT: 0.018690
ET: 80014 - DT: 0.014581
867: Interest Point Triggered.
ET: 80033 - DT: 0.018426
ET: 80048 - DT: 0.014844
ET: 80066 - DT: 0.018431
ET: 80081 - DT: 0.014815
ET: 80099 - DT: 0.018549
ET: 80114 - DT: 0.014728
ET: 80133 - DT: 0.018491
ET: 80148 - DT: 0.014836
ET: 80166 - DT: 0.018519
ET: 80181 - DT: 0.014824
ET: 80199 - DT: 0.018478
ET: 80214 - DT: 0.014799
ET: 80233 - DT: 0.018404
ET: 80247 - DT: 0.014899
ET: 80266 - DT: 0.018386
ET: 80281 - DT: 0.014880
ET: 80299 - DT: 0.018643
ET: 80314 - DT: 0.014651
ET: 80333 - DT: 0.018640
ET: 80347 - DT: 0.014659
ET: 80366 - DT: 0.018547
ET: 80381 - DT: 0.014824
ET: 80399 - DT: 0.018490
ET: 80414 - DT: 0.014783
ET: 80433 - DT: 0.018469
ET: 80447 - DT: 0.014836
ET: 80466 - DT: 0.018403
ET: 80481 - DT: 0.014877
ET: 80499 - DT: 0.018649
ET: 80514 - DT: 0.014629
ET: 80533 - DT: 0.018474
ET: 80549 - DT: 0.016651
ET: 80564 - DT: 0.014818
ET: 80583 - DT: 0.018539
ET: 80597 - DT: 0.014776
ET: 80616 - DT: 0.018461
ET: 80631 - DT: 0.015169
ET: 80649 - DT: 0.018400
ET: 80664 - DT: 0.014586
ET: 80684 - DT: 0.019810
ET: 80698 - DT: 0.013693
ET: 80716 - DT: 0.018260
ET: 80732 - DT: 0.016685
ET: 80749 - DT: 0.016567
ET: 80764 - DT: 0.014830
ET: 80782 - DT: 0.018534
ET: 80797 - DT: 0.014786
ET: 80816 - DT: 0.018462
ET: 80831 - DT: 0.014858
ET: 80849 - DT: 0.018616
ET: 80864 - DT: 0.014669
ET: 80882 - DT: 0.018554
ET: 80898 - DT: 0.015277
ET: 80916 - DT: 0.018010
ET: 80932 - DT: 0.016582
ET: 80949 - DT: 0.016614
ET: 80964 - DT: 0.014836
ET: 80982 - DT: 0.018514
ET: 80997 - DT: 0.014919
ET: 81016 - DT: 0.018670
ET: 81031 - DT: 0.014554
ET: 81049 - DT: 0.018506
ET: 81064 - DT: 0.014744
ET: 81082 - DT: 0.018464
ET: 81097 - DT: 0.014908
ET: 81116 - DT: 0.018364
ET: 81130 - DT: 0.014896
ET: 81149 - DT: 0.018429
ET: 81164 - DT: 0.014830
ET: 81182 - DT: 0.018570
1164: Interest Point Triggered.
ET: 81197 - DT: 0.014839
ET: 81216 - DT: 0.018463
ET: 81230 - DT: 0.014725
ET: 81249 - DT: 0.018548
ET: 81264 - DT: 0.014759
ET: 81282 - DT: 0.018431
ET: 81297 - DT: 0.014950
ET: 81316 - DT: 0.018374
ET: 81330 - DT: 0.014981
ET: 81349 - DT: 0.018473
ET: 81364 - DT: 0.014794
ET: 81382 - DT: 0.018471
ET: 81397 - DT: 0.014673
ET: 81416 - DT: 0.018472
ET: 81430 - DT: 0.014785
ET: 81449 - DT: 0.018548
ET: 81464 - DT: 0.014780
ET: 81482 - DT: 0.018477
ET: 81497 - DT: 0.014946
ET: 81516 - DT: 0.018398
ET: 81530 - DT: 0.014793
ET: 81549 - DT: 0.018414
ET: 81564 - DT: 0.014852
ET: 81582 - DT: 0.018463
ET: 81597 - DT: 0.014851
ET: 81615 - DT: 0.018430
ET: 81630 - DT: 0.014851
ET: 81649 - DT: 0.018498
ET: 81664 - DT: 0.014805
ET: 81682 - DT: 0.018412
ET: 81697 - DT: 0.015021
ET: 81715 - DT: 0.018387
ET: 81730 - DT: 0.014817
ET: 81749 - DT: 0.018396
ET: 81764 - DT: 0.014863
ET: 81782 - DT: 0.018527
ET: 81797 - DT: 0.014797
ET: 81815 - DT: 0.018479
ET: 81830 - DT: 0.014794
ET: 81849 - DT: 0.018680
ET: 81864 - DT: 0.014663
ET: 81882 - DT: 0.018491
ET: 81897 - DT: 0.014940
ET: 81916 - DT: 0.018803
ET: 81930 - DT: 0.014458
ET: 81949 - DT: 0.018375
ET: 81963 - DT: 0.014807
ET: 81982 - DT: 0.018499
ET: 81997 - DT: 0.014807
ET: 82015 - DT: 0.018555
ET: 82030 - DT: 0.015025
ET: 82049 - DT: 0.018266
ET: 82063 - DT: 0.014754
ET: 82082 - DT: 0.018488
ET: 82097 - DT: 0.015236
ET: 82116 - DT: 0.018513
ET: 82130 - DT: 0.014425
ET: 82149 - DT: 0.018397
ET: 82163 - DT: 0.014816
ET: 82182 - DT: 0.018538
ET: 82197 - DT: 0.014757
ET: 82215 - DT: 0.018561
ET: 82230 - DT: 0.014807
ET: 82249 - DT: 0.018500
ET: 82263 - DT: 0.014734
ET: 82282 - DT: 0.018459
ET: 82297 - DT: 0.014899
ET: 82315 - DT: 0.018456
ET: 82330 - DT: 0.014836
ET: 82348 - DT: 0.018367
ET: 82365 - DT: 0.016701
ET: 82380 - DT: 0.014969
ET: 82399 - DT: 0.018432
ET: 82413 - DT: 0.014819
ET: 82432 - DT: 0.018405
ET: 82447 - DT: 0.014880
ET: 82465 - DT: 0.018430
ET: 82480 - DT: 0.014826
ET: 82499 - DT: 0.018583
ET: 82513 - DT: 0.014719
ET: 82532 - DT: 0.018555
ET: 82548 - DT: 0.016571
ET: 82565 - DT: 0.016692
ET: 82580 - DT: 0.014837
ET: 82598 - DT: 0.018442
ET: 82613 - DT: 0.014861
ET: 82632 - DT: 0.018407
ET: 82647 - DT: 0.014849
ET: 82665 - DT: 0.018358
ET: 82680 - DT: 0.014917
ET: 82698 - DT: 0.018564
ET: 82713 - DT: 0.014818
ET: 82732 - DT: 0.018488
ET: 82746 - DT: 0.014738
ET: 82765 - DT: 0.018424
ET: 82780 - DT: 0.015002
ET: 82798 - DT: 0.018308
ET: 82813 - DT: 0.014917
ET: 82832 - DT: 0.018392
ET: 82846 - DT: 0.014827
ET: 82865 - DT: 0.018560
ET: 82880 - DT: 0.014781
ET: 82898 - DT: 0.018480
ET: 82913 - DT: 0.014865
ET: 82932 - DT: 0.018892
ET: 82946 - DT: 0.014395
ET: 82965 - DT: 0.018391
ET: 82980 - DT: 0.014926
ET: 82998 - DT: 0.018449
ET: 83013 - DT: 0.014866
ET: 83032 - DT: 0.018829
ET: 83047 - DT: 0.014750
ET: 83065 - DT: 0.018107
ET: 83080 - DT: 0.014823
ET: 83098 - DT: 0.018545
ET: 83113 - DT: 0.014794
ET: 83132 - DT: 0.018523
ET: 83146 - DT: 0.014721
ET: 83165 - DT: 0.018620
ET: 83180 - DT: 0.014822
ET: 83198 - DT: 0.018317
ET: 83213 - DT: 0.014911
ET: 83231 - DT: 0.018347
ET: 83246 - DT: 0.014866
ET: 83265 - DT: 0.018557
ET: 83280 - DT: 0.014784
ET: 83298 - DT: 0.018520
ET: 83313 - DT: 0.014773
ET: 83331 - DT: 0.018496
ET: 83346 - DT: 0.014773
ET: 83365 - DT: 0.018463
ET: 83380 - DT: 0.014896
ET: 83398 - DT: 0.018538
ET: 83413 - DT: 0.014792
ET: 83431 - DT: 0.018411
ET: 83446 - DT: 0.014798
ET: 83465 - DT: 0.018508
ET: 83480 - DT: 0.014806
ET: 83498 - DT: 0.018599
ET: 83513 - DT: 0.014776
ET: 83531 - DT: 0.018514
ET: 83546 - DT: 0.014702
ET: 83565 - DT: 0.018471
ET: 83580 - DT: 0.014904
ET: 83598 - DT: 0.018405
ET: 83613 - DT: 0.014937
ET: 83631 - DT: 0.018406
ET: 83646 - DT: 0.014794
ET: 83665 - DT: 0.018513
ET: 83679 - DT: 0.014785
ET: 83698 - DT: 0.018498
ET: 83713 - DT: 0.014819
ET: 83731 - DT: 0.018649
ET: 83746 - DT: 0.014631
ET: 83765 - DT: 0.018447
ET: 83779 - DT: 0.014899
ET: 83798 - DT: 0.018446
ET: 83813 - DT: 0.014885
ET: 83831 - DT: 0.018393
ET: 83846 - DT: 0.014818
ET: 83865 - DT: 0.018521
ET: 83879 - DT: 0.014809
ET: 83898 - DT: 0.018504
ET: 83913 - DT: 0.014792
ET: 83931 - DT: 0.018561
ET: 83946 - DT: 0.015173
ET: 83965 - DT: 0.018074
ET: 83979 - DT: 0.014826
ET: 83998 - DT: 0.018393
ET: 84013 - DT: 0.014925
ET: 84031 - DT: 0.018412
ET: 84046 - DT: 0.014911
ET: 84065 - DT: 0.018734
ET: 84079 - DT: 0.014517
ET: 84098 - DT: 0.018471
ET: 84113 - DT: 0.014811
ET: 84131 - DT: 0.018413
ET: 84146 - DT: 0.014772
ET: 84164 - DT: 0.018542
ET: 84181 - DT: 0.016660
ET: 84196 - DT: 0.014748
ET: 84214 - DT: 0.018532
ET: 84229 - DT: 0.014774
ET: 84248 - DT: 0.018468
ET: 84263 - DT: 0.014827
ET: 84281 - DT: 0.018440
ET: 84296 - DT: 0.014951
ET: 84314 - DT: 0.018477
ET: 84329 - DT: 0.014859
ET: 84348 - DT: 0.018413
ET: 84364 - DT: 0.016596
ET: 84381 - DT: 0.016638
ET: 84396 - DT: 0.014845
ET: 84414 - DT: 0.018590
ET: 84429 - DT: 0.014705
ET: 84448 - DT: 0.018504
ET: 84462 - DT: 0.014785
ET: 84481 - DT: 0.018485
ET: 84496 - DT: 0.014904
ET: 84514 - DT: 0.018464
ET: 84529 - DT: 0.014796
ET: 84548 - DT: 0.018410
ET: 84562 - DT: 0.014866
ET: 84581 - DT: 0.018531
ET: 84596 - DT: 0.014741
ET: 84614 - DT: 0.018540
ET: 84629 - DT: 0.014796
ET: 84648 - DT: 0.018479
ET: 84662 - DT: 0.014789
ET: 84681 - DT: 0.018505
ET: 84696 - DT: 0.014843
ET: 84714 - DT: 0.018493
ET: 84729 - DT: 0.014825
ET: 84748 - DT: 0.018485
ET: 84762 - DT: 0.014762
ET: 84781 - DT: 0.018534
ET: 84796 - DT: 0.014762
ET: 84814 - DT: 0.018624
ET: 84829 - DT: 0.014688
ET: 84847 - DT: 0.018486
ET: 84862 - DT: 0.014789
ET: 84881 - DT: 0.018467
ET: 84896 - DT: 0.014906
ET: 84914 - DT: 0.018445
ET: 84929 - DT: 0.014862
Search for "Interest" in this list, thats where I log the frame jitter issue happening.

It doesnt seem like the time between each render is the problem :S

I noticed when I lock the game to 60 fps whne the jitter happens it lasts longer and makes the game a lot slower as its happening.

There also doesnt seem to be a relation in how frequent the jitter occurs. The number before Interest Point is the delta time.
bone
Posts: 231
Joined: Tue Feb 20, 2007 4:56 pm

Re: Frame Synchronisation Issues

Post by bone »

MrPuff wrote:So I limited the game to 60 fps and did as you said:

:
:

It doesnt seem like the time between each render is the problem :S
Agreed.

OK, so maybe something about the actual interpolation is going wrong (as you originally suggested). I assume from your render loop that "particles" are the only moving items and they are being simulated with Bullet. How is the Bullet location of a particle interpolated to be a graphical location?
User avatar
MrPuff
Posts: 14
Joined: Wed Oct 27, 2010 8:16 pm

Re: Frame Synchronisation Issues

Post by MrPuff »

Particles are just point sprites, all of the bullet simulation models are in the Scene Graph.

I though it may have been cache inefficiency of the scene graph, but it wasnt!


This is whats called when I render a bullet physics object on each frame (im rendering vehicles):
(im using directx9)

Maybe there is a problem somewhere here?


MP_INLINE mat4::MATRIX4 CarInfo::GetChassisMatrix() const
{
btTransform t;
m_carChassis->getMotionState()->getWorldTransform(t);
return btConvertMatrix(&t);
}

This is the convert matrix function:
//Convert btMatrix to mat4::MATRIX4
mat4::MATRIX4 btConvertMatrix(const btTransform* transform)
{
mat4::MATRIX4 m;
btTransform t = *transform;

btMatrix3x3 bm = t.getBasis().transpose();
btVector3 p[4];

p[0] = bm.getRow(0);
p[1] = bm.getRow(1);
p[2] = bm.getRow(2);
p[3] = t.getOrigin();

m._11 = p[0].getX(); m._12 = p[0].getY(); m._13 = p[0].getZ(); // X axis
m._21 = p[1].getX(); m._22 = p[1].getY(); m._23 = p[1].getZ(); // Y axis
m._31 = p[2].getX(); m._32 = p[2].getY(); m._33 = p[2].getZ(); // Z axis

m._41 = p[3].getX();
m._42 = p[3].getY();
m._43 = p[3].getZ();

return m;
}



mat4::Matrix4 is basically:
//Data Members
float _11, _12, _13, _14;
float _21, _22, _23, _24;
float _31, _32, _33, _34;
float _41, _42, _43, _44;
bone
Posts: 231
Joined: Tue Feb 20, 2007 4:56 pm

Re: Frame Synchronisation Issues

Post by bone »

I don't immediately spot a problem there. But my question was how the interpolation was done. What uses the interpolation parameter and how does it?
User avatar
MrPuff
Posts: 14
Joined: Wed Oct 27, 2010 8:16 pm

Re: Frame Synchronisation Issues

Post by MrPuff »

Code: Select all

//Init Bullet Physics
void BulletPhysics::Init(Vector3 worldMin, Vector3 worldMax, float gravity)
{
	//Use defualt collision configuration
	m_collisionConfiguration = new btDefaultCollisionConfiguration();

	//Create collision dispatcher
	m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);

	//Create overlapping pair cache (use broadphase?)
	m_overlappingPairCache = new btAxisSweep3(btVector3(worldMin.x, worldMin.y, worldMin.z),
											  btVector3(worldMax.x, worldMax.y, worldMax.z));

	//Use Sequential Impulse Constraint Solver
	m_constraintSolver = new btSequentialImpulseConstraintSolver();

	//Create Dynamics World
	m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,
												  m_overlappingPairCache,
												  m_constraintSolver,
												  m_collisionConfiguration);

	//Register Collision Dispatcher with GImpact
	btCollisionDispatcher* dispatcher = static_cast<btCollisionDispatcher*>(m_dynamicsWorld->getDispatcher());
	btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher);

	//Set Gravity
	m_dynamicsWorld->setGravity(btVector3(0, gravity, 0));
}
Thats what I do to intitialize bullet, how I tick it is in my first post, if theres a way of manually setting an interpolation methods I don't think im doing it?

This is my first time working with a physics engine I should mention!