Hello everybody,
I’m using Cesium (release 1.9) to build a Web interface for 3D Mars image visualization.
I have defined a new Ellipsoid in Source/Core/Ellipsoid.js as :
/** * An Ellipsoid instance initialized to the standard Mars Sphere.
-
@member of Ellipsoid */
Ellipsoid.MARSSPHE = freezeObject(new Ellipsoid(3396000.0, 3396000.0, 3396000.0));
``
Then used the Apps CesiumViewer with this new Mars Ellipsoid in every layer I have charged (using TerrainProviderViewModels in the Viewer definition).
Atmosphere is not there because I set it to undefined in the Viewer options.
My problem is that when zooming some tiles disappear on the globe border (see attached screenshot).
As this is never the case for the Earth globe, I suppose I did something wrong with the Ellipsoid definition. Have I missed some parameters somewhere in the source?
Thanks in advance for any answer,
Best regards,
Chiara
There are many places in Cesium where it defaults to Earth’s WGS84 when no ellipsoid is provided so chances are Cesium is still using WGS84 in some places.
A reasonable test/workaround would be to just change what Cesium thinks is WGS84. You will not have to explicitly pass around ellipsoids everywhere and since you’re application is dealing only with Mars there is no conflicts.
https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Core/Ellipsoid.js#L224
I figured out how you should be defining the Mars Ellipsoid and also requires no modifications to Cesium’s source code.
When you construct your Viewer instance, pass the mapProjection
option as an instance of new GeographicProjection(ellipsoid), where ellipsoid is the Mars ellipsoid. Imagery and terrain generated for Mars should then work.
Something similar to this code snippet:
//Your applications javascript file.
var marsEllipsoid = new Cesium.Ellipsoid(3396000.0, 3396000.0, 3396000.0);
var viewer = new Cesium.Viewer(‘cesiumContainer’, {
mapProjection: new Cesium.GeographicProjection(marsEllipsoid),
…
…
…
});
``
Let me know If solution is still not working, it’s either an error in the imagery/terrain data or a bug in Cesium that we will open an issue to get fixed.
Hello Mike,
thanks for your answers!
Defining an ellipsoid in Geographic projection fixes my problem!
BTW, I have looked a little bit better into Viewer parameters and I tried the options.globe. So, to be sure my Viewer now looks like
viewer = new Viewer('cesiumContainer', {
mapProjection: new GeographicProjection(Ellipsoid.MARSIAU2000),
globe : new Globe(Ellipsoid.MARSIAU2000),
baseLayerPicker : false,
imageryProvider : imageryProvider,
terrainProvider : new EllipsoidTerrainProvider({ellipsoid: Ellipsoid.MARSIAU2000}),
skyAtmosphere: false,
});
``
And all is perfect!
Thank you very much for your wonderful software!
All the best,
Chiara
That’s fantastic news!
I’m glad we were able to get Cesium up and running displaying Mars with just a small amount of custom initialization.
I’m sure people would love to see some screenshots of your application when you’re done.
The next version of Cesium will have some additional support for custom ellipsoids, see pull #2697.
I really want to play with an instance of Cesium running full Mars terrain & imagery now. And some rovers doing their thing, you know. It needs to happen.
--Ed.