Seeing Objects from the other side of the globe

Hi,

I’m trying to draw a grid with polyline.

I use the option to prevent this:
scene.globe.depthTestAgainstTerrain = true;

Is there another option for Polylines ?

Rüdiger

I think you need to clarify a bit more. The headline is that you want to see objects from the other side of the globe, so you mean a transparent globe? (which is linked to viewer.scene.globe.translucency.enabled = true;)

But then you’re talking about polyline if it has an option for … what? If you mean, drawing the sphere of the globe with lines, I’d rather use Ellipsoid;

var rad = 30; // whatever size you need, in meters
ellipsoid: {
   radii: new Cesium.Cartesian3(rad, rad, rad),
   fill: false,
   outline: true,
   outlineColor: Cesium.Color.YELLOW.withAlpha(0.4),
   outlineWidth:3.0,
   slicePartitions: 10,
   stackPartitions: 15,
}

Apart from that I think I need some more info on what you’re trying to achieve.

Cheers,

Alex

@Alexander_Johannesen Hi Alexander, the globe is drawn with polylines,
i.e. these are longitude/latitude of usng-Grids, so normally I only would like to see the front and not the back.

In this example you didn’t see the globe because i have clipping-planes.

Regards

Rüdiger

Ok, so why not use the globe and draw your polyline on top of it? Then the globe itself works as a clipping globe. Maybe I’m not understanding you correctly?

Cheers,

Alex

@Alexander_Johannesen

I draw the globe but use clipping planes and when I zoom out I get this screen

Maybe something’s up with the clipping planes? Can you try to color them in to see if they do something odd? (And then take a screenshot of that)

Cheers,

Alex

@Alexander_Johannesen

Hi, I have to check - thank you for the help

@Alexander_Johannesen

Hi Alexander,

I couldn’t reproduce it completely, but I think we have problems with primitives, which are outside our clipping rectangle.

the gridlines are clipped by the programme, but the labels are displayed without clipping.

But maybe it is an old state of the application - we set clipping planes for globe and for scene primitives.

Thank you for the help

Rüdiger

Hi @Alexander_Johannesen,

I have done some more investigations.

We do clipping for globe and primites, but we were not able to clip entities.

image

We draw billboards and polylines, and thought that the clipping of the globe will prevnt drawing, but nothing happened.

Is there a possibility to clip entities ?

should I open a new topic ?

Rüdiger

No, I think clipping is for tiled things in the raster, not for entities (but do check, I might be misremembering). However, there are rules you can apply to entities for not displaying at various points. The first is the obvious distance and visibility rules, but you can make your own through callbackProperties (and I’d mix it up with some clustering if you’ve got lots of them). The idea is measure and react to the distance between the camera, the entity and the surface of the globe.

First, here’s some code I use that I attach to the rendering cycle;

// global surface and distance value
var cartesianSurface = null;

viewer.scene.preRender.addEventListener((info) => {

      // nab the cartographic coords of the camera position
      const distanceCartographic = viewer.camera.positionCartographic;

      // calculate a cartesian coord of where the camera is looking, to the surface of the globe
      cartesianSurface = new Cesium.Cartesian3.fromRadians(distanceCartographic.longitude,distanceCartographic.latitude, 0);

}

Then I use a callback property for depth testing (as a clipping device) when I define my entity;

// reference point (my entity coords, and a forced height of 100m (clipping preference)
// I use this for a globe view, but change the height here to your preference
// including altered sampling if you need it to follow terrain proper
let p = Cesium.Cartesian3.fromDegrees(coords['llng'], coords['llat'], 100);

// then the usual add entity
viewer.entities.add({
   // all the various properties and definitions, plus ...
   disableDepthTestDistance: new Cesium.CallbackProperty( () => {
      let d:number = Math.round ( (p && cartesianSurface) ? Cesium.Cartesian3.distance ( cartesianSurface, p ) : 0 );
      // 7400000 is the approximate distance between the center of the earth and the ellipsis horizon
      if ( d > 7400000 ) {
         return 50000;
      } else {
         return Number.POSITIVE_INFINITY;
      }
   })
});

You can play around with this, including shifting the callback property to work on entity.show = true | false instead, as I was making my entities clip the globe as they were passing behind the horizon rather than simply hide or show. Hopefully this gives you somewhere to begin looking.

Cheers,

Alex

@Alexander_Johannesen

thanks - I will try

@Alexander_Johannesen

the problem with the icons is that the clipping is dependent on position not at the distance to the camera

Rüdiger

What? Of course it is dependant on the distance between the camera, the icons and the globe, because your issue is one of visibility (it’s basically finding out where the horizon of the globe hits your icon, and set the clipping options whether they are on the hinther or farther side to the camera position). And that is you, the camera. Either way, I’m just trying to help, and what I suggested definitely works (I use it in production code) to solve that problem, so by that I don’t quite understand what you mean by this. Want to explain a bit further?

Cheers,

Alex

Hi @Alexander_Johannesen

so maybe I didn’t understand your algorithm -

For my second question concernig the icons - they are all on the right side of the globe, but partially outside the clipping-plane of the underlying globe.

So I thought it should depend on the position of the icon and not the distance to the camera.

Regards

Rüdiger