Polyline jittering

Hi everyone,

I am experiencing a great deal of jittering when creating a polyline ( in this case it would technically be a line) between two points when I move or rotate. The polyline is created with PolylineGraphics

The jittering disappears when I set clampToGround:true but clamping it to the ground in my use case does not make sense. Does anyone know why this happens and how I can eliminate the jittering?

Below are some screenshots showing the issue



What I would expect to see is just a line which has its endpoints fixed at every render frame.

Any help would be appreciated.

Thank you

Nicholas

Hello there,

If the polyline disappearing behind other geometry is the chief concern, one option would be to set the depthFailMaterial to a material which matches or is similar to the regular material.

You could also use sampleHeight to ensure the endpoint selection are on “top” of the tileset geometry.

Hi @Gabby_Getz

Thank you for your reply, the Sand Castle example that you linked, has large amounts of flickering as well and this is what I am trying to figure out how to avoid. Is there something in how Cesium deals with update frames that makes polylines jitter? Would it be that in every render call that is made when the camera moves, and the way how polylines are rendered makes the flickering happen?

Also, another very pressing concern is that the line drawn does not even match both endpoints.

Am I missing something? surely drawing a line between two points is a simple operation, so I am guessing it has to do with how polylines are rendered in Cesium

Something I did not clarify in the previous post is that I created both endpoints by clicking on the screen, so not sure if this is having some weird influence and if the points are what is actually moving.

Thanks @Nicholas_Rawitscher

I think you may be seeing some jitter on your machine which I am not seeing on mine…

Are you able to reproduce the artifacts described in this issue, and do you happen to have a Mac with the M1 or M2 chip?

1 Like

Hi @Gabby_Getz

I have an M1, I guess my issue is kind of similar to the GitHub discussion.

Here is a minimal example

Jittering gets worse on smaller polylines. I also tried this Sand Castle Example, and the jittering is not displayed on the cyan polyline. The only way you can perceive it is if you start zooming in very close. So it seems like the jitter amount is a function of distance to the object? The same behaviour can be perceived in the first Sand Castle that you sent me as well.

If this is true, it would be quite problematic for me, because as you can see, because the units I am dealing with are centimetres and meters, and perhaps short km distances.

I think it’s fair to assume that your issue might be quite local. I don’t see any jittering, and I support a large product doing very similar things to what you’re showing, and I don’t hear anything from our customers about this. Would you be able to capture a quick video to show the jitter?

Cheers,

Alex

Hi @Alexander_Johannesen

Thank you for jumping in, here is a video demonstrating the issue:

Let me know if you could successfully view it.

Thanks

Nicholas

What does it look like if you chuck this onto where you create your polylines;

depthFailMaterial: new Cesium.PolylineOutlineMaterialProperty({
color: Cesium.Color.LIGHTGREY.withAlpha(0.4),
outlineColor: Cesium.Color.LIGHTGREY.withAlpha(0.4),
outlineWidth:0
}),

Cheers,

Alex

Hi @Alexander_Johannesen ,

It has no effect, in fact, I was already using PolylineOutlineMaterialProperty when creating the polyline, the only difference was that I was only setting its color property

Anyways, I tested the sand castle examples I posted in the previous reply on Windows, not on the macOS + M1 chip and the jittering is not there. I will continue the discussion in GitHub

1 Like