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

Polygon triangles disappear when zoomed out far #4161

Closed
hpinkos opened this issue Aug 1, 2016 · 11 comments
Closed

Polygon triangles disappear when zoomed out far #4161

hpinkos opened this issue Aug 1, 2016 · 11 comments

Comments

@hpinkos
Copy link
Contributor

hpinkos commented Aug 1, 2016

missing-triangles

http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Polygon.html&label=Geometries
Hit home then continue to zoom out, you'll see triangles on the red and blue polygons disappear

Seems to have been introduced in 1.23

@bagnell
Copy link
Contributor

bagnell commented Aug 1, 2016

This happens because they are clamped to terrain and the shadow volume isn't extruded far enough below terrain.

Another problem I noticed was that slightly lowering the extrusion would fix the issue when using STK World Terrain, but not for the ellipsoid. I think the mountainous region covered by the red polygon must have a minimum height high enough above the ellipsoid that the shadow volume doesn't drop below the lower resolution ellipsoid tiles.

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 1, 2016

This happens because they are clamped to terrain and the shadow volume isn't extruded far enough below terrain.

The lower bound of the volume should be extruded in the vertex shader based on the SSE and distance so it always encloses the terrain.

@billwritescode
Copy link

@bagnell @pjcozzi Do you have any suggestions for a workaround from an API perspective to keep polygon triangles from disappearing while a fix is still pending?

@hpinkos
Copy link
Contributor Author

hpinkos commented Nov 17, 2016

This example from @billwritescode is even more noticeable, you don't even have to zoom out that far:

polygons

var viewer = new Cesium.Viewer('cesiumContainer');

var cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({
    url : 'https://assets.agi.com/stk-terrain/world'
});
viewer.terrainProvider = cesiumTerrainProviderMeshes;

viewer.entities.add({
  polygon: {
    hierarchy: {
      positions: [Cesium.Cartesian3.fromDegrees(0.5, 0.5), 
        Cesium.Cartesian3.fromDegrees(1, 0.5),
        Cesium.Cartesian3.fromDegrees(0.5, 0)]
    },
    material: Cesium.Color.LIME,
  }
});

viewer.entities.add({
  polygon: {
    hierarchy: {
      positions: [Cesium.Cartesian3.fromDegrees(1, 0.5), 
        Cesium.Cartesian3.fromDegrees(1.5, 0.5),
        Cesium.Cartesian3.fromDegrees(1, 0)]
    },
    material: Cesium.Color.RED,
  }
});


viewer.entities.add({
  polygon:{
    hierarchy: {
      positions: [Cesium.Cartesian3.fromDegrees(1.5, 0.5), 
        Cesium.Cartesian3.fromDegrees(2, 0.5),
        Cesium.Cartesian3.fromDegrees(1.5, 0)]
    },
    material: Cesium.Color.BLUE,
  }
});

viewer.camera.flyTo({
    destination : Cesium.Cartesian3.fromDegrees(0.75, 0.5, 500000.0)
});

@pjcozzi
Copy link
Contributor

pjcozzi commented Nov 18, 2016

@billwritescode instead of extruding down based on the SSE in the vertex shader, you could workaround this by tweaking the Cesium code to extrude really far in JavaScript. @hpinkos had a PR open for this; it is not the right long-term solution for Cesium, but could be a reasonable stopgap for your app.

@adunham1962
Copy link

@billwritescode instead of extruding down based on the SSE in the vertex shader, you could workaround this by tweaking the Cesium code to extrude really far in JavaScript. @hpinkos had a PR open for this; it is not the right long-term solution for Cesium, but could be a reasonable stopgap for your app.

@pjcozzi could you elaborate a bit on your first sentence? I'm not familiar with the acronym "SSE" or where in the Cesium code we could apply the suggested stopgap while a solution for this issue is pending.

@hpinkos
Copy link
Contributor Author

hpinkos commented Nov 21, 2016

@adunham1962 you can see my proposed fix here: #4485
You could try adding that change until we have a better fix

@adunham1962
Copy link

@hpinkos thanks!

@hpinkos
Copy link
Contributor Author

hpinkos commented Nov 28, 2016

@hpinkos
Copy link
Contributor Author

hpinkos commented Jan 6, 2017

@billwritescode this issue has been fixed in master and will be included in the Cesium 1.30 release available February 1st

@billwritescode
Copy link

Thanks @pjcozzi @hpinkos @adunham1962 @bagnell! I am thrilled.

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

5 participants