New trajectory plotting code

Discussion forum for Celestia developers; topics may only be started by members of the developers group, but anyone can post replies.
Topic author
chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

New trajectory plotting code

Post #1by chris » 10.08.2009, 21:28

The SVN version of Celestia contains orbit plotting code that has been completely rewritten since 1.6.0. It fixes many shortcomings in the 1.6.0 code:

- Objects would often appear many thousands of kilometers from the orbit path
- Orbits were clipped near the camera
- Very large orbit paths (e.g. the Pluto-Charon barycenter) would appear to 'jitter' when the camera was close by
- Orbits paths of planets and moons weren't updated for the current simulation time
- Artifacts would appear when the ends of approximately periodic orbits were joined. Many people have complained here about the strange appearance of the Moon's orbit.

Here's a screen shot of Cassini and its trajectory plotted with the new code:

cassini-orbit.jpg


Notice that the spacecraft appears exactly on its trajectory. If you try this with 1.6.0, you'll see that the spacecraft is actually quite far from it's trajectory. Another advantage of the new code is speed: I've observed a 2x performance increase when drawing complex trajectories like Cassini's.

If you're able to build Celestia from the code in SVN, here few useful comparisons with the new orbit rendering code and 1.6.0:

- Cassini: observe how the spacecraft remains precisely on the orbit path with the patched code
- Eros: in the 1.6.0, the asteroid is shown thousands of kilometers from even a simple elliptical orbit. Fixed with the patch.
- Moon: the orbit path is constantly updated so that the Moon never appears to drift away. The odd 'jump' in the orbit is gone (actually, just hidden--see below)
- Pluto: travel to Pluto and display the orbit of the Pluto-Charon barycenter. With the patch, the jittering is gone.

The new trajectory plotting code works by drawing the orbit as a sequence of adaptively subdivided cubic curves. This is not an especially novel approach, but it's quite a task to make the code 1) fast, and 2) work well on graphics hardware that only supports single precision floating point arithmetic. Single precision is completely inadequate for the task of orbit plotting. A single precision float has a 23-bit significand, giving a precision of roughly one part in 8 million. Since Saturn is about 1.5 billion kilometers from the Sun at aphelion, the plotting error will be about +/- 100km. This error isn't so noticeable when showing the orbit of Saturn, which is much larger than 100km. However, it's a serious problem for a spacecraft a few meters across.

--Chris

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: New trajectory plotting code

Post #2by t00fri » 11.08.2009, 07:17

Nice!

It seems my old proposal of using cubic splines has now found its perfect realization (via adaptive sampling).

viewtopic.php?f=4&t=4672&p=33855&hilit=spline#p33855

Fridger
Image

duds26
Posts: 328
Joined: 05.02.2007
Age: 34
With us: 17 years 9 months
Location: Europe

Re: New trajectory plotting code

Post #3by duds26 » 16.08.2009, 10:44

Can this approach also be used to solve the accuracy issues of distant objects?
e.g. stars in a far away cluster, galaxies or even whole clusters.

Planets and other objects around that star?

Solving the accuracy problem for drawing far objects with this approach would be really fantastic.

DOJOMO
Posts: 49
Joined: 10.08.2005
With us: 19 years 3 months

Re: New trajectory plotting code

Post #4by DOJOMO » 03.09.2009, 14:40

Celestia has given me a huge amount of pleasure. My increasingly poor eyesight has made me cautious when ever I think something is not right (in this, at least, I have been proved right).
My computer is old and antiquated as you can see but still produces wonderful results for me.
However
Since the introduction of the new plotting code which is excellent, my FPS has roughly halved. My installation is Celestia 1.6 with the latest executable SVN 4863 which I got from abramson (Many thanks to him) . I have a number of addons and vt textures but nothing too large to cause serious slow down. Using the 1.6 executable I get about 14-20 FPS when viewing Earth but if I use SVN 4863 I get 6-7 FPS. SVN 4787 is the 14-20 FPS figure also. I know all is very slow but the extra loss of performance is a pity.

I wonder if you have any suggestions (a new machine would be nice but out of range at the moment).

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Re: New trajectory plotting code

Post #5by selden » 03.09.2009, 15:45

DOJOMO,

Just to be clear:
Is this loss of performance seen only when Orbit paths have been enabled in the Render/View Options menu?
Or does Celestia run more slowly whether or not Orbits are enabled?
Selden

Topic author
chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Re: New trajectory plotting code

Post #6by chris » 03.09.2009, 16:19

DOJOMO:

What sort of CPU do you have in your computer? The new code benefits greatly when SSE2 vector instructions are enabled. However, some older processors don't support SSE2, and so sse2 isn't enabled in the Visual C++ project in SVN.

--Chris

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: New trajectory plotting code

Post #7by Cham » 03.09.2009, 17:04

