Always get the highest terrain resolution

according to documentation:

As we zoom closer, CesiumJS requests higher resolution terrain based on what parts of the globe are visible and how far away they are.

My question: is there a way to force CesiumJS to requests always for the highest possible terrain resolution?

Here are the details of my problem:

  • I have a route (Polyline Entity) drawn 10m above the ground.
  • The route is sampled every 10m by sampleTerrainMostDetailed so I have the most accurate heights along the route
  • I have Globe prop depthTestAgainstTerrain set to true, and sometimes it cause my route to disappear underneath terrain when I’m zoomed out.

I think that If I asked terrain provider always for the highest resolution, this problem will disappear.

Welcome to the Cesium Community!

According to the documentation for depthTestAgainstTerrain:

The disadvantage of depth testing primitives against terrain is that slight numerical noise or terrain level-of-detail switched can sometimes make a primitive that should be on the surface disappear underneath it.

When depthTestAgainstTerrain is set to true, the issue you mentioned with the primitive disappearing underneath the terrain can occur. This happens when terrain LOD is switched. Unfortunately, it’s not possible to force the highest terrain resolution with the API (also, forcing this setting may lead to other issues with performance).

One soluton is to turn off depthTestAgainstTerrain, although that might introduce undesirable visual artifacts.