Smooth high precision orbits patch

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Smooth high precision orbits patch

Post #1by chris » 01.11.2007, 22:53

Tired of sharp angles in your orbit paths? Then try this patch:

http://www.celestiaproject.net/~claurel/celest ... othorbits/

To use it, you need to have the latest version of the source from CVS. Then, replace your versions of render.h and render.cpp with the ones in the patch directory.

The high precision orbits patch is included with this one. I'm interested in performance and bug reports. The smoothing is adaptive, applied only to segments of the orbit near the camera. The distance at which smoothing gets applied may need some tuning. Lastly, in this test patch, the smoothing may be toggled on and off by pressing Ctrl+E (eclipse shadows--it's just temporary) The improvement can be quite profound (examples are with orbit segments set to 100 in celestia.cfg):

Image
Image

--Chris

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

Post #2by Cham » 02.11.2007, 01:15

Chris,

I've tested this patch. The frame cost is VERY high. After turning ON the asteroids and comets orbits, I'm getting a severe FPS drop. I see clearly the differences, when I use the ctrl-E command.
"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!"

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

Post #3by chris » 02.11.2007, 01:27

Cham wrote:Chris,

I've tested this patch. The frame cost is VERY high. After turning ON the asteroids and comets orbits, I'm getting a severe FPS drop. I see clearly the differences, when I use the ctrl-E command.


Thanks trying it out . . .

I'm not seeing that much of a drop. Still, it's possible that the code to adaptively enable smoothing is causing the smoothing to be used too often. How many orbits approximately are you showing? And what value do you have OrbitPathSamplePoints set to in celestia.cfg.

--Chris

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

Post #4by Cham » 02.11.2007, 01:38

chris wrote:adaptively enable smoothing is causing the smoothing to be used too often. How many orbits approximately are you showing? And what value do you have OrbitPathSamplePoints set to in celestia.cfg.


