scaleByDistance buggy on a label?

cesiumBug.rar (3.5 MB)
please have a look at the video I provided. As video file endings are not allowed to be uploaded I put it into a rar file. You see the sandbox code and the resulting behaviour.

I place a label and set
scaleByDistance: new Cesium.NearFarScalar(3000.0, 1.0, 10000.0, 0.2)
when I pan back and forth at probably the 3000 mark, there is a sudden change where I expect a smoth transition. Is that a bug?

1 Like

@csab6597

Welcome to the community and thank you for your question! :grinning: :rocket:

Can you please share this video via an online video platform (YouTube, Vimeo, etc.)? For security reasons, I would prefer to not download this file directly onto my computer.

-Sam

@csab6597

Thank you for sending over the video. I just watched the video that you shared and read through our NearFarScale documentation. To the best of my knowledge, this is not a bug. I believe that the sudden change that you are witnessing is due to the large discrepancy between the nearValue and the farValue parameters.

-Sam

Well if that is the case then this does not meet the description of scaleByDistance Label - Cesium Documentation parameter as I read it.
What I expected in this example would be a scale of 1 for a distance of 3’000 and less to the label, which will then fall down in a linear fashion to a scale of 0.2 at a distance of 10’000, and then level out at 0.2 for any larger distance.
I actually do assume this was the intention of that parameter, I may stand corrected?

@csab6597

You bring up another good point. The documentation states that “a label’s scale will interpolate between the NearFarScalar#nearValue and NearFarScalar#farValue .” It is unclear what interpolation algorithm we are using behind the scenes. Are you seeing the same issues when you use different values for nearValue and farValue? In the meantime, I am going to take a look at our source code and try to learn more about our interpolation algorithm.

-Sam

Yes I see this issue with different numbers for nearValue and farValue

@csab6597

Understood :+1:

In that case, I recommend writing up a new issue on our GitHub page that outlines the problem that you are facing.

I took some time to look through our backlog of issues and found the following thread.

Do you think the bug that @tangtony noticed is related to the problem that you are highlighting here?

-Sam

That is the very issue, I can run the sandcastle example given in that original post on 19 Sep 2019, and when I zoom in and out I see the same unexpected jump in size I experienced

@csab6597

Great! I am glad that we were able to find an issue on GitHub that outlines the problem that you are facing. To the best of my knowledge, we do not have a timeline for resolving this bug. However, if you submit a pull request, we would be happy to review it as soon as possible. :grinning: :rocket:

-Sam