As already reported to Chris by email, I'm also experiencing a huge slowdown with the newest code, while using exactly the same installation (with addons) as for the official 1.6.0. And yet, my computer isn't that old (it's actually a very powerfull computer with a strong video card).
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

DOJOMO
Posts: 49
Joined: 10.08.2005
With us: 19 years 3 months

Re: New trajectory plotting code

Post #8by DOJOMO » 03.09.2009, 17:11

Thanks for the speedy response.
First of all an apology. I assumed my signature and hardware details would show at the bottom of my post. It should now.
Secondly the FPS is virtually constant whether orbits are enabled or not. (I have just tested it again after the usual wait it settled at about 5.6 FPS in both cases.
Finally, I purchased the machine in the middle of 2002. I guess this may be the explanation. A bit like me - old age.

David
Celestia svn 5178
Sony Vaio VPCF12c5E laptop Intel(R) Core(TM) i5 CPU M 450 @ 2.4GHz, 500gb hard drive, 1Gb nvidea GeForce GT 330M GPU Open GL 2.0, Windows 7 Professional 64 bit. Fully updated.

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Re: New trajectory plotting code

Post #9by selden » 03.09.2009, 19:17

It looks like there was a substantial loss of performance between r4842 and r4845. I keep copies of builds that I've done, and I ddn't build either of the two intermediate versions.

Viewing Saturn, with and without orbits being drawn,:

v1.6.0: 83 / 102 (no sse2)

with sse2:
r 4814: 87 / 110
r 4824 86.5 / 112
r 4834 97 / 117
r 4842: 97 / 117
r 4845 77 / 86
r 4854 77 / 87
r 4864 77 / 85

These measurements were done just now. (just after 3PM EDT 2 Sep 09)
I ran r4842 again at the end and it had the same performance as before, so I don't think the performance loss is due to the graphics hardware overheating and slowing its clock.

System:
2 GB 1.86 GHz Core2Duo E6300, Win XP Pro SP3
128MB Quadro FX 550, ForceWare v169.47
1600x1200 display, vertical sync disabled.
Selden

Avatar
cartrite
Posts: 1978
Joined: 15.09.2005
With us: 19 years 2 months
Location: Pocono Mountains, Pennsylvania, USA Greate Grandfother from Irshava, Zakarpattia Oblast Ukraine

Re: New trajectory plotting code

Post #10by cartrite » 03.09.2009, 19:31

I think Chris
Enabled anisotropic filtering for planet textures (when supported by hardware.)
That may account for the loss of fps. That was r4843.
cartrite
VivoBook_ASUSLaptop X712JA_S712JA Intel(R) UHD Graphics 8gb ram. Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz, 1190 Mhz, 4 Core(s), 8 Logical Processor(s) 8 GB ram. Running on Windows 11 and OpenSuse 15.4

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: New trajectory plotting code

Post #11by t00fri » 03.09.2009, 19:41

cartrite wrote:I think Chris
Enabled anisotropic filtering for planet textures (when supported by hardware.)
That may account for the loss of fps. That was r4843.
cartrite

I doubt that. Even with my old card, I barely feel 8x anisotropic filtering. I did lots of respective tests in the past, since I always apply anisotropic filtering as an efficient remedy against polar pinching...

But I seem to remember that Chris experimented with various improved algorihms that vastly increased the number of knots?

Fridger
Image

Topic author
chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Re: New trajectory plotting code

Post #12by chris » 03.09.2009, 20:06

cartrite wrote:I think Chris
Enabled anisotropic filtering for planet textures (when supported by hardware.)
That may account for the loss of fps. That was r4843.
cartrite

It's possible that anisotropic filtering is at fault. It doesn't significantly affect performance on my system, and Fridger has reported similar results. However, the performance characteristics of anisotropic filtering have varied dramatically among different NVIDIA and ATI GPUs. The only other change that happened between 4842 and 4845 was a fix for the XCode project, which only affects the Mac.

To test whether anisotropic filtering is causing the slowdown, try disabling it by changing line 149 in texture.cpp from this:

Code: Select all

if (GLEW_EXT_texture_filter_anisotropic)


to

Code: Select all

if (false)


Ultimately, the user will have control over the anisotropic filtering level via a GUI control panel. Despite the performance drop, I still believe that it should be on by default, as it dramatically improves texturing quality in the area near a planet's poles.

--Chris

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: New trajectory plotting code

Post #13by t00fri » 03.09.2009, 20:47

OK with my old fx5900 ultra card, I get these results for Earth located in the window center, right after startup

1) 8x anisotropic filtering: 33.4 fps
2) "if (false)": 38.4 fps

All overriding AA etc effects are switched off in NVIDIA control.
There is an effect but not dramatic. I don't feel a big slowdown if I switch on the new orbits (along with plenty of asteroids!)

Fridger
Image

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Re: New trajectory plotting code

Post #14by selden » 03.09.2009, 20:50

Anisotropic filtering was the cause of my slowdown.
After recompiling, I now get 87 / 116 fps (with/without orbit paths)
[correction 97 / 116. I misread.]

I suspect it's at least part of the cause of DOJOMO's slowdown, too, since he has older hardware. SSE2 emulation probably contributes, too.

I just now deleted celestia.vcproj and downloaded a fresh copy. SSE2 code generation is enabled in Celestia -- RMB -- Properties -- C/C++ -- Code Generation/
Selden

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: New trajectory plotting code

Post #15by t00fri » 03.09.2009, 21:07

It is clear that anisotropic filtring will give rise to SOME slowdown (see also my data). But I always found that it is quite small compared to AA filtering by a respective factor Nx

There is NO free lunch anywhere ;-)

Fridger
Image

DOJOMO
Posts: 49
Joined: 10.08.2005
With us: 19 years 3 months

Re: New trajectory plotting code

Post #16by DOJOMO » 03.09.2009, 21:16

Thanks Selden.
My ansiotropic filtering control in the nVidea GeForce 2Go graphics processor properties has only 2 choices:-
Application or 2X.
It makes no difference to the performance which is selected. I assume therefore if it is a factor I can't turn it off unless some option is intriduced in Celestia.exe.
Is that a possibility?

Thanks to all
David
Celestia svn 5178
Sony Vaio VPCF12c5E laptop Intel(R) Core(TM) i5 CPU M 450 @ 2.4GHz, 500gb hard drive, 1Gb nvidea GeForce GT 330M GPU Open GL 2.0, Windows 7 Professional 64 bit. Fully updated.


Return to “Ideas & News”