cesium icon indicating copy to clipboard operation
cesium copied to clipboard

Remove the dependency on ApproximateTerrainHeights from GroundPrimitive and GroundPolylinePrimitive

Open IanLilleyT opened this issue 5 years ago • 7 comments

Currently GroundPrimitive and GroundPolylinePrimitive set their shadow volume bounds based on approximateTerrainHeights.json, a file full of earth's min and max heights at different longitudes/latitudes. If a user has a custom terrain dataset or uses terrain exaggeration, these approximate heights no longer work and the ground geometry will be clipped.

To fix exaggeration, we could add a height vertex attribute and scale it by terrain exaggeration in the shader. This is a little tricky because there's no more room for attributes for polylines. We could oct encode one of the normals to make space but I don't know if that's a good idea. Another option is to use a uniform or batch table entry with the min and max height, but since the geometry is created in the worker after the batch table / uniforms is created, it doesn't know the values. Also we would need a geodetic surface normal to offset the vert in the right direction. I would prefer baking the exaggeration into the verts if possible. Would need some rearchitecting.

For custom terrain datasets, I don't know... the polyline geometry would have to be rebuilt whenever the terrain underneath it changes.

See https://github.com/AnalyticalGraphicsInc/cesium/issues/8436#issuecomment-565742993 for an example of polylines breaking.

IanLilleyT avatar Dec 19 '19 23:12 IanLilleyT

Seems like this could also fix the issue I've been having with GroundPrimitives on a lunar ellipsoid (see https://github.com/AnalyticalGraphicsInc/cesium/issues/7552)

malaretv avatar Jan 10 '20 22:01 malaretv

Is the team still thinking of moving this direction? We're highly interested in either moving away from the approximateTerrainHeights dependency or being able to at least swap in different values at runtime

malaretv avatar Nov 05 '21 16:11 malaretv

Issue with this reported in https://github.com/CesiumGS/cesium/issues/11385.

ggetz avatar Jul 11 '23 14:07 ggetz

Also reported in https://github.com/CesiumGS/cesium/issues/10274

ggetz avatar Jul 20 '23 17:07 ggetz

Issue with this reported in https://github.com/CesiumGS/cesium/issues/11570.

ggetz avatar Oct 19 '23 16:10 ggetz

Issue with this reported in https://github.com/CesiumGS/cesium/issues/11616.

ggetz avatar Nov 10 '23 13:11 ggetz

Manifestation of this reported in https://github.com/CesiumGS/cesium/issues/11791.

ggetz avatar Jan 29 '24 13:01 ggetz