Live data from Hacker News

Orbit Tessellation developer diary for Kerbal Space Program 2

kerbalspaceprogram.com

71–80 of 84 posts

Re: Orbit Tessellation developer diary for Kerbal Space Program 2

#71
post #69

Earlier quoted context omitted.

There are many GPUs with no double precision floating point support in hardware. Modern ones can probably emulate it. Older ones don't have any explicit support. Most real time 3D renderers do not use double precision at all.

> There are many GPUs with no double precision floating point support in hardware. Which ones? I'm genuinely curious about this.

I think all of the ones listed as DirectX 10.1 or lower on this page: https://en.wikipedia.org/wiki/Feature_levels_in_Direct3D

Those are all quite old now of course, but even modern GPUs may not have 64-bit ALUs and rely on emulation instead. Intel Gen11 in Ice Lake, for example: https://01.org/sites/default/files/documentation/intel-gfx-p...

In mobile architectures 64-bit ALUs can be an optional feature that is omitted for lower end configurations. I know this is true of PowerVR.

Re: Orbit Tessellation developer diary for Kerbal Space Program 2

#72
post #69

Earlier quoted context omitted.

> There are many GPUs with no double precision floating point support in hardware. Which ones? I'm genuinely curious about this.

I think all of the ones listed as DirectX 10.1 or lower on this page: https://en.wikipedia.org/wiki/Feature_levels_in_Direct3D Those are all quite old now of course, but even modern GPUs may not have 64-bit ALUs and rely on emulation instead. Intel Gen11 in Ice Lake, for example: https://01.org/sites/default/files/documentation/intel-gfx-p... In mobile architectures 64-bit ALUs can be an optional feature that is omit…

Ah interesting to know about Gen11, thanks for the links.

Re: Orbit Tessellation developer diary for Kerbal Space Program 2

#73
post #6

Space rendering is full of interesting problems like this. Another one is that single precision floating point doesn't have enough precision to represent both planet scale and human scale in the same coordinate system (let alone solar system scale or galaxy scale), yet GPUs don't support double precision well. So you have to make sure that you do calculations needing high precision on the CPU in double precision and…

    Some napkin/WolframAlpha math:
    if you wanted to use simple x,y,z coordinates,
    with the sun at the center
    and be able to represent locations at 30 AU (Neptune)
    with an accuracy of 1mm, e.g. 30AU vs 30.000...0001AU
    you'd need ~16 decimal digits of precision
    which is the same number of bits as a double (FP64)
    of course there's better ways to do this,
    in the surrounding smarter comments

Re: Orbit Tessellation developer diary for Kerbal Space Program 2

#74

Earlier quoted context omitted.

The expanse still gets the physics right for the important scenes. Watching people stand for over a few days looking at a torpedo slamming into the sun would be boring. Space combat physics is still done very well.

I’d argue that it’s just an effect of lazy writing though. Deorbiting anything into the sun is a very expensive way to get rid of it. They showed instant proto molecule cleanup operations in another season - just use that again.

They didn’t want to risk going after it, it’s not written differently in the books.

It was done so the audience can understand what happens easily without having to drag it out over a few episodes.

The shows main strength is that they know rather well when physics are important for the plot and when it isn’t and they execute on this very well.

Re: Orbit Tessellation developer diary for Kerbal Space Program 2

#75

Earlier quoted context omitted.

> The Keplerian curve no longer applies once you introduce additional influences, though, so it doesn't really matter how (in)frequently updates are applied for those other influences. It depends on how well you can simplify the math. I would imagine that instead of an n body calculation it's lot simpler to calculate the influence from one body plus one unchanging vector, but I've never tried it. > The approximation…

> I would imagine that instead of an n body calculation it's lot simpler to calculate the influence from one body plus one unchanging vector, but I've never tried it. I think what you describe could either be Euler's three-body problem (two fixed point masses and a particle) [0], or the restricted three-body problem (two point masses and a particle) in a rotating/pulsating reference frame. The former does have exact…

> I think what you describe could either be Euler's three-body problem (two fixed point masses and a particle) [0], or the restricted three-body problem (two point masses and a particle) in a rotating/pulsating reference frame.

Even simpler, though, because only one of the masses needs to have a location. The other one is effectively at a fixed direction and distance, far enough away that you can ignore relative motion.

> I'm not sure I understand why being farther away from something would result in less chaotic trajectories? If anything, I'd expect more interesting orbits due to the lack of one dominating influence.

