Use Cesium for bodies other than the Earth

In poliastro, a Python library for Astrodynamics focused on interplanetary applications (http://docs.poliastro.space/), we were considering using Cesium and CZML to export 3D plots of orbits. However, I am not sure this is at all possible: the ability to specify a central body that is not the Earth is mentioned in this outdated roadmap from 2015:

https://github.com/AnalyticalGraphicsInc/cesium/wiki/Architecture

The CentralBody primitive represents the globe (in a future Cesium version, any central body such as the Moon and Mars will be supported).

However, there are no further references since then.

On the other hand, by reading the simple.czml example I see that nowhere it is specified which central body do the satellites orbit:

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Specs/Data/CZML/simple.czml

This
means that I could focus on exporting an orbit as a correct CZML and leave the rest to the user. But I fear that this will lead to incorrect results because there are many Earth-based assumptions in Cesium.

What do others think about this? Is it at all within Cesium vision?

Kind regards,

Currently, Cesium generally supports a single central body in a scene (the scene’s “globe”). Other bodies can be rendered using an EllipsoidPrimitive (as done with the Moon) or as a custom billboard (as done with the Sun), but their visual appearance is greatly simplified compared with how Earth is rendered (with terrain, imagery, etc.).

Scenes on other planets can be created by changing the ellipsoid of the (single) globe to instead reflect the other planet’s shape, and then loading different imagery onto that geometry. I believe users have done this to create Mars-based applications. The ellipsoid is passed around in many places which all default to WGS84, but they should all allow passing a custom ellipsoid instead.

You’re right that CZML doesn’t specify the body that data is defined in, but generally it is all loaded relative to the scene’s body, which defines the reference frame for cartesian coordinates specified in the CZML file.

Thanks Scott. Let me answer in-line:

There’s been discussion on the forum in the past about how to set the globe up as another planet.

You can see what other people have done with Mars and the asteroid Vesta in Cesium.

But those are still for exploring a single body that’s not the Earth, not for creating an entire solar system with multiple planets and orbits.

Thanks Scott. Let me answer in-line:

Currently, Cesium generally supports a single central body in a scene
(the scene's "globe").

And how could I tell it to be Venus, Neptune or whatever other body?

By changing the ellipsoid parameters (i.e. using a custom Ellipsoid
object), as I mentioned in my previous email, to change the shape of the
globe.

You could even turn off the globe visually, and then consider the reference
frame of the scene as the solar system barycenter and position ellipsoids
in that coordinate system.

Other bodies can be rendered using an EllipsoidPrimitive (as done with the

Moon) or as a custom billboard (as done with the Sun),

What do you mean by "as done with the Moon" or "with the Sun"? Do you have
specific examples at hand?

The Moon and Sun are rendered by default in the Cesium scene, in their
correct locations. (there's a Vectors sandcastle example that can help
find their location in the sky to see what they look like)

You can look in their source files to see how they are implemented.

The Moon is simpler, a basic textured ellipsoid. The Sun uses a custom
shader to get the visual flare effect.

You're right that CZML doesn't specify the body that data is defined in,

but generally it is all loaded relative to the scene's body, which defines
the reference frame for cartesian coordinates specified in the CZML file.

So if I understood correctly, given a CZML there's no way to know which
body it originated from. Is that correct? Perhaps there is some metadata
that I can use for that? Even some simple parameters like the gravitational
parameter or the radius would suffice.

CZML supports custom properties, which you could use to include whatever
additional data you want, and then in your JavaScript code, examine the
value of those properties and reconfigure the display accordingly.

Thank you very much for your responses, I think I have all the information I need. It will take some time though, but we’ll keep you posted with our results.

Best,

Any news? I would like to represent interplanetary spacecrafts trajectories in Cesium, but I can’t understand how to convert positions w.r.t Sun into Cesium reference system.

For example, I have this file: https://www.hayabusa2.jaxa.jp/hy2sc4/data/hy2_trj_plan.txt

Excerpt:
=============================
# |----------- Spacecraft ----------| |----------- Earth -----------| |----------- 1999JU3 ----------| |------ Maintenance Info. ------|
# UTC L+ X Y Z X Y Z X Y Z Rs Re Ra Vs Ve alpha delta Dflt ORB_ID T_fp
# [day] [AU] [AU] [AU] [AU] [AU] [AU] [AU] [AU] [AU] [10^4km] [10^4km] [10^4km] [km/s] [km/s] [deg] [deg] [10^4km]
#--------1---------------2--------3------------4------------5------------6------------7------------8------------9------------10-----------11-----------12---------13---------14-------15-------16-------17-------18-----19----20--------------------------------21—
2020/09/01.04:59:59 2099.0 0.000000000 0.000000000 0.000000000 0.941759396 -0.362564266 0.000016692 1.212657811 -0.285057784 0.127795902 18391.83 4652.80 686.14 26.42 9.85 13.35 31.83 503047.8 20200825-20201002_0001_eph-ops +0.0
2020/09/02.04:59:59 2100.0 0.000000000 0.000000000 0.000000000 0.947521452 -0.346527920 0.000016177 1.213291467 -0.270097929 0.127370586 18350.30 4576.87 692.63 26.48 9.73 13.52 32.27 503276.4 20200825-20201002_0001_eph-ops +0.0
2020/09/03.04:59:59 2101.0 0.000000000 0.000000000 0.000000000 0.953011912 -0.330392258 0.000015529 1.213741070 -0.255097112 0.126925943 18308.58 4501.72 699.13 26.54 9.61 13.68 32.71 503505.4 20200825-20201002_0001_eph-ops +0.0
2020/09/04.04:59:59 2102.0 0.000000000 0.000000000 0.000000000 0.958229058 -0.314161542 0.000014745 1.214005324 -0.240057350 0.126461914 18266.69 4427.35 705.64 26.61 9.50 13.83 33.15 503735.0 20200825-

Meaning of x,y,z:
X, Y, Z: Explorer / Earth / Asteroid position in the ecliptic plane coordinate system, unit is [astronomical unit] (astronomical unit, sun = earth distance (here, distance with 149597870.7 [km] as 1))

Given that “explorer” coordinates are always 0, it looks like these data are centered on spacecraft itself… How do I move them into Cesium reference frame?