Orbit automatic smoothing?

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Orbit automatic smoothing?

Post #1by ElChristou » 22.06.2007, 19:44

To avoid this effect (see picture below) without setting 500 points in 0rbitPathSamplePoints (cfg), no way to write some kind of behavior to increase the number of points only in the zone of the curve being too accented?
It would be nice to use 100 points wisely instead of 100 points at equal distance...
Possible?

Image
Image

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

Post #2by ElChristou » 22.06.2007, 19:50

Or what about concentrating the points in the on screen part of the orbit?
With 30 points only a curve would looks quite nice almost all the time...
Image

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

Post #3by Cham » 22.06.2007, 20:00

Since I know very well the maths of curves, I think this would be very hard to code. In the case of ellipses, there may be some simpler tricks, but I'm very sceptic. Of course, only the dev team could certify this.
"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
ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #4by ElChristou » 22.06.2007, 20:05

...but the gain could be cool (or not?) in case of global view of hundreds of asteroids for example... (for 100 bodies, if only 30 points are used instead of the official 100, 3000 points total vs 10000...)
Image

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

Post #5by Cham » 22.06.2007, 20:12

Personaly, I'm using a pretty high number of points for all my orbits. I never tested rigorously the impact on the frame rate, but since it appears to be relatively minor on my system, I did not worry about it.
"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
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Post #6by t00fri » 22.06.2007, 20:24

From time to time I tend to write a post suggesting cubic splines for these problem zones...and then Chris L. tends to reply with arguments that I did not understand up to now ;-)

Bye Fridger
Image

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

Post #7by ElChristou » 22.06.2007, 20:34

Cham wrote:Personaly, I'm using a pretty high number of points for all my orbits. I never tested rigorously the impact on the frame rate, but since it appears to be relatively minor on my system, I did not worry about it.


How much? because this is a 800 points orbit...

Image

I remember asking for splines but I don't recall exactly why it wasn't possible (haven't search the thread :oops:)

If splines are a problem, the concentration of 30 points would result pretty neat even on the above image.

100 bodies 800 points = 80000 points vs 3000... I suppose it would do a difference :?
Image

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

Post #8by Cham » 22.06.2007, 20:38

In my .cfg file, I'm using these parameters :

Code: Select all

OrbitPathSamplePoints  1024
  RingSystemSections     256

  ShadowTextureSize      1024
  EclipseTextureSize     256
"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
ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #9by ElChristou » 22.06.2007, 20:59

just tried out 1300 points (which don't solve completely the problem in the above view) and it definitively makes a huge difference on my system I cannot move anything with heavy catalogues! :x

(I was saying 30 points would be enough for an orbit in full view, I wasn't right, 70/80 are necessary to simulate a soft curve...)
Image

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

Post #10by chris » 22.06.2007, 21:52

t00fri wrote:From time to time I tend to write a post suggesting cubic splines for these problem zones...and then Chris L. tends to reply with arguments that I did not understand up to now ;-)


But how would you suggest we use splines? The answer would be obvious if graphics hardware could directly render splines, but current GPUs do not. The sample points for an orbit path are just calculated once, then reused every time the orbit is rendered. Rendering an orbit path is just a matter of sending the sample points to the graphics card. Calculating splines just adds an extra step: when rendering the orbit, the code would have to break the splines down into line segments first, then send them to the graphics hardware.

There are some things that can be done to increase the performance of orbit rendering so that we can just send more points. In addition, I think that the code for rendering elliptical orbits can be modified to use more sample points in regions of high curvature.

--Chris

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

Post #11by ElChristou » 22.06.2007, 21:59

chris wrote:...There are some things that can be done to increase the performance of orbit rendering so that we can just send more points. In addition, I think that the code for rendering elliptical orbits can be modified to use more sample points in regions of high curvature.


It's exactly what I was trying to express! :P :wink:
Image

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

Post #12by t00fri » 22.06.2007, 22:09

chris wrote:
t00fri wrote:From time to time I tend to write a post suggesting cubic splines for these problem zones...and then Chris L. tends to reply with arguments that I did not understand up to now ;-)

But how would you suggest we use splines? The answer would be obvious if graphics hardware could directly render splines, but current GPUs do not. The sample points for an orbit path are just calculated once, then reused every time the orbit is rendered. Rendering an orbit path is just a matter of sending the sample points to the graphics card. Calculating splines just adds an extra step: when rendering the orbit, the code would have to break the splines down into line segments first, then send them to the graphics hardware.

There are some things that can be done to increase the performance of orbit rendering so that we can just send more points. In addition, I think that the code for rendering elliptical orbits can be modified to use more sample points in regions of high curvature.

--Chris


How about "Non-Uniform Rational B-Splines" (NURBS) or perhaps simpler Bezier splines? I guess they can be rendered in OpenGL (NURBS renderer, evaluators).

Also couldn't we use a rough approximation to the gradient of the orbit as a measure for the required number of sample points. Small gradients <=> few sample point, big gradients more sample points...

Bye Fridger
Image

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

Post #13by chris » 22.06.2007, 22:26

t00fri wrote:
chris wrote:
t00fri wrote:From time to time I tend to write a post suggesting cubic splines for these problem zones...and then Chris L. tends to reply with arguments that I did not understand up to now ;-)

