I have a cinematic with a motion event. Everything works fine if I have Vsync enabled and play it in any resolution eg. 1920 x 1080. Once I enabled fullscreen mode with the same resolution (1920 x 1080) the cutscene suddenly starts lagging a bit. The motion of the spatial is nor really fluent and you clearly see that it moves forward a bit and the teleports backwards a bit and moves forward again and so on… Once I disable Vsync it works fluently in Fullscreen mode but I got really bad glitches. It is not framerate dependent though, I always lock the framerate to 60 FPS via the settings and my monitor has a refresh rate of 60 Hz. What should I do to reduce the lag?
do you experience this with the stock test case?
No I don’t experience it with the test case. But I think my spatial moves a bit faster in my game so that might be the cause. Interestingly the problem sometimes is really noticeable and sometimes you can just barely see it. But it really is not that much of a problem. I remember I had the same problem half a year ago or so but I dropped the cutscenes I had back then. There I also had something moving but it wasn’t really fast (faster than in the test case though).
Could you provide a test case?
Okay when I made a simple cutscene in an empty scene everything worked fine (no matter how fast the spatial would move). So I guess I am somehow responsible for it in my game. I probably use more resources in my game than I do in a simple test scene so that might be the issue? The strange thing is that there really is no problem at all when I’m not in Fullscreen mode… It ain’t that a big problem but it still is strange…
Could you maybe shoot a video that exhibits the issue? So i get an idea of what we are dealing with?
Maybe make a small test if all the constants in jME are still what they should be.
System.out.println(“Problem with Vector3f.ZERO!”);
You lock the framerate AND use vsync? …that could be problematic I guess.
Otherwise, you might do a check to see if your tpf is ever going backwards or something… but it really does start to sound like something else strange in your code. Like maybe mutual cascading updates are competing with each other or something.
The constants are what they should be and without locking the framerate it gets even worse…
If I set the refresh rate to 59 Hz instead of 60 Hz everything is alright… But the internet tells my monitor has a refresh reate of 60 Hz. This is getting quite weird now. I am not quite sure if that fix is gonna work for every pc/monitor.
Here is a video but you can’t really see it due to the crappy quality… At the beginning there is a liitle jittery in the movement:
I’m still not clear from your message if you are still setting vsync or not.
vsync = automatically synched to monitor refresh. If you are also limiting the frame rate then the two might compete. With vsync on there in no need to limit the frames. So it might be important to make sure we are talking about appSettings.setFrequency() or appSettings.setFrameRate().
Your video does look strange but maybe if you dump the tpf to System.out.println() you will see spikes or something. To me the issue looks like a bunch of pauses and catch-ups.
It works with
If I call setFrameRate(60) instead of 59 I get the issue. If I don’t call setFrameRate() at all (still with Vsync enabled) I also get the issue. So I could just go with setFrameRate(59) but I don’t know if that’s just a workaround for my setup or if this is gonna work on all machines…
The tpf seem to be quite constant (this is just a snippet):
0.016824408 0.016469989 0.016670452 0.020772714 0.013138465 0.016541513 0.01660021 0.016710222 0.016653132 0.016663395 0.01666949 0.016774049 0.016567172 0.01672113 0.016800992 0.016702846 0.016472874 0.016780464 0.016527722 0.016673338 0.016614964 0.01668232 0.016647037 0.01701332 0.01670894 0.016562361 0.016664358 0.016619133
I printed them without setting the framerate at all and vsync enabled; I could clearly see the ‘lag’.
what if you entirely remove the setFrameRate and just keep the setVSync?
I still get the issue then.