I'll rephrase. The gravitational vector on the craft won't be shifting very fast, so you can get away with a quite big timestep.

Re: Orbit Tessellation developer diary for Kerbal Space Program 2

#76

Earlier quoted context omitted.

> I would imagine that instead of an n body calculation it's lot simpler to calculate the influence from one body plus one unchanging vector, but I've never tried it. I think what you describe could either be Euler's three-body problem (two fixed point masses and a particle) [0], or the restricted three-body problem (two point masses and a particle) in a rotating/pulsating reference frame. The former does have exact…

> I think what you describe could either be Euler's three-body problem (two fixed point masses and a particle) [0], or the restricted three-body problem (two point masses and a particle) in a rotating/pulsating reference frame. Even simpler, though, because only one of the masses needs to have a location. The other one is effectively at a fixed direction and distance, far enough away that you can ignore relative moti…

> Even simpler, though, because only one of the masses needs to have a location. The other one is effectively at a fixed direction and distance, far enough away that you can ignore relative motion.

This still sounds like precisely what I described. Euler's three-body problem is two fixed point masses, so there's no relative motion by construction, and the restricted three-body problem in a rotating/pulsating reference frame has mathematical transformations applied so the two bodies are "effectively fixed" relative to each other in that reference frame (while preserving effects due to rotations, such as centripetal/centrifugal forces).

The question in such a case becomes whether such a thing is substantially better than a regular n-body integrator. Euler's three-body problem may lose some useful n-body effects such as Lagrange points, which partially defeats the purpose of moving away from Keplerian orbits, and the restricted three-body problem arguably isn't simplified enough compared to full-blown n-body integration to be worth it.

> I'll rephrase. The gravitational vector on the craft won't be shifting very fast, so you can get away with a quite big timestep.

Ah, that makes more sense. IIRC Principia has an adaptive timestep, so it already does that, though that's with full n-body calculations. Swapping between the approximation and proper n-body depending on position relative to other bodies seems like a rather complex scheme, though, and I'm not sure whether that'd be the best approach.

Re: Orbit Tessellation developer diary for Kerbal Space Program 2

#77

Earlier quoted context omitted.

> I think what you describe could either be Euler's three-body problem (two fixed point masses and a particle) [0], or the restricted three-body problem (two point masses and a particle) in a rotating/pulsating reference frame. Even simpler, though, because only one of the masses needs to have a location. The other one is effectively at a fixed direction and distance, far enough away that you can ignore relative moti…

> Even simpler, though, because only one of the masses needs to have a location. The other one is effectively at a fixed direction and distance, far enough away that you can ignore relative motion. This still sounds like precisely what I described. Euler's three-body problem is two fixed point masses, so there's no relative motion by construction, and the restricted three-body problem in a rotating/pulsating referenc…

> This still sounds like precisely what I described. Euler's three-body problem is two fixed point masses, so there's no relative motion by construction, and the restricted three-body problem in a rotating/pulsating reference frame has mathematical transformations applied so the two bodies are "effectively fixed" relative to each other in that reference frame (while preserving effects due to rotations, such as centripetal/centrifugal forces).

You still have to care about the where the particle is relative to both masses. The whole point of the calculation is figuring out which way the particle goes, and the simplification I'm suggesting removes a lot of that math. Instead of two masses providing a continuously varying force in both direction and magnitude, you have one mass providing a continuously varying force plus a static offset. This removes multiple degrees of freedom from the problem.

> Swapping between the approximation and proper n-body depending on position relative to other bodies seems like a rather complex scheme, though, and I'm not sure whether that'd be the best approach.

I wasn't suggesting swapping between the methods. If you're in the middle of nowhere, then while the Keplerian portion of the model will be a smaller factor, it won't harm anything.

Re: Orbit Tessellation developer diary for Kerbal Space Program 2

#78

Earlier quoted context omitted.

> Even simpler, though, because only one of the masses needs to have a location. The other one is effectively at a fixed direction and distance, far enough away that you can ignore relative motion. This still sounds like precisely what I described. Euler's three-body problem is two fixed point masses, so there's no relative motion by construction, and the restricted three-body problem in a rotating/pulsating referenc…

