3d Spline orbits

The place to discuss creating, porting and modifying Celestia's source code.
Avatar
Topic author
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 6 months
Location: Hamburg, Germany

3d Spline orbits

Post #1by t00fri » 17.03.2004, 08:34

With the achieved improvements undisputed, the recently
incorporated method of improving the precision
of orbit displays reminds me of a tank battle :roll: [latest CVS, 1.3.2.pre7(?)].

Here is an illustration of Saturn's orbit for three values
of OrbitPathSamplingPoints: 100 (default), 500 and 1000.
Image

Here is the full scene:
cel://Follow/Sol:Saturn/2004-03-17T06:56:32.79479?x=gEVCBPSTCK2eDA&y=SvZH1bjGY9T+/////////w&z=9TQ8qKejSJt0/////////w&ow=0.597533&ox=0.368405&oy=-0.707047&oz=0.085538&select=Sol:Saturn&fov=47.787090&ts=1.000000<d=0&rf=120759&lm=0

Aparently the present default of 100 OPSP's produces
really kinky displays in many places! With the present method
it takes a factor of 10 more OPSP's for a really decent orbit display.
Accordingly, the fps rate is bound to drop drastically: by a factor of 1.6
in the present example 100 -> 1000 OPSP's!

In view of this poor "convergence", everyone knowing
about numerical math algorithms would thus start
to explore better, alternative methods...

In cases were the generation of exact points is comparably
"expensive", it is usually much faster to use
3d (cubic) Spline interpolation of a
relatively low number of OPSP's!
.

Unlike standard interpolation algorithms, Splines have
many advantages, whence scientists use them exclusively for similar tasks:

-- Splines can handle rapid variations smoothly and cheaply!

-- Splines are "local" interpolations in the sense that only
a few exact points around the interpolated point are
used, rather than the full table of sampled values!

-- There exist extremely fast Spline code templates
(even in assembler :wink: ), because Splines are such
important tools.

I have not had the time to study Kendrix' code in detail,
but I though I make these comments to stimulate
perhaps some discussions about this issue.

Bye Fridger

maxim
Posts: 1036
Joined: 13.11.2003
With us: 20 years 10 months
Location: N?rnberg, Germany

Post #2by maxim » 17.03.2004, 10:36

I'm not too deeply familiar with splines to contribute much, but I think having a spline function library integrated into Celestia would give a spinoff for other improvements too. I think of rings, models(?), camera movement, ...

maxim :)

marc
Posts: 426
Joined: 13.03.2002
With us: 22 years 6 months
Location: Outback Australia

Post #3by marc » 17.03.2004, 13:25

This is a great idea Fridger, I'm no expert but I remember reading that splines are supported by OpenGl. Maybe its as simple as switching to GlSpline rather than GlLine.

Paolo
Posts: 502
Joined: 23.09.2002
With us: 22 years
Location: Pordenone/Italy

Post #4by Paolo » 17.03.2004, 13:35

In my old feature request at
http://members.xoom.virgilio.it/pangeli ... Orbits.htm
I was asking for this improvement.

GLU allows to manage Bezier splines and Nurbs surfaces.

A brief example is available at:
http://www.gametutorials.com/Tutorials/ ... GL_Pg4.htm

Bye - Paolo
Remember: Time always flows, it is the most precious thing that we have.
My Celestia - Celui

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

Post #5by t00fri » 17.03.2004, 17:14

Paolo wrote:In my old feature request at
http://members.xoom.virgilio.it/pangeli ... Orbits.htm
I was asking for this improvement.

GLU allows to manage Bezier splines and Nurbs surfaces.

A brief example is available at:
http://www.gametutorials.com/Tutorials/ ... GL_Pg4.htm

Bye - Paolo


Hi Paulo,

sorry I did not look into your site. I work with Splines in
different contexts since decades :wink: . So when I need
to talk about them, I normally do not look for further info.

I had not followed this lengthy discussion about Kendrix'
'wonder code' said to produce great precision orbits.
Had I known, I would have brought up Splines earlier...

The OpenGL examples/ tutorials you quoted, seem fun to
play with. Notably, since on my Laptop, I have VS.net (version 7) installed and can just start exploring the
tutorial. Of course, it's great that OpenGL supports
Splines! No wonder, since its the only good solution :wink:

Bye Fridger

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

Post #6by chris » 18.03.2004, 17:16

Splines could be useful for rendering orbits paths if they are adaptively sampled based on distance from the viewer. I may have a look at this in a week or so (unless someone else beats me to it.) In the mean time, there's a very obvious way to improve the performance of orbit rendering which I'll look at later today.

--Chris

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

Post #7by t00fri » 18.03.2004, 21:36

chris wrote:Splines could be useful for rendering orbits paths if they are adaptively sampled based on distance from the viewer. I may have a look at this in a week or so (unless someone else beats me to it.) In the mean time, there's a very obvious way to improve the performance of orbit rendering which I'll look at later today.

--Chris


Chris,

I am a little confused. Splines are never sampled. Splines are a means to /interpolate/ sampled exact orbit points. It's the exact orbit points that have to be adaptively sampled...

