Stellarium / stellarium

Stellarium is a free GPL software which renders realistic skies in real time with OpenGL. It is available for Linux/Unix, Windows and macOS. With Stellarium, you really see what you can see with your eyes, binoculars or a small telescope.
https://stellarium.org
GNU General Public License v2.0
7.83k stars 830 forks source link

Sky image incorrect distortion at some coordinates #359

Open alex-w opened 6 years ago

alex-w commented 6 years ago

Original report by Sibi Antony: https://bugs.launchpad.net/stellarium/+bug/1026263

Some of the sky images are severely incorrectly distorted at some of the sky coordinates. The attachments explain everything. It may not be easy to spot the problem with a normal square nebula/planet texture. So I made a transparent image with 'Stellarium' written on it.

If the problem is not easily noticed, drag around the sky a bit, and you might chance upon that easily. Most often, I've noticed the incorrect distortion while the image is moved towards the centre of the screen, though I'm not very sure on the problem characteristic.

I also have the equatorial grid for reference. When the image is loaded with loadSkyImage() it must be distorted according to the equaotorial refernce frame.

gzotti commented 6 years ago

I have modified this texture with a grid pattern.

stellarium-025 klein

The distortion is nothing but weird, but the problem is neither in scripting nor in projections per se. It is in StelSkyImageTile. Is this just a misapplication with a far too large quad?

Script:

// Script to identify a problem with StelSkyImageTile
// See original from https://bugs.launchpad.net/stellarium/+bug/1026263
// GZ has changed the square texture with a grid which better shows the effects
LandscapeMgr.setFlagAtmosphere(false);

//core.loadSkyImage("image1", "tests/stellarium.png", 
//      120, 5, // ra=8h, dec=5d centre
//      4500, 0, // angSize, rotation
//      15, 10, // minRes, maxBright
//      true, "EqDate");

// Alternative loading with 4 corners.
// Interesting: Corners and edges are OK, the central area gets strangely distorted. 

core.loadSkyImage("image1", "tests/stellarium.png", 
        150, -30, 
        90, -30, 
        90, 30, 
        150, 30,
        15, 10, // minRes, maxBright
        true, "EqDate");
core.wait(30);
core.removeSkyImage("image1"); 

Here is the image:

stellarium

After loading, move the view to see variable distortion. Also change projections.

gzotti commented 6 years ago

I am afraid I am stuck with this. @guillaumechereau , @xalioth any insight what is happening here? Or even a fix?

The edges are great circles, this is technically OK even though they don't follow the declination arcs (which are small circles). But what happens in the inner area? Where is the odd tessellation happening?

xalioth commented 6 years ago

Is this a regression?

gzotti commented 6 years ago

Not really. The original report on Launchpad is from 2012, but the OP's screenshot did not even show the total amount of distortion. I tried several times to dive into the StelSkyImageTile / MultiLevelJsonBase classes, but get easily lost. (I still have not found the critical class or architecture documentation, also for all these metadata in the JSON files which could apparently be handled with that class.) I do not know how what the user configures as textured rectangle with 4 vertices becomes tessellated into such very bad coordinates. Probably the usual application of these classes is just small DSO images, so it never appeared so bad. But there can be some demo applications where an image, neatly embedded into the sky, can be valuable, so I hope one of you remembers, can have a look and fix that.