Orbits and Labels colors

The place to discuss creating, porting and modifying Celestia's source code.
Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #41by Cham » 16.06.2007, 21:45

Great ! I'm building right now ! ;-)

back in few min.
"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 #42by t00fri » 16.06.2007, 21:51

The new label colors start around line 7219 with a switch statement...

Bye Fridger
Image

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

Post #43by Cham » 16.06.2007, 21:56

Fridger,

it's working great ! Superb !

However, don't you think the colors used (nebulas and globular clusters) are too vivid ? I'll try to find some better combinaisons for them.

We may have to modify some databases (I think it's from Selden's addons), since I don't have any AbsMagn defined for the globular clusters.
"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 #44by t00fri » 16.06.2007, 22:03

Cham wrote:Fridger,

it's working great ! Superb !

However, don't you think the colors used (nebulas and globular clusters) are too vivid ? I'll try to find some better combinaisons for them.

I did not have time yet to play with the colors. I tend to use a more "maron"-type red for nebulae. The openclusters color was just a dummy value to be replaced any time by a better proposal!
We may have to modify some databases (I think it's from Selden's addons), since I don't have any AbsMagn defined for the globular clusters.


Well now one needs to do a little more thinking. Diffuse nebulae (including M42) are usually not characterized by AbsMag values in professional catalogs, for good reasons. Perhaps there is a more physical criterion for implementing label fading (e.g. distance instead of magnitude). Also for planets for which Chris had adapted my previous galaxy label mechanism, there may be a better alternative.

Bye Fridger
Image

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

Post #45by Cham » 16.06.2007, 22:08

This modification is very good : I'm already able to spot some errors in nebulas and globular clusters placements. Some addons places the nebulas at some distance, while the labels (from another database, I guess) are placed at a different location. The discrepancies are all small, but I couldn't see them before. Now I see them. This is good.

EDIT : Yes, distance is a better parameter to use for the label fadding, instead of the AbsMagn.
"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
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #46by Cham » 16.06.2007, 23:23

Fridger,

here are the colors I've found for the nebulas and the clusters :

Code: Select all

Nebulas labels :

      0.85, 0.35, 0.29

Clusters labels :

      0.38, 0.71, 0.58


