Define a new Occluder and display polygons and points on a new ellipsoid

Dear Cesium team,

First of all, I would like to congratulate you for the great work you done on Cesium. It is a nice library. I am Omar Delaa from
the French geosciences laboratory (GEOPS laboratory). I am currenty working on an application based on your library for the needs of my laboratory.
I am writing to you this email because I would like to present to you some little issues that I encountered during the development of my application.

My first issue concern the Occluder. For the needs of my laboratory, I need to define a new ellipsoid which is greater (or smaller) than the WGS84 ellipsoid.
When I drag and drop a json file on my new ellipsoid, billbords which are located behind the planet are not occluded.
To be more precise, when the new ellipsoid is grater than the WGS84 ellipsoid, the occluder size remain the same that the WGS84 ellipsoid.
You will find a picture to illustrate my purpose in Saturn.png :

In this example, I used the case of Saturn. If you look at the center of the picture you will distinguish a small hole which is the occluder. Hence,
billbords are occluded only in that zone. However, billboards are located a the right height as you can see in the picture. Here After, you will
find my way to create a new ellipsoid :

var ellipsoid = freezeObject(new Ellipsoid(objectDimensions.x, objectDimensions.y, objectDimensions.z));
var newTerrainProvider = new EllipsoidTerrainProvider({ellipsoid: ellipsoid});
var newGeographicProjection = new GeographicProjection(ellipsoid);
var newGlobe = new Globe(ellipsoid);

viewer.scene.globe = newGlobe;
viewer.scene.mapProjection = newGeographicProjection;
viewer.scene.camera.projection = newGeographicProjection;
viewer.terrainProvider = newTerrainProvider;
viewer.scene.globe.baseColor = Color.BLACK;

I tried to define a new Occluder but without success :

var occluderBoundingSphere = new BoundingSphere(Cartesian3.ZERO, ellipsoid.minimumRadius);
Occluder.fromBoundingSphere(occluderBoundingSphere, cameraPosition, newOccluder);

My question is how to define a new Occluder and include it in the viewer in order to replace the old WGS84 occluder ?

My second problem relates to the display of polygons on an ellipsoid different from the WGS84 ellipsoid. To illustrate my issue, I used Mars.
Here after, you will find a picture to illustrate my problem :

You can see that lines are displayed correctly (I mean that they are on the right ellipsoid). However, the Polygons and points (circles are saved as points) are
displayed on an ellipsoid greater than Mars. I supposed that this last ellipsoid is again the WGS84 ellipsoid. Hence, one way to solve quickly this issue
is to give a new definition of the WGS84 ellipsoid but I don’t want to do that.

My question for this second issue is how can i do to display correctly my polygons and points on the right ellipsoid ?

Thank you very much for you help and I apologize for my bad English.

Best regards,

Omar D.

Hello Omar,

Wow, those screenshots look really interesting! What kind of applications are you working on?

And thanks for reporting these, they are definitely bugs. The majority of our users use the WGS84 ellipsoid, so we don’t often hear about bugs specific to custom ellipsoids. If you come across any more, let us know =)

I’ve created two new issues on our GitHub repo:

As a workaround for the polygon error, you can use the Primitive API instead of the higher level Entity API. That way you can pass in your ellipsoid to the polygons and make them draw properly.

Here is an example:

var radius = 5e6;
var ellipsoid = new Cesium.Ellipsoid(radius, radius, radius);
var projection = new Cesium.GeographicProjection(ellipsoid);

var viewer = new Cesium.Viewer(‘cesiumContainer’, {
mapProjection: projection,
baseLayerPicker: false,
imageryProvider: new Cesium.BingMapsImageryProvider({
url : ‘//dev.virtualearth.net’,
mapStyle : Cesium.BingMapsStyle.AERIAL,
ellipsoid: ellipsoid
})
});

var positions = Cesium.Cartesian3.fromDegreesArray([
-115.0, 37.0,
-115.0, 32.0,
-107.0, 33.0,
-102.0, 31.0,
-102.0, 35.0
]);

var redPolygonInstance = new Cesium.GeometryInstance({
geometry : Cesium.PolygonGeometry.fromPositions({
positions : positions,
ellipsoid: ellipsoid,
vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
}),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.RED)
}
});

viewer.scene.primitives.add(new Cesium.Primitive({
geometryInstances : redPolygonInstance,
appearance : new Cesium.PerInstanceColorAppearance({
closed : true,
translucent : false
})
}));

``

Thanks again for your very detailed report! Can’t wait to hear more about your project.

Best,

Hannah