The task is to replace /linear/ interpolation with all its inefficient features by Spline interpolation. That's all as far as I can see.

Bye Fridger

PS: How can I make the Saturn shadow less dark?
It's just not right...(given Grant's rings, of course). But I believe in Grant's rings... Where in the code is the blackness set?

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

Post #8by chris » 18.03.2004, 22:25

t00fri wrote:
chris wrote:Splines could be useful for rendering orbits paths if they are adaptively sampled based on distance from the viewer. I may have a look at this in a week or so (unless someone else beats me to it.) In the mean time, there's a very obvious way to improve the performance of orbit rendering which I'll look at later today.

--Chris

Chris,

I am a little confused. Splines are never sampled. Splines are a means to /interpolate/ sampled exact orbit points. It's the exact orbit points that have to be adaptively sampled...

OpenGL doesn't rasterize splines directly. Instead, they're subdivided into straight line segments. So, what Celestia could do is generate a set of splines that interpolate the sampled orbit points; then at rendering time, these splines would be rendered by subdividing them into line segments, with the degree of subdivision dependent on the curvature and projected size of the spline.

--Chris


The task is to replace /linear/ interpolation with all its inefficient features by Spline interpolation. That's all as far as I can see.

Bye Fridger

PS: How can I make the Saturn shadow less dark?
It's just not right...(given Grant's rings, of course). But I believe in Grant's rings... Where in the code is the blackness set?[/quote]

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

Post #9by t00fri » 18.03.2004, 23:11

chris wrote:
t00fri wrote:
chris wrote:Splines could be useful for rendering orbits paths if they are adaptively sampled based on distance from the viewer. I may have a look at this in a week or so (unless someone else beats me to it.) In the mean time, there's a very obvious way to improve the performance of orbit rendering which I'll look at later today.

--Chris

Chris,

I am a little confused. Splines are never sampled. Splines are a means to /interpolate/ sampled exact orbit points. It's the exact orbit points that have to be adaptively sampled...

OpenGL doesn't rasterize splines directly. Instead, they're subdivided into straight line segments. So, what Celestia could do is generate a set of splines that interpolate the sampled orbit points; then at rendering time, these splines would be rendered by subdividing them into line segments, with the degree of subdivision dependent on the curvature and projected size of the spline.

--Chris


Sorry, for being still not with you:

You say above "Instead, they're subdivided into straight line segments.". Splines are curve segments the shape of which depends on 3-4 points, an initial one, a final one and 1-2 "control" points that determine the curvatures of that curve segment.

So how can a Spline be "subdivided into straight line segments"?

Bye Fridger

PS: You overlooked my PS above:

Where in the CVS code can I make the B-ring shadow less black??

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

Post #10by chris » 19.03.2004, 04:59

t00fri wrote:Sorry, for being still not with you:

You say above "Instead, they're subdivided into straight line segments.". Splines are curve segments the shape of which depends on 3-4 points, an initial one, a final one and 1-2 "control" points that determine the curvatures of that curve segment.

So how can a Spline be "subdivided into straight line segments"?
Lots of very short line segments are used to approximate the curve. From a quality standpoint, dividing the curve into lines no longer than a pixel width is ideal. But, that's not practical . . . Nor is it really necessary, as you can get satisfactory results with longer line segments.


PS: You overlooked my PS above:

Where in the CVS code can I make the B-ring shadow less black??
[/quote]

Look at the function renderRingShadowsVS() in render.cpp and find this line:

float alpha = 1.0f;

The blackness of the ring shadows is equal to the ring texture opacity times alpha. If you want lighter ring shadows, you can set alpha to a lower value. 0.0 will make them disappear entirely, 0.5 will make them half as dark as they are currently. In Celestia 1.3.1, the darkness of the rings was set to:

(1.0 - abs(ri.sunDir_obj.y)) * c

where c is some constant between 0 and 1. This expression had the effect of making the ring shadow darkness darker the closer the rings were to being edge on to the sun. There's some justification for this hack--sunlight travels further through the rings when they're edge on. But mostly I did it so that Saturn looks like it does in the Voyager images when the rings are edge on to the sun without introducing the dark broad bands that you're unhappy with now. My feeling is that the dark bands are in fact correct, albeit very unfamiliar to us. I've a feeling they'll seem much more natural once we're barraged with images from Cassini.

--Chris

Falck
Posts: 48
Joined: 04.07.2002
With us: 22 years 2 months

Post #11by Falck » 19.03.2004, 07:48

t00fri wrote:
Sorry, for being still not with you:

You say above "Instead, they're subdivided into straight line segments.". Splines are curve segments the shape of which depends on 3-4 points, an initial one, a final one and 1-2 "control" points that determine the curvatures of that curve segment.

So how can a Spline be "subdivided into straight line segments"?



When you compute the formula for a spline, you get the exact functions that interpolates between two points in the interpolated data. However, when you have to draw those lines, you have to do it with a lot of little straight lines, since (at least until now) only straight lines were drawn in the code itself.


Return to “Development”