[Kstars-devel] KStars vs Stellarium - Graphics

James Bowlin bowlin at mindspring.com
Fri Jun 6 19:46:03 CEST 2008


On Fri June 6 2008, Akarsh Simha wrote:
> fter I upgraded my RAM, Stellarium finally runs on my system now. I
> notice that Stellarium gives a nicer view of the skies, more
> graphically appealing. I'm not talking about the local horizon,
> ground decorations, texture-mapped milky way etc, but about the way
> stars are drawn. I think this should be easy to implement in KStars.

IIRC, the main difference in the look is because Stellarium is using the 
OpenGL graphics interface and we are not.

> I notice that:
>
> 1. Stellarium has a different computation for relating limiting
> magnitude to zoom factor. If I point my binoculars to Lyra, I should
> probably be seeing more stars than KStars currently shows from a dark
> site. I think Stellarium shows far too many stars, but that seems to
> look better.

If I understand you correctly, perhaps this is already solved since the 
density of stars on the screen is adjustable in KStars.  You can 
control it with "faint limit zoomed in" and the "faint limit zoomed 
out" in the catalog tab of the config menu.  I (or someone else?) 
cobbled together a quick and dirty formula to interpolate between these 
two limits at the top of the StarComponent::draw() routine that now 
looks like:

    if ( lgz <= 0.75*lgmax )
        maglim -= (Options::magLimitDrawStar() -
                   Options::magLimitDrawStarZoomOut() ) *
                  (0.75*lgmax - lgz)/(0.75*lgmax - lgmin);

    m_zoomMagLimit = maglim;


There is also code there for controlling the star label density:


    float sizeFactor = 10.0 + (lgz - lgmin);

    double labelMagLim = Options::starLabelDensity() / 5.0;
    labelMagLim += ( 12.0 - labelMagLim ) * ( lgz - lgmin) / (lgmax -
        lgmin );

    if ( labelMagLim > 8.0 ) labelMagLim = 8.0;


I just fiddled with these until it looked okay to me with various 
settings of the limits and various zoom levels.  The star label density
above controls how many star labels are sent to the SkyLabeler.  It is
the SkyLabeler that eventually sets the over-all label density.  You
can control this with the F (decrease) and G (increase) keys.  The B
key prints out some cryptic stats about the label density.

IMO this code and the UI for it will need to change after you extend the
catalog.  IMO there should be just one slider called "star density". For
example, for any fixed position of this slider, KStars could try to draw 
a fixed number of stars per pixels^2.  If we did this "right" then the 
slider could actually be calibrated in units of stars/100 pixels^2 or 
such.

It's an interesting problem.  If the stars were all in just one list
(no trixels) then it would be easy to solve it exactly by knowing how
many pixels were in the current star map which would then tell us the
exact number of stars we want to draw to achieve the specified star
density.  It could turn out that this is not what people want and
actual magnitude thresholds are more intuitive, but that is part of
what makes the problem interesting.  I still think a single "star 
density" slider is the way to go even if it is not calibrated.

> 2. Stellarium draws real-coloured stars by drawing a disk
> proportional to the size, with fuzzy edges. We have two solid
> colours, while they implement some sort of gradual transition. Is
> this possible to implement?

They get this effect easily because they are using the OpenGL interface.

Here are some examples of using OpenGL with QT:
http://doc.trolltech.com/4.1/examples.html#opengl-examples

IMO, adding OpenGL to KStars might be a good 2009 GSoC project.  But
Jason probably knows a lot more about this than I do.


-- 
Peace, James


More information about the Kstars-devel mailing list