CesiumGS / CesiumGS/cesium

ScaleByDistance with NearFarScalar produces unexpected jump near edge of range

Open
#8,196 6 comments 0 reactions 0 assignees View on GitHub
category - entity FCF type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

When creating a PointPrimitive with the following option:
```
scaleByDistance: new Cesium.NearFarScalar(5000000, 5, 40000000, 1)
```
Everything scales nicely between the min and max distances, but as soon as you leave the defined range, the size of the point changes. In the quick demonstration below, I'm moving the camera around the 5000000 threshold. Going below that threshold causes the point size to increase, and then going above the threshold makes the point size decrease.

![point](https://user-images.githubusercontent.com/5085394/65283780-ebdd9e80-db05-11e9-97f4-51bcf2ae7999.gif)

Sandcastle example: https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=ZZBBT8MwDIX/StTLWqlKO8Euo5sQnTghmDSJUy5e6g2LNKmStGMg/jtpu0oDfIqf3/dkpwPLOsITWrZiGk+sREdtzV8HLZ7JoS2N9kAa7Sy5E7oLTGNIexeYEeZOokbeWKrJU4eOQ1XFV3nb3r+dxqVRCqUno+OkTxR6zBuoL6FZqMY46h1sOWWUYH14gb7hB2vqDR4toovzlOVJeoHoA9WOPjFQ84vmJCh8OG/IedASl9dnPiPYR7C7YAEbL/KhUrZI2W0+NfNE6O9+yyiNCufPCtdj8D3VjbGetVbFnGce60ZB2DDbt/IdPZfO9ViRTVBRUceoWonoz7eKiEkFzoXJoVXDASJaF1nw/8KUgYr08aVDq+DcW97m66dR5JwXWWj/U94YtQd7lfgD

Browser: Google Chrome 77.0.3865.75 (Official Build) (64-bit)

Operating System: Windows 10

Contributor guide

Open the contributing guide

Research direction

Start by running the linked Sandcastle example and inspect how PointPrimitive applies scaleByDistance with NearFarScalar near the 5000000 and 40000000 thresholds. Trace the relevant implementation and existing tests, then verify that the point size behaves consistently at and outside the configured range without the reported jump.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.