CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
13k stars 3.5k forks source link

Tracked Entity Orientation Flip #12313

Open Rubeanster opened 4 days ago

Rubeanster commented 4 days ago

What happened?

We have been tracking #4647 for a few years now as we thought this was an issue related to ours and it sounded like it was resolved with #12230 last month so we thought we'd give it a try with the latest cesium 1.123 which includes it but our issue still persists.

The issue is when we track a path made by CZML the orientation seems to flip causing the screen to jitter (violently at times). Our data can get pretty noisy and I have attached a small sample of it in the sandcastle below.

Orientation at 19:30:48.576: image

Orientation at 19:30:48.595: image

Alternatively, is there any recommendations to how we could smooth it out so the while tracking the object the camera flip is not as violent?

Reproduction steps

  1. Load in a CZML path (preferably noisy, this occurs with the sample sandcastle CZML Path at rates > 3200x speed)
  2. Track the object and preferably orientate a birds eye POV
  3. Play the event and see the camera jitter and the landscape flip ...

Sandcastle example

https://sandcastle.cesium.com/#c=rXppl6pItvZfyVWfqhfVAgEBwenqWhccEAcERURu9QdkEkUmQdR39X9/N5knTbOqT2d9uOfkcgiCvSP28Dx7h/h5dq5f/Pspffnny//+nr28/L/u5eUlCb69/P5TkPvNKczq33/65W04805hd6HvzmcvhlfvH1cuYXVO8qy7yPaYx7Cf5v7x27tUkJvVYXXx0m4eYhD6O8PCn8VK3zjmG096LMNiAbn0n69JPY7DEkfch2yQ3lQVLM9K3lb1XwQ+3XRq0jop0iSsvr2wzPfhf7++v71+MkHxvMn37a8SEOLVYfDy6XIQnv0qKerODu/afv/p1+K3z/NfAq/2fqWL3x43ehcvSb1dkib17f/CMp2WJ6OfQHWVdEZ/DMGcPL2lSRYumrp7+3QNLJunefWHsZeXKt55317+F2H8ywvzy8vrO7z865fnaf/+9C1/E9//b/KeRP1VeZsk6LaIn659zPv41L5NI4+BNPSCt3B5uP7lpa7A/O+jzMd4FZ7ztHl150PTu2xwVrrLvSp4Du6TF4ffPlYECQSe/vY6TBdZ/I+ddw4F/pfEVhbLlpmqcS7D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1tv3XlTlp01epcH3gZ//9qqzewJv5t3Cykj8Y/cEaOSl5/D10nmfN2kgZ0n3uOS3l7pquvF//+1phd3jfKu8qfwQVum1XvK+6N7HlXPPC4Kfv6+mfz+lg8elXpp7wc/d07Z/e5P6/ea68mAxwTCrk/oGkj+E9cJuLAGhcVgrNy34+f2J1L/94+WnX3769Vzf0vC3d/v+T3Iq8qp+aar0516PrsNT0T12eqZ3DSioe/753Cnupv5KP9/6a5BcXpLgn//Bzi9+6p3PcCVq0nSV3MPff/rtVxrm/+nWbndJFi8uYZV6t27anv1t9jbY6/V+peHrf76zzvN051VPkt9m/H8

Environment

Browser: Chrome Version 129.0.6668.89 (Official Build) (64-bit) CesiumJS Version: 1.123 Operating System: Linux

jfayot commented 3 days ago

@ggetz I was able to get this one fixed by using the new TrackingReferenceFrame feature, plus adding a new value TrackingReferenceFrame.ENU (which is the fixed counterpart of AUTO_DETECT). Would you like me to enhance my initial PR #12194 ?

ggetz commented 3 days ago

Hi @jfayot! To confirm my understanding: The tracked entity linked above is sometimes moving fast enough that the default camera tracking behavior switches to a VVLH reference frame, very briefly, before switching back to ENU. And this is causing the observed flicker. Is that all correct?

jfayot commented 3 days ago

That's it @ggetz ! Trace logs have confirmed this...

ggetz commented 3 days ago

Awesome! It sound like your suggestion would work well here then! We would be happy to review a follow-up PR.

jfayot commented 3 days ago

@Rubeanster would you mind testing your sandcastle in the PR's #12314 branch?

Just update the last line with:

const entity = dataSource.entities.getById("path");
entity.trackingReferenceFrame = Cesium.TrackingReferenceFrame.ENU;
viewer.trackedEntity = entity;

and tell if it behaves as you would expect.

Rubeanster commented 3 days ago

Just tested the sandcastle off of your branch and it does work as expected now. I do not see any flipping occurring and it looks a lot better!