But how would you suggest we use splines? The answer would be obvious if graphics hardware could directly render splines, but current GPUs do not. The sample points for an orbit path are just calculated once, then reused every time the orbit is rendered. Rendering an orbit path is just a matter of sending the sample points to the graphics card. Calculating splines just adds an extra step: when rendering the orbit, the code would have to break the splines down into line segments first, then send them to the graphics hardware.

There are some things that can be done to increase the performance of orbit rendering so that we can just send more points. In addition, I think that the code for rendering elliptical orbits can be modified to use more sample points in regions of high curvature.

--Chris

How about "Non-Uniform Rational B-Splines" (NURBS) or perhaps simpler Bezier splines? I guess they can be rendered in OpenGL.


There are OpenGL functions to render various curves, but these functions just produce lists of line segments. It's faster just to precompute the line segments and skip the intermediate spline representation of the orbit path. Now, the spline representation can be more compact, but memory usage for orbit paths hasn't been a big problem so far.

Here are the things that I think need to be investigated:

- Increasing the number of sample points: speed up orbit rendering so that more sample points can be used without hurting performance. Orbits paths are currently rendered using OpenGL immediate mode functions, which are much slower than vertex arrays and vertex buffer objects.

- Better sampling of elliptical orbits, so that more sample points are used in regions of high curvature.

- Adaptive subdivision of orbit paths. Calculate and render extra samples when the observer is close to the path. The problem is that determining the distance from the observer to an arbitrary curve is rather tricky.

--Chris

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

Post #14by ElChristou » 22.06.2007, 22:28

Well using a solution or another, IMHO it's one of the stuff that should be fix before working on new features. It's a very old issue reported many times and one of the last bad point of Celestia... (and I don't see this in the roadmap...)
Image

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

Post #15by Cham » 22.06.2007, 22:31

There's a similar thing that should be done for the comets. Their model is extremelly crude ! It should adapt it's shape with the scale (distance to the user), like what is already done for the planets.
"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
ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #16by ElChristou » 22.06.2007, 22:40

Cham wrote:There's a similar thing that should be done for the comets. Their model is extremelly crude ! It should adapt it's shape with the scale (distance to the user), like what is already done for the planets.


Is there really an interest for comets? you can increase the number of point describing their geometry in render.cpp. I don't think it will represent a problem for FPS (not much comets can be rendered simultaneously)...
Image

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

Post #17by Cham » 22.06.2007, 22:44

On the contrary. The impact on the frame rate is HUGE ! Just try it !

I've already done it before and the effect is striking. :-(

Changing the number of points affects ALL comets at the same time, and it doesn't depends on the observer's distance.
"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
ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #18by ElChristou » 22.06.2007, 22:49

Cham wrote:On the contrary. The impact on the frame rate is HUGE ! Just try it !

I've already done it before and the effect is striking. :-(

Changing the number of point affetcs ALL comets at the same time, and it doen't depends on the observer's distance.


knowing you for sure you pass from 16 to 4096 points! :wink:

Well if the difference is so huge, definitively something should be done... :?
Image

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

Post #19by Cham » 22.06.2007, 22:56

Even a change from 16 to 32 had a significant effect on the frame rate. And yet, I don't have that much comets installed !

A change from 16 to 24 just isn't worth it. It still very crude.
"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!"

dhromed
Posts: 10
Joined: 24.06.2007
With us: 17 years 5 months
Location: Netherlands

Post #20by dhromed » 30.06.2007, 22:19

The bodies themselves ride their orbits in smoothly, without visible segmenting in their movements.

It's a rather large visible discrepancy; seeing a planet move through space at several times its own width removed from the drawn orbit curve, while the curve undulates from side to side as segments pass.

So can basic orbit data not be used to draw orbit curves as well?
= zonk =


Return to “Development”