I have tons of comets and asteroids (I don't know exactly how many). Probably several hundreds.

Smoothing is set to OrbitPathSamplePoints 1024 in the config file. I'll try with a lower value.
"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!"

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

Post #5by Cham » 02.11.2007, 01:51

I just lowered the orbit smootheness to 256, and tested the comets orbits only (about 160 comets). The frame cost is still pretty high : using ctrl-E, I can see a change of about a factor 2 in FPS.
"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!"

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

Post #6by chris » 02.11.2007, 01:52

Cham wrote:I have tons of comets and asteroids (I don't know exactly how many). Probably several hundreds.

Smoothing is set to OrbitPathSamplePoints 1024 in the config file. I'll try with a lower value.


OK. Something is definitely going wrong and the smoothing is being applied too often in cases where the orbit segment isn't visible. Nevertheless, youre a madman for running with OrbitPathSamplePoints that high. It's nice to hear that the smoothing helps even then.

--Chris

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

Post #7by Cham » 02.11.2007, 01:58

chris wrote:Nevertheless, youre a madman for running with OrbitPathSamplePoints that high. It's nice to hear that the smoothing helps even then.


Yes, I know. I used a high value to smooth the old orbits, since I was seeing all the polygonal orbits.

Even with a smootheness set to 256, I can see a clear frame rate cost.

What value are you using ?
"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!"

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

Post #8by Cham » 02.11.2007, 02:15

Chris,

I've found something very odd.

I set the orbit path smootheness to 128, and found a comet with a distorded elliptical path : c1996 B2 (Hyakutake). It's really an horror. Try its SSC definition, with smootheness set to 128 :

Code: Select all

# C/1996 B2 (Hyakutake)
"C1996 B2 (Hyakutake)" "Sol"
{
   Class "comet"
   Mesh "telesto.cmod"
   Texture "comet1.jpg"
   Radius 3.0      # guess
        Albedo 0.1
   EllipticalOrbit
   {
      Period             113774.190671
      PericenterDistance      0.2302042979120773
      Eccentricity            0.999901956774384
      Inclination           124.9227060156376
      AscendingNode         188.057703178702
      ArgOfPericenter       130.1729309148325
                MeanAnomaly             0.0
      Epoch             2450204.892527377
   }

   RotationPeriod    16 # Guess value
   InfoURL "http://ssd.jpl.nasa.gov/cgi-bin/eph"
}


EDIT : Here's another one, with extreme orbital deformation anomaly :

Code: Select all

# C/1965 S1 (Ikeya-Seki)
# very bright, "sun-grazing"
# (very small pericenter distance)
"C1965 S1 (Ikeya-Seki)" "Sol"
{
   Class "comet"
   Mesh "desdemon.cmod"
   Texture "asteroid3.jpg"
   Radius 1.5      # in km; guess
        Albedo 0.1
   EllipticalOrbit
   {
      Period              876.515372   # T=(q/(1-e))^1.5
      PericenterDistance    0.007785
      Eccentricity          0.999915
      Inclination         141.8576
      AscendingNode       346.2963
      ArgOfPericenter      69.0499
                MeanAnomaly           0.0
      Epoch           2439054.68   # 1965 Oct 21
   }

   RotationPeriod    16 # Guess value
   InfoURL "http://ssd.jpl.nasa.gov/cgi-bin/eph"
}


Just watch the orbit close to the Sun. Using ctrl-E shows a huge difference in shape. This is a clear indication that something is terribly wrong with that new code.
"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!"

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

Post #9by selden » 02.11.2007, 02:32

I'm sorry to report that the orbit smoothing code has another problem: it puts bumps in orbits, too.

Here's what it does to the initial segment of Cassini's orbit:

Image

The bump comes and goes depending on the viewpoint. Here's a Cel:// url to see it:

cassini hits a bump
[edit]This is with the default number of orbit segments.[/edit]
Last edited by selden on 02.11.2007, 02:35, edited 1 time in total.
Selden

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

Post #10by Cham » 02.11.2007, 02:35

selden wrote:I'm sorry to report that the orbit smoothing code has another problem: it puts bumps in orbits, too.


This is exactly what I was indicating in my previous message.
"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!"

Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

Post #11by Christophe » 02.11.2007, 09:39

I'm seeing the same sharp drop in frame rate. About 30% with asteroid orbits off, and over 50% when on.

It also does not completely solve the problem of the orbit not going through the body, especialy in the case of small bodies.
Christophe

phoenix
Posts: 214
Joined: 18.06.2002
With us: 22 years 5 months
Location: Germany - Berlin

Post #12by phoenix » 02.11.2007, 10:41

I can confirm a 100% drop in framerates from synced constant 60 fps down to 20-30 fps depending on how many orbits are shown.

using 100 samplepoints and the standard celestia-cvs data files.

it seems your limitation that only draws the smooth orbit when in close range is buggy.

I went to saturn showing only planet and moon orbits and my fps got down to 35 even tho only saturn itself got a smoothed orbit.

switching with ctrl+E doesn't visibly touch any other orbit but saturn's.

the fps drop starts when I get closer than 0.1 AU to the planet
most recent celestia win32-SVN-build - use at your own risk (copy over existing 1.5.1 release)

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #13by ElChristou » 02.11.2007, 11:04

That seems crazy but this patch do nothing on my config! (still have the hard edges...) Is this possible?
Image

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #14by Vincent » 02.11.2007, 11:16

ElChristou wrote:That seems crazy but this patch do nothing on my config! (still have the hard edges...) Is this possible?

Same problem on my system, with nearly the same graphics as Christophe (no OpenGL 2 available):
Image

Chris, is this patch supposed to work with all render paths ?
Last edited by Vincent on 02.11.2007, 11:32, edited 1 time in total.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #15by ElChristou » 02.11.2007, 11:27

Vincent wrote:
ElChristou wrote:That seems crazy but this patch do nothing on my config! (still have the hard edges...) Is this possible?
Same problem on my system, with nearly the same graphics as Christophe (no OpenGL 2 available):
Chris, is this patch supposed to work with all render paths ?


Vince, I think, we French men have a problem... CTRL-E!

:oops:

Sorry, works fine now...
Image

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #16by ElChristou » 02.11.2007, 11:38

No major FPS drop on my poor config with default package. The orbits ARE MUCH better of course. A few issues with moons/astero/comets... (not precisely on their orbits)
Image

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #17by Vincent » 02.11.2007, 12:09

ElChristou wrote:Vince, I think, we French men have a problem... CTRL-E!

:oops:

Sorry, works fine now...

Christophe, I think that we shouldn't sit anymore in the back of the classroom, near the radiators, dreaming about stars and galaxies... We should start listening to the teacher...:wink:
Sorry chris, works great for me too... :roll:

I can mainly notice no FPS drop at all. Just a drop of ~20% in this particular case:
Image
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

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

Post #18by chris » 03.11.2007, 19:49

Thanks for all the testing and comments. I think that I've determined what's causing the weird 'bumps' in the orbits. Optimizing the code so that it doesn't draw segments out of view will take longer however.

--Chris


Return to “Development”