Page 1 of 1

Smooth high precision orbits patch

Posted: 01.11.2007, 22:53
by chris
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

Posted: 02.11.2007, 01:15
by Cham
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.

Posted: 02.11.2007, 01:27
by chris
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

Posted: 02.11.2007, 01:38
by Cham
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.

Posted: 02.11.2007, 01:51
by Cham
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.

Posted: 02.11.2007, 01:52
by chris
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

Posted: 02.11.2007, 01:58
by Cham
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 ?

Posted: 02.11.2007, 02:15
by Cham
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.

Posted: 02.11.2007, 02:32
by selden
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]

Posted: 02.11.2007, 02:35
by Cham
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.

Posted: 02.11.2007, 09:39
by Christophe
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.

Posted: 02.11.2007, 10:41
by phoenix
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

Posted: 02.11.2007, 11:04
by ElChristou
That seems crazy but this patch do nothing on my config! (still have the hard edges...) Is this possible?

Posted: 02.11.2007, 11:16
by Vincent
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 ?

Posted: 02.11.2007, 11:27
by ElChristou
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...

Posted: 02.11.2007, 11:38
by ElChristou
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)

Posted: 02.11.2007, 12:09
by Vincent
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

Posted: 03.11.2007, 19:49
by chris
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