Hello World: SpinCameraTask Jitter problem

I am just learning Panda3D and Python (I have programmed basic, C, C++, C# in the past)… and there is a definite issue with Jitter when running the hello world tutorial:

import direct.directbase.DirectStart
from direct.task import Task
from direct.actor import Actor
import math

#Load the first environment model
environ = loader.loadModel("models/environment")
environ.reparentTo(render)
environ.setScale(0.25,0.25,0.25)
environ.setPos(-8,42,0)

#Task to move the camera
def SpinCameraTask(task):
  angledegrees = task.time * 6.0
  angleradians = angledegrees * (math.pi / 180.0)
  base.camera.setPos(20*math.sin(angleradians),-20.0*math.cos(angleradians),3)
  base.camera.setHpr(angledegrees, 0, 0)
  return Task.cont

taskMgr.add(SpinCameraTask, "SpinCameraTask")

#Run the tutorial
run() 

My system is an Intel E8500 with 4 GB RAM, 1TB HD and ATI 4850. I would expect it to extremely well for a simple demo. Yet, I am experiencing a definite visual Jitter when running this tutorial.

I am also experiencing the same Jitter with the demo programs such as Ball in maze, and solar system etc…
The jitter appears to be around the same time as a heart beat… or second… so, every second or there is a “beat” of jitter.

I have also tested the same demo’s on a portable computer (core 2 duo, integrated gfx) and it has the same problem.

None of my regular games have this issue. It seems isolated to Panda3D programs.

Can anyone help to figure out how to get rid of this jitter?

Hmm, maybe it’s related to video syncing not being done correctly?
Edit your /etc/Config.prc (linux) or C:\Panda3D-1.5.4\etc\Config.prc file, add a line saying:

sync-video #f

and see if the jitter goes away (the fps should go above 60/70 now)

Yes, that fixed the problem.

FRAPS is also showing >1000 FPS now.

This will help me greatly in tweaking future programs!

Thank you very much.

P.S. I am amazed at how fast you were able to respond, do you have some kind of automated feature to let you know when there is a post? Or did you just happen to be cruising the forum?

Thanks, again!

Hmm, still weird why there’s a visible jitter. Video sync should synchronize to the monitor’s refresh rate meaning there should not be a difference between 1000 fps and the framerate you were getting.

I just hit up the forums every few minutes and this time there just happened to be a new post. :slight_smile:

I’ve seen that happen before. Some drivers sync to video framerate in a sloppy way that causes this visible jitter, especially with large windows. Disabling video sync fixes the problem, but then introduces all the problems you get with video sync disabled (tearing, etc.) Changing to fullscreen mode also solves the problem, without artifacts (but now you have to run fullscreen).

It’s worth trying to switch to DX9 to see if the problem is OpenGL-specific. Lots of driver bugs are specific to the OpenGL or DirectX version of the driver.

David