These colors are in "harmony" with all the others. Of course, the fadding effect over distance should help a lot, especially in the case of the nebulas, since their labels are VERY dense (I should check back from what database I'm getting all those nebulas).
"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 #47by t00fri » 16.06.2007, 23:53

Not bad indeed. But the green cluster color is somewhat close to the fading galaxy label color...

Bye Fridger
Image

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

Post #48by Cham » 17.06.2007, 00:08

t00fri wrote:Not bad indeed. But the green cluster color is somewhat close to the fading galaxy label color...


If I make the clusters labels greener, it will be too close to the locations labels. If I make them bluer, they will be too close to some other labels.

Since a cluster is almost a kind of "mini-galaxy", it make sense that their label color isn't too far away from the galaxies labels. The galaxies labels appear to be "bluish", while the clusters labels appear to be "greenish".

EDIT : I'm still discovering how much the new labels are usefull : I just noticed that I have some doubles in my installation. Few Messier nebulas were defined twice and placed at different locations. Seeing separately the nebulas, globular clusters and galaxies is VERY neat !
"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
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #49by Cham » 17.06.2007, 06:50

MAD SCIENTIST EXPERIMENT :mrgreen:

I tried some code hacking, just for fun. Since the galaxies and the nebulas+clusters aren't at the same scale, I added a transparency effect of my own to your code (around line 7211) and it worked ! (my mother would be proud of me ! ;-) ). Well, it really isn't perfect. It's not even right, just a hack to see how it's working (particle physicists do it very often : smashing atoms to see what's inside ;-) )

Code: Select all

{
        // introduce distance dependent label transparency.
        float distr = 6.0f * (labelThresMag - appMag)/labelThresMag;
        //(float)log10(1.0f + 1.2e-6f * distanceToDSO);
        if (distr > 1.0f)
            distr = 1.0f;

   // A mad and losy experiment in code hacking
   float ChamDistr = (1 - log10(1.0f + 1.2e-5f * distanceToDSO)/log10(2));
        if (ChamDistr > 1.0f)
            ChamDistr = 1.0f;
   // End of code hacking !

    Color labelColor;
    bool showLabel;
    switch (dso->getLabelMask())
        {
           case Renderer::GalaxyLabels:
                labelColor = Color(0.10f, 0.85f, 0.85f, distr);
                showLabel = true;
                break;           
           case Renderer::OpenClusterLabels:
               labelColor = Color(0.38f, 0.71f, 0.58f, ChamDistr);
                showLabel = true;
                break;
            case Renderer::NebulaLabels:
                labelColor = Color(0.85f, 0.35f, 0.29f, ChamDistr);
                showLabel = true;
                break;
          }             

                       
       renderer->addLabel(dsoDB->getDSOName(dso),
                           labelColor,
                           Point3f(relPos.x, relPos.y, relPos.z));
    }


According to this code hack, the nebulas and clusters labels are fadding away nicely when the observer is moving out. Well, it isn't fadding as it should (the scale isn't right and it doesn't take into account the FOV, and all labels are fading uniformly all the same).
"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 #50by t00fri » 17.06.2007, 16:17

Cham wrote:MAD SCIENTIST EXPERIMENT :mrgreen:
...


That's unfortunately no good, Cham...The label appearance is
now very abrupt since you still use the
magnitude-dependent threshold condition.

if ((labelMask & labelMode) && appMag < labelThresholdMag && dot(relPos, viewNormal) > 0)

There are other deficiencies as well...

Bye Fridger
Last edited by t00fri on 17.06.2007, 16:45, edited 1 time in total.
Image

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

Post #51by t00fri » 17.06.2007, 16:43

Here is a status report of what I did today.

I quite essentially rearranged and optimized the code, also
allowing this way for individual threshold conditions for all 3
DSO types.

Here is my modified render.cpp for playing
http://www.celestiaproject.net/~t00fri/images/render.cpp.zip

The relevant piece of the code is here

Code: Select all

    unsigned int labelMask = dso->getLabelMask();
   
    if ((labelMask & labelMode) && dot(relPos, viewNormal) > 0)
    {
    Color c;
    float appMagEff = 6.0f;
    switch (labelMask)
        {
            case Renderer::NebulaLabels:
                c = Color(0.85f, 0.35f, 0.29f);
                appMagEff = astro::absToAppMag(-8.0f, (float) distanceToDSO);
                break;
            case Renderer::OpenClusterLabels:
               c = Color(0.38f, 0.71f, 0.58f);
               appMagEff = astro::absToAppMag(-8.0f, (float) distanceToDSO);
                break;
            case Renderer::GalaxyLabels:
            default:
                c = Color(0.1f, 0.85f, 0.85f);
                appMagEff = appMag;
                break;                  
        }
        if(appMagEff < labelThresholdMag)
        {
           // introduce distance dependent label transparency.
           float distr = 6.0f * (labelThresholdMag - appMagEff)/labelThresholdMag;
           if (distr > 1.0f)
               distr = 1.0f;                               
           renderer->addLabel(dsoDB->getDSOName(dso),
                              Color(c.red(),c.green(),c.blue(),distr),
                              Point3f(relPos.x, relPos.y, relPos.z));
       }
    }


Now the fading labels for Nebulae and OpenClusters
exclusively rest on DISTANCE. Hence an AbsMag entry is
NOT required anymore! Note the variable
labelThresholdMag ONLY depends on
FoV and the actual sky brightness. The new object that is
used for comparison is appMagEff. For
Nebulae and OpenClusters, I used the trick that I assigned a
fixed (suitable) absolute Magnitude = -8.0f in the
conversion method from apparent mag to absolute mag,

Code: Select all

appMagEff = astro::absToAppMag(-8.0f, (float) distanceToDSO)


This way distance is converted into an effective apparent magnitude,
but the dependence is only on distance since the absolute
mag is FIXED = -8.0f.

Next I used 2 nice data file add-ons by Selden
for adjusting the fading properly

73 Planetary Nebulae
http://www.lepp.cornell.edu/~seb/celest ... ebulae.zip

and
Globular clusters
http://www.lepp.cornell.edu/~seb/celest ... usters.dsc

First of all, I replaced the type Galaxy in the
globular_clusters file by the correct OpenCluster
designation, since now things work correctly!

Here is the modified file for you to use (assuming that Selden agrees...):

http://www.celestiaproject.net/~t00fri/images/ ... usters.dsc

Next I PERL-extracted the distances for both Planetary
nebulae and globular clusters and plotted the distance
distribution using Maple's Statistics package:

Image
Image

I read off the distance where most objects cluster and
implemented the result in the above code.

Finally, here are a number of neat images, showing what
happens with the respective labels when I approach the
MilkyWay!. Note also how well the GlobularClusters and
Nebulae fit the arms including the central bar!!

The red labels are the planetary nebulae, the green
ones are the globular clusters.
. The green cross
denotes the position of Sol!

Enjoy,
Bye Fridger

No labels yet....(being too far away)
Image
Aha! Here they are...
Image
And in a close-up view
Image
Last not least: sideways view!
Image

Edit
Note that Selden's OpenCluster data file from the Messier catalog
http://www.lepp.cornell.edu/~seb/celest ... usters.dsc
also fits nicely into the scene!
Image

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

Post #52by Cham » 17.06.2007, 17:38

Fridger,

It is all working very well. Do you think that the DSO labels are now finished and ready to be commited to CVS ?

The only labels that still need to have a transparency effect are the asteroids and comets.


I'm now having a database problem with lots of duplicates. I'm using Selden's databases on Messier objects and other files, and I'll have to inspect all of them to remove the duplicates.
"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 #53by t00fri » 17.06.2007, 17:41

In principle, the stuff is ready for CVS, except we should wait for Chris' comments (notably about the new colors!)

I suppose he's in the mountains again over the weekend...

Bye Fridger
Image

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

Post #54by Cham » 17.06.2007, 18:09

Fridger,

I think the label fading needs an adjustement. The nebulas and clusters labels are fading a bit too abruptly at a distance of around 75 kpc from the MW. Also, the labels are too crowdy, if we use Selden's databases (globular_clusters.dsc and openclusters.dsc) :

Image
"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 #55by t00fri » 17.06.2007, 18:23

Martin,

Yes I am aware of this. But we have to make a compromise: It's easy to slow down the display of new labels for increasing zoom. But then one looses the very instructive overview including the MilkyWay arms.

I chose to accept some crowdedness, in order to retain some "global" views. I am uncertain what is preferrable.

Bye Fridger
Image

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

Post #56by Cham » 17.06.2007, 18:54

Fridger,

after more testings, I think the labels should start fadding at a shorter distance. You can still have a global view of the MW while seeing the nebulas/clusters labels (partialy faded out), and it would help a bit to reduce the labels congestion. The fadding steps should also be a bit larger (so the labels don't fade away too abruptly).
"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 #57by t00fri » 17.06.2007, 19:07

Cham wrote:Fridger,

after more testings, I think the labels should start fadding at
a shorter distance. You can still have a global view of the
MW while seeing the nebulas/clusters labels (partialy faded
out), and it would help a bit to reduce the labels congestion.
The fadding steps should also be a bit larger (so the labels
don't fade away too abruptly).



Why don't you try it yourself? Then I get a feel for what you
have in mind. I think it's a big compromise to start the
fading earlier.

Let's also fix a standard display setup for the MilkyWay:


With CTRL+mouse_L adjust to a distance of 250 Kp
With SHIFT+mouse_L adjust to 2.0 degrees FoV.

That is a good display for a start.

If you want to have the fading at an earlier distance,
increase the absolute Mag entry from -8.0f to -6.0f, say.

Recompile

Bye Fridger
Image

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

Post #58by Cham » 17.06.2007, 19:22

I'm recompiling.

The new labels are helpfull to find duplicates. I've found many duplicates or objects with different names and exactly the same location in several of Selden's databases (labels overlapping and unreadable). It's almost a mess !

I'm also experiencing some strange behavior of the Orion nebula (only this one!) : it's blinking while I rotate around 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 #59by t00fri » 17.06.2007, 19:29

Cham wrote:I'm recompiling.

The new labels are helpfull to find duplicates. I've found many duplicates or objects with different names and exactly the same location in several of Selden's databases (labels overlapping and unreadable). It's almost a mess !

I'm also experiencing some strange behavior of the Orion nebula (only this one!) : it's blinking while I rotate around it !


I am confused: recompiling should only take a FEW SECONDS, if you only change a few things in a routine!! You should never do a complete recompile, but just type 'make'.

If you want to print out variables, e.g. var1, var2, var3, to the console, while operating Celestia, insert into the code at the appropriate place:

cout<<var1<<" "<<var2<<" "<<var3<<endl;

and look what appears in the console!
Bye Fridger
Image

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

Post #60by Cham » 17.06.2007, 19:33

Fridger,

it DOES takes only few sec. It's just that's I'm doing lots of things at the same time : reading and responding on the forum, compiling and restarting Celestia, testing, etc... :wink:

EDIT : Actually, I'm also doing several recompilations with different parameters, so testing them all takes some time...
"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!"


Return to “Development”