> This still sounds like precisely what I described. Euler's three-body problem is two fixed point masses, so there's no relative motion by construction, and the restricted three-body problem in a rotating/pulsating reference frame has mathematical transformations applied so the two bodies are "effectively fixed" relative to each other in that reference frame (while preserving effects due to rotations, such as centri…

> Instead of two masses providing a continuously varying force in both direction and magnitude, you have one mass providing a continuously varying force plus a static offset.

Ah, so the force vector is constant/infrequently updated, not the position of the second body. My apologies for the misunderstanding.

I'm honestly a bit curious what an that would look like. For example, what would an orbit around the Earth-Moon L1 look like? What would an Earth -> Moon low-energy transfer look like?

I feel like depending on the system you might need to update the "fixed" force vector relatively frequently to get anywhere close to approximating n-body results, which basically sounds like regular integration.

I suppose at some point the question becomes how much fidelity are you willing to sacrifice in the name of decreasing CPU usage.

> I wasn't suggesting swapping between the methods.

My mistake again. Sorry about that.

> If you're in the middle of nowhere, then while the Keplerian portion of the model will be a smaller factor, it won't harm anything.

Wouldn't that arguably be where the most significant errors would be, as that's where the relatively unphysical constant force vector would have the most significant influence?

Re: Orbit Tessellation developer diary for Kerbal Space Program 2

#79

Earlier quoted context omitted.

> This still sounds like precisely what I described. Euler's three-body problem is two fixed point masses, so there's no relative motion by construction, and the restricted three-body problem in a rotating/pulsating reference frame has mathematical transformations applied so the two bodies are "effectively fixed" relative to each other in that reference frame (while preserving effects due to rotations, such as centri…

> Instead of two masses providing a continuously varying force in both direction and magnitude, you have one mass providing a continuously varying force plus a static offset. Ah, so the force vector is constant/infrequently updated, not the position of the second body. My apologies for the misunderstanding. I'm honestly a bit curious what an that would look like. For example, what would an orbit around the Earth-Moon…

> Ah, so the force vector is constant/infrequently updated, not the position of the second body. My apologies for the misunderstandin

That's fine, glad we got it cleared up.

> I'm honestly a bit curious what an that would look like. For example, what would an orbit around the Earth-Moon L1 look like? What would an Earth -> Moon low-energy transfer look like?

> I feel like depending on the system you might need to update the "fixed" force vector relatively frequently to get anywhere close to approximating n-body results, which basically sounds like regular integration.

For a basic example-numbers implementation, replacing an n-body simulation that updates every 10 seconds, I was imagining that you might update the force vector 1/100th as often, every 1000 seconds. That's plenty fast to accurately handle a multi-day orbit around a lagrange point or a low energy transfer. The paths the craft take should look completely normal.

If you then combine a normal single-influence orbit with that force vector, you could summarize 1000 seconds of orbit into one moderately complex equation. So instead of doing a moderately complex calculation every 10 seconds, you'd do two of them every 1000 seconds, an estimated 50x CPU savings.

If you're not very close to anything, there's no benefit over just running an n-body calculation every 1000 seconds. But the hard-to-handle case is orbits that are low enough to need rapid updates, but high enough that it's noticeably wrong to use an ellipse. And it's easy to end up with a lot of things in those orbits.

> Wouldn't that arguably be where the most significant errors would be, as that's where the relatively unphysical constant force vector would have the most significant influence?

Treating the forces as constant over a stretch of time, when they actually are almost constant, shouldn't have all that much error, unless I'm missing something glaring.

As you get further and further away from the most influential mass, this system gets closer and closer to simply being an n-body simulation with a timestep of how often you update the force vector.

Re: Orbit Tessellation developer diary for Kerbal Space Program 2

#80
post #29

One of the things KSP taught me is that orbital mechanics aren't that complicated, but even so, pretty much all movies and TV shows about space were written by someone who doesn't even know the basics.

Often, artistic license take over actual physics, even when the writer knows about the field, he will prefer do it in a way that fits the plot.

I mean, even Interstellar, with a Nobel Prize on board sometimes forgoes scientific accuracy for nicer pictures.

There is also a game about accuracy, viewer expectations, and attention. For example, most people will thing that the best way to land from orbit is to point the ship towards the ground is fire the thrusters, obvious right. If the ship points 90 degrees away, people will ask themselves why. If orbital mechanics is central to your movie, that's good, but you may have some explaining to do. If you are in the middle of an epic space battle, it is not the time for a physics lesson, so go for the obvious (and wrong) and let the viewer focus on the action.

Post reply on HN