Fixed double vision problem in foreground orbits

Report bugs, bug fixes and workarounds here.
Topic author
doctorjoe
Posts: 76
Joined: 23.05.2005
With us: 19 years 6 months
Location: Austin, Texas

Some astrophysics

Post #21by doctorjoe » 04.07.2005, 05:57

There is some astrophysics involved here. The moons close in to the large planets are strongly influenced by the planet's gravitational field and the oblateness of the planet and so they settle down into nice flat orbits.

There is however a "halo" of captured asteroids that are further away. They are less tightly bound to the planet and so have more diverse orbits.

The same thing happens at the solar system scale ( with the Oort cloud) and at the galactic scale where you have a disk and a halo.

BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 19 years 8 months
Location: Los Angeles, CA

Post #22by BlindedByTheLight » 04.07.2005, 07:45

Hey guys... haven't had a chanec to check the patches... out of town for a week. But looking forward to the changes. Happy 4th!
Steven Binder, Mac OS X 10.4.10

Topic author
doctorjoe
Posts: 76
Joined: 23.05.2005
With us: 19 years 6 months
Location: Austin, Texas

Performance

Post #23by doctorjoe » 04.07.2005, 16:04

One thing to keep in mind is that I'm running on a machine that is very graphically slow, so I'm not likely to see major slowdowns.

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years

Re: Performance

Post #24by dirkpitt » 07.07.2005, 00:00

doctorjoe wrote:One thing to keep in mind is that I'm running on a machine that is very graphically slow, so I'm not likely to see major slowdowns.


I'll try and benchmark your updated patch this weekend.

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years

Re: Thanks

Post #25by dirkpitt » 09.07.2005, 10:08

doctorjoe wrote:I think that the saturn rendering is correct and what you are seeing are some background moon orbits. I looked at the item with celestia 1.4pre6 and the rendering is the same.

I've got a good guess as to what caused the slow down. Basically to simplify the code I changed it so that elliptical orbits used the same sampling code as the custom orbits and this involves calculating the time based location which is slow.


The speed has not improved significantly, unfortunately. Also, the "orbits on top of the planet"
issue is definitely there, and it looks like a miniature version of the planet's own moon orbits
are being duplicated on top of the planet at a certain distance. Another issue that may be related
is the planet's own orbit path is drawn on top of the planet when I zoom in very close to the
planet itself.

Topic author
doctorjoe
Posts: 76
Joined: 23.05.2005
With us: 19 years 6 months
Location: Austin, Texas

Try new patch

Post #26by doctorjoe » 09.07.2005, 16:30

I've upload dirkpitt.patch to the celestia pages. I've turned off a few things and I'd like to see if it help. Any profile information you can get will be very useful.

If you don't see any speed up, go into orbit.cpp and change

OrbitAngleThresholdProc defaultOrbitThresholdProc(1.0);

to

OrbitAngleThresholdProc defaultOrbitThresholdProc(5.0);

to see if this help


There are two things that could be broken.

1) I'm calculating orbits in a very different way
2) I'm trying to get the foreground rendering right.

Topic author
doctorjoe
Posts: 76
Joined: 23.05.2005
With us: 19 years 6 months
Location: Austin, Texas

Screenshot

Post #27by doctorjoe » 09.07.2005, 16:32

Can you post a screenshot of the moon on top of planets problem?

I'm not seeing it at all in my version,

Topic author
doctorjoe
Posts: 76
Joined: 23.05.2005
With us: 19 years 6 months
Location: Austin, Texas

One final thing

Post #28by doctorjoe » 09.07.2005, 16:38

You'll have to install the gototime.diff patch from my patch set to get it to compile cleanly.

Topic author
doctorjoe
Posts: 76
Joined: 23.05.2005
With us: 19 years 6 months
Location: Austin, Texas

Looking at patches

Post #29by doctorjoe » 09.07.2005, 17:15

I'm not seeing a slow down on my system. I'm pretty sure that whatever is causing the double moon on your system is also causing the slow down. If you can post that picture, we can try to figure out why the patches act differently.

Also, you are starting from a clean CVS build and then applying the patches, correct?

Topic author
doctorjoe
Posts: 76
Joined: 23.05.2005
With us: 19 years 6 months
Location: Austin, Texas

Another experiment

Post #30by doctorjoe » 09.07.2005, 17:22

Try setting the rendering path to basic and see if the double moon problem disappears. I'm pretty sure that the double orbit problem and the slowdown are related.

Topic author
doctorjoe
Posts: 76
Joined: 23.05.2005
With us: 19 years 6 months
Location: Austin, Texas

Uploaded new patches

Post #31by doctorjoe » 10.07.2005, 01:05

It's a bit difficult to try to fix a bug that I can't reproduce, but I've made some changes that code improve things.

The new patches

1) reduce the orbit sample rate to what it used to be
2) change the order of the commands slightly which may or may not fix the double moon problem
3) Force a refresh of the frames per second value once every 10 seconds

Interested to know if they improve things.

Also, I have to turn smooth orbits off in order to run on my machine. My graphics card does not do hardware color blending and turning on smooth orbits kills the machine. I'd be interested in seeing if turning off smooth orbits drastically improves performance.

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years

