Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clamped billboard has incorrect bounding sphere in 2D and Columbus View #5042

Open
hpinkos opened this issue Feb 27, 2017 · 11 comments
Open

Comments

@hpinkos
Copy link
Contributor

hpinkos commented Feb 27, 2017

https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Clamp%20to%20Terrain.html

  • Switch to 2D or CV
  • Double click the label to track it

The selection indicator is in the wrong place and the camera seems to be tracking wherever the selection indicator is pointing to

image

@hpinkos
Copy link
Contributor Author

hpinkos commented Mar 7, 2017

This also don't work for a clamped model. In fact, if you switch to the model demo in that ground clamping example you get crazy flickering between Mt Saint Helens and somewhere in Mexico
flicker

@rahwang
Copy link
Contributor

rahwang commented Mar 24, 2017

Came up again in the forum here: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/z4o1l7bKtZs

@mramato
Copy link
Contributor

mramato commented Mar 24, 2017

This may actually be fixed by #5136 (still open). Someone should test out that branch for this issue.

@pjcozzi
Copy link
Contributor

pjcozzi commented Mar 24, 2017

@rahwang we recently merged #5136 into master. Can you please test if this issue is fixed?

Try the hosted version from CI: http://cesium-dev.s3-website-us-east-1.amazonaws.com/cesium/master/

@rahwang
Copy link
Contributor

rahwang commented Mar 27, 2017

Trying to access Sandcastle on the hosted version gives me a 404 for some reason, but I tried it locally and it doesn't look like the problem is fixed on master -- same behavior as before.

screen shot 2017-03-27 at 11 15 49 am

@hpinkos
Copy link
Contributor Author

hpinkos commented May 31, 2017

The problem has something to do with billboards with HeightReference.CLAMP_TO_GROUND. (Point entities use a billboard behind the scenes when the height reference option is used)
The bounding sphere in 2D/CV is way wrong.

Without CLAMP_TO_GROUND :
image

With CLAMP_TO_GROUND:
image

var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
var cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({
    url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles',
    requestWaterMask : true,
    requestVertexNormals : true
});
viewer.terrainProvider = cesiumTerrainProviderMeshes;
viewer.scene.globe.depthTestAgainstTerrain = true;

var billboards = scene.primitives.add(new Cesium.BillboardCollection({
    scene: scene 
}));
billboards.add({
    image : '../images/facility.gif',
    position : Cesium.Cartesian3.fromDegrees(-122.1958, 46.1915),
    heightReference : Cesium.HeightReference.CLAMP_TO_GROUND
});
billboards.debugShowBoundingVolume = true;

@bagnell any ideas?

@hpinkos hpinkos changed the title viewer.trackedEntity doesn't work for clamped billboard in 2D and Columbus View Clamped billboard has incorrect bounding sphere in 2D and Columbus View May 31, 2017
@thw0rted
Copy link
Contributor

Hello from the future! I am also suffering from this issue -- as a result, I can either clamp billboards, or use a terrain provider, but never both.

Is there any update on the problem? My first thought was to just "clamp" them myself using Scene#clampToHeightMostDetailed at billboard creation time, but the docs say it will throw if called in 2D mode.

@hpinkos
Copy link
Contributor Author

hpinkos commented Jan 23, 2019

Sorry @thw0rted, no I don't have an update. Instead of clamping, you can try using sampleTerrainMostDetailed to get a position for the billboard with the height of terrain.

@hpinkos hpinkos closed this as completed Jan 23, 2019
@hpinkos hpinkos reopened this Jan 23, 2019
@CesiumGS CesiumGS deleted a comment from cesium-concierge Jan 23, 2019
@thw0rted
Copy link
Contributor

I'm working up something like this now. Because of the way I work with data, it's going to be simpler to make Entities, then "fix" their height, rather than correcting the data before creating Entities. I'll let you know how it goes, but just fixing the CLAMP behavior in 2D would certainly simplify things...

@thw0rted
Copy link
Contributor

Tentatively optimistic -- I think my implementation works, though right now I'm only dealing with those that have a ConstantPositionProperty. (I found out the hard way, ConstantPositionProperty#getValue throws without a time argument, even though it is ignored when the property is in a fixed reference frame...)

@chdenat
Copy link

chdenat commented Dec 5, 2024

Hello the earth, we're near 2025...

The only way I found to avoid floating point when you change from a scene mode to another is to change the billboard attribute heightReference (So you need to redraw all your Point entities)

Here, noRelief = no terrain or terrain is ellipsoid (flat)

heightReference: noRelief?Cesium.HeightReference.NONE:Cesium.HeightReference.CLAMP_TO_GROUND

So I think that changing the Cesium code somewhere, to avoid clamping to ground when there is no relief should be easy to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants