NASA's SPICE Toolkit + UE (Blog Post + Code)

Hello,

I’m wrapping up a blog series soon about integrating a NASA Spaceflight Toolkit with Unreal Engine.

The first 4 parts covered integrating 3rd party tools/libs with Unreal Engine in detail.

The latest post, Part 5, is here:

UE Devs new to Space Flight:
If you’re interested in learning more about actual space flight and how NASA/JPL compute trajectories etc etc. … The post goes into very fine details about how it all works. And shows you how to do the exact same things - in UE Blueprints.

The Toolkit fully supports Blueprints with 1:1 parity with C++ apis.

UE C++ Devs
If you’re a C++ dev looking for examples for things K2Nodes with Wildcard outputs, implementing Blueprints Operators etc etc, Linking to external libs, etc - There’s a ton of stuff to look at in the code.

Aerospace Engineers new to Unreal Engine:
There are very fine details about downloading the source code, building it, getting some blueprints up and running.

(Obviously UE devs here on the forums could jump past the UE stuff.)

The toolkit & samples are released under MIT license, anyone can use it for any purpose, commercial or otherwise. UE5 EA req’d.

atlas-moon

How to get the current location of Hubble Space Telescope:

Making a procedural mesh of Mar’s Moon Phobos in Blueprints using NASA’s data:


(then saving as static mesh.)

2 Likes

Awesome stuff! Can’t wait to get using it :slight_smile:

Thanks :).

Don’t hesitate to contact me directly if you need any assistance, always happy to help.

I did! We have been chatting :).

Hi!

@imakevideogames I’m using the MaxQ plugin, but I have no idea of what kernels to use, for example to show the solar system with all the planets. I get the error:

Insufficient ephemeris data has been loaded to compute the position of 699 (SATURN) relative to 0 (SOLAR SYSTEM BARYCENTER) at the ephemeris epoch 2023 NOV 06 19:16:53.612.

Any advice?

Thanks!

Happy to help :).

For positions of planets you’ll need SPK kernels. There are quite a few options depending on the accuracy you need. NAIF has summarized some of the generic-use kernels here:

https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aa_summaries.txt

For instance, the first one will give you data on the most important solar system bodies from year 1549 to 2650.

Summary for: de430.bsp
 
Bodies: MERCURY BARYCENTER (1)  SATURN BARYCENTER (6)   MERCURY (199)
        VENUS BARYCENTER (2)    URANUS BARYCENTER (7)   VENUS (299)
        EARTH BARYCENTER (3)    NEPTUNE BARYCENTER (8)  MOON (301)
        MARS BARYCENTER (4)     PLUTO BARYCENTER (9)    EARTH (399)
        JUPITER BARYCENTER (5)  SUN (10)
        Start of Interval (ET)              End of Interval (ET)
        -----------------------------       -----------------------------
        1549 DEC 31 00:00:00.000            2650 JAN 25 00:00:00.000

The SPK kernels themselves are located here:
https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets

And de430.bsp itself is located then here:
https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de430.bsp

Other SPK kernels are available covering bodies besides planets (moons of jupiter, asteroids, comets, etc etc) and different time periods.

You’ll also need a “leap-seconds kernel” (LSK), such as naif0012.tls:
https://naif.jpl.nasa.gov/pub/naif/generic_kernels/lsk/naif0012.tls

And, you’ll probably also want a kernel with masses of the celestial bodies. “gm_de431.tpc” for instance contains to exact masses used to compute the “SPK” kernel “de431.bsp” you can find the the SPK kernel directory. For general visualization of planets (and not actual spacecraft missions) you can mix-and-match a bit.
https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/gm_de431.tpc

And, to compute celestial body orientations/rotations you’ll want a PCK kernel with orientation information, such as:
https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/pck00011.tpc

Hope that helps!

2 Likes

Hello!

This represents so much work! Thank you for doing it. I’m making an asteroid mining game and ideally it is based on real asteroid data. I found your forum post following breadcrumbs to achieve a simulation in my game similar to this: 3D Interactive Asteroid Space Visualization - Asterank

Am I on the right track with your add-on?

I also ran inro spacekit.js but there is no real path to unreal.

Another visualization I am intereste in achieving is this: 5,000,000 Galaxies if I could find the point cloud data.

Thanks in advance for any help or advice.

Michael

Hello :).

Happy to offer help/advice :).

Yes, it sounds like what you’re trying to achieve is similar to this:

To make that video, I use NASA’s Horizon’s app do download orbital parameters for asteroids/comets in CSV format. I then used csv->datatable in unreal engine to get the orbital parameters for each asteroid into datatable form where I could access the data. Then, I made an instanced mesh (just a simple sphere) and used MaxQ/Spice to update the position of each asteroid and the earth for a given time.

5M galaxies might work similarly if you can get the data for them.

As an aside, I think it’s interesting in the video linked above that you can see “swirls” form over time in the rendering of the asteroids. It took a minute to realize what was happening… Because the video plays out over time the “swirl” is following earth… Which, is discovering and cataloging the asteroid data used to render the video. So, wherever the earth is, that’s where the asteroid field becomes densest - because that’s where updated data was which placed the asteroid near earth at the time :).