Re: Looking at patches

Post #32by dirkpitt » 10.07.2005, 16:24

doctorjoe wrote:I'm not seeing a slow down on my system. I'm pretty sure that whatever is causing the double moon on your system is also causing the slow down. If you can post that picture, we can try to figure out why the patches act differently.


I found the bottleneck: GL display lists. Here is the "top 6" list from a typical GL profile (performed with Apple's OpenGL Profiler) with the orbit patch:

GL Function;# of Calls;Total Time (?sec);Avg Time (?sec);% GL Time;% App Time
glEndList;22,273;6778903;304.36;71.26;14.01
glDeleteLists;22,110;1899766;85.92;19.97;3.93
glNewList;22,273;740322;33.24;7.78;1.53
glGetFloatv;22,273;37346;1.68;0.39;0.08
glGenLists;22,273;26849;1.21;0.28;0.06
glIsList;44,383;20920;0.47;0.22;0.04

glEndList hogs up to 14% of the total application time. A corresponding time profile of the application itself (performed using Apple's Shark application) suggests that there are a lot of repeated memory allocations/deallocations that correspond to these gl*List calls and these are incurring a very high overhead.

To confirm this, I removed all the gl*List calls and replaced them with a direct call to renderOrbit() (like in previous versions of your orbit patch). This resulted in frame rates roughly similar to the unpatched Celestia, or about 10x the speed.

All my tests were done with the Basic render path, and smoothed lines (which incur a negligible performance penalty on my machine).

By comparison, without the patch:

GL Function;# of Calls;Total Time (?sec);Avg Time (?sec);% GL Time;% App Time
glBegin;195,803;1295357;6.62;27.36;1.04
glVertex3f;15,400,075;1255558;0.08;26.52;1.01
glEnd;195,802;512320;2.62;10.82;0.41
glDrawArrays;536;428052;798.61;9.04;0.34
glVertex3fv;2,676,808;365148;0.14;7.71;0.29
glDrawElements;22,642;338514;14.95;7.15;0.27


I haven't had time to really diagnose what's causing the double orbit problem but it appears to be unrelated to the slowdown. Here are screenshots:

saturn01.jpg

When I pan to the right, the doppelganger drags along with the mouse:

saturn02.jpg

My machine: Apple PowerBook G4 15" 1.33GHz, 768M RAM, ATI Mobility Radeon 9700 64M VRAM, OpenGL 1.5.

Topic author
doctorjoe
Posts: 76
Joined: 23.05.2005
With us: 19 years 6 months
Location: Austin, Texas

Wow, that was useful.

Post #33by doctorjoe » 10.07.2005, 19:10

Let me try to fix the display list problem first. What I can try to do is to cache the display list so that once it is created, it get shared between frames. Right now, the display list is only used to redraw the foreground orbits.

The double orbit looks like it is trying to redraw the solar orbit with saturn as the sun.

Does it happen when you turn rendering path to basic?

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years

Re: Wow, that was useful.

Post #34by dirkpitt » 10.07.2005, 21:02

doctorjoe wrote:The double orbit looks like it is trying to redraw the solar orbit with saturn as the sun.

Does it happen when you turn rendering path to basic?


Yes.

Topic author
doctorjoe
Posts: 76
Joined: 23.05.2005
With us: 19 years 6 months
Location: Austin, Texas

Uploaded new code

Post #35by doctorjoe » 10.07.2005, 23:27

Let me know if this helps the speed. If it doesn't, I've got something else that I can try.

Topic author
doctorjoe
Posts: 76
Joined: 23.05.2005
With us: 19 years 6 months
Location: Austin, Texas

Something else to try.

Post #36by doctorjoe » 11.07.2005, 03:20

Try turning off moon orbits and planet orbits separately and see what that does to the double,

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years

Post #37by dirkpitt » 11.07.2005, 08:10

I'm not sure if I'm doing this correctly because both the moon orbits and planet orbit automatically switch on if I select the planet. What I did manage to achieve was switch off both planet and moon orbits, which switches on just the planet orbit when I select a planet. When I do this, the doppelganger disappears (i.e., no moon orbits, no doppelganger).

Topic author
doctorjoe
Posts: 76
Joined: 23.05.2005
With us: 19 years 6 months
Location: Austin, Texas

Ahhhhh!!!!

Post #38by doctorjoe » 11.07.2005, 14:03

Thats probably why I'm not seeing the problem. I'm selecting the planet. Let me try some things this evening.

BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 19 years 8 months
Location: Los Angeles, CA

Post #39by BlindedByTheLight » 13.07.2005, 02:53

doctorjoe... I actually was unable to build the latest patches from 7-11-05 (running Mac OS X 10.4.2 now - if that makes a difference) because I am unable to build the latest code from CVS

Here is a pic of the error I got:

Image

I'm guessing some of the new stuff Chris uploaded is causing the difficulty?
Steven Binder, Mac OS X 10.4.10

Topic author
doctorjoe
Posts: 76
Joined: 23.05.2005
With us: 19 years 6 months
Location: Austin, Texas

Got the same error

Post #40by doctorjoe » 13.07.2005, 07:57

Looks like stuff is being checked in.

Will try again tomorrow.


Return to “Bugs”