models switches on and off

In a large database, I include a number of separate egg models with a larger switch distance (2000 meters). The farplane is defined at 2500 meters. When I move through the database some of these models seem to be switched on and off between cycles. When I am stationary they are rendered, while when I am moving they are ‘flickering’: one frame they are rendered while the next frame they are not rendered. When this occurs I am definitely closer than 2000 meters. If I am closer than, say, 300 meters, they are rendered all the time.

What could cause this switching on and off?

Hmm… do you perhaps have vsync disabled? If so, does it go away if you enable vsync in Config.prc?

Whether I enable of disable vsync, it doesn’t matter. I tried both. Disabling vsync only reduces framerate.

Could you be experiencing the same problem reported here? What is your near plane set to? Make sure it is not unreasonably small.

Or, perhaps you are experiencing z-fighting, the kind of flickering effect you get when you have two objects that occupy exactly the same space?


The near plane was set to 0.5. I increased it to 1.5 and the problem is still the same. The are no other objects near the ones that flicker. One is a large building and the others are hills.

Hmm, well, I don’t know what might be causing this flickering; but one idea to help narrow it down is to add the line:

fake-view-frustum-cull 1

to your Config.prc file. This will draw things in red wireframe when Panda believes they should be culled. (It may adversely affect your framerate, but this is just for a test.)

If setting this option makes your objects change temporarily into red wireframe, then we know it’s a problem with culling for some reason. If, instead, the objects still disappear the same way they did before, then it must be something else.


Looks like z-fighting to me. They vertices/faces don’t have to be in exact same position when the camera is too far from them

Thank you for your suggestions. I found it: the sky dome was smaller than the distance to these models, while setDepthWrite of the skydome was set to 0. I have set the DepthWrite of the skydome to 1 and then the flickering was solved. So this problem is solved.