Stellarium, showing my C38 image

For some reason there are relatively well known objects without a picture in Stellarium‘s database. It is a free project, a fruition of many people’s voluntary work, so no offence. It is well documented how to add new pictures on this page but I found no easy way to be productive at this task. Plus, there are some problems one needs to overcome in order to succeed.

There are extension packs, but I didn’t find C38 (NGC4565) in them. I wanted to include this particular galaxy. I wrote this for version 0.15.

File structure

In the Stellarium folder (in windows, it is c:\program files\stellarium\nebulae\default) there are two kinds of files. The images themselves, and data files, among them the textures.json file. As the name shows, it is a json file easily editable with a text editor. The images should be 2^k (ie 64, 128, 256, 512, 1024…) pixel size, squared, png files. Do note that the square does not mean one has to limit the field of view: it is not the picture file that holds the aspect ratio information, but the coordinates.

The trick is that these pictures need to be rotated and morphed to the virtual sphere’s surface. For narrow field images (smaller than the full moon) no significant projection errors occur, but large objects should be broken up into smaller, overlapping tiles. But all the images need to be plate solved.

Plate solving

c38 zoom in, the stars belong to stellarium

One needs to correlate pixels and celestial coordinates to paint the texture correctly. In this case, Stellarium uses four coordinates for the four corners of the image. In my workflow I cropped an image with enough star patterns as context for plate solving to work. I made use of nova.astrometry.net which, on success, produces a Google Earth – in our case a Google Sky – compatible .kmz file. At this stage, my picture was not yet a square 2^k png – it was an ordinary jpeg with the correct aspect ratio and of some pizelsize. Moving the mouse around in Google Sky, at any zoom level, one gets the exact coordinates of the rotated and morphed picture’s corners and these can be copied. After these steps, the picture file can be resampled into the 2^k square png – again, the aspect ratio is held by the celestial coordinates of the picture, not the picture’s pixels.

Creating the JSON entry

Stellarium provides a link to a fairly basic tool that produces a json entry from the text fields filled in by the user, making some coordinate validation and conversion too. However, it has a nasty bug: the float to string implementation. In my language, Hungarian, contrary to English, when being official, we use a comma to mark the fractions, so PI starts like 3,1415 instead of 3.1415 as in English notation. The json float expects a dot no matter what, but the provided program takes language locale into account, so the float to string function produces [253,9125, -41,5956] as a coordinate pair – which is nonsense. But: is perfectly legal json, so it took me a while to figure out where the sand is between the gears.

Adding the image as a nebula entry

The textures.json file describes an object (curly braces stand for objects – ie key-value pairs, square brackets for arrays – ie enumerations), and usually starts like this:

 {
 "shortName": "Nebulae",
 "description": "The default set of low resolution nebula images shipped with Stellarium. Most of those images are kindly contributed by the <a href='http://www.grasslands.org/'>Grasslands Observatory</a> with addition from various contributors.",
 "minResolution" : 0.05,
 "alphaBlend" : true,
 "subTiles" : [

where the “subTiles” array is of our interest. subTiles is an array of objects which describe the image tiles. Below are my entries, which I added to the beginning of the array. The images can be downloaded from this link. To create a smooth transition, now that the picture is plate solved, the corners and unwanted parts of the picture can be made black with image editing tools such as GIMP.

 

{
"imagecredits" : {"Short":"vnp","infoUrl": "csillagtura.ro"},
"imageUrl" : "vnp_caldwell_76.png",
"worldCoords" : [[[253.9125, -41.5956], [253.8417, -42.1239], [253.1833, -42.0722], [253.2625, -41.5433]]],
"textureCoords" : [[[0,0], [1,0], [1,1], [0,1]]],
"minResolution" : 2,
"maxBrightness" : 6
},
{
"imagecredits" : {"Short":"vnp","infoUrl": "csillagtura.ro"},
"imageUrl" : "vnp_caldwell_75.png",
"worldCoords" : [[[249.1675, -40.8617], [245.9050, -42.6692], [243.6133, -40.1942], [246.7967, -38.4467]]],
"textureCoords" : [[[0,0], [1,0], [1,1], [0,1]]],
"minResolution" : 2,
"maxBrightness" : 7
},


{
"imagecredits" : {"Short":"vnp","infoUrl": "csillagtura.ro"},
"imageUrl" : "vnp_caldwell_38.png",
"worldCoords" : [[[189.3042, 25.7331], [188.8000, 25.7331], [188.8000, 26.1492], [189.3042, 26.1492]]],
"textureCoords" : [[[0,0], [1,0], [1,1], [0,1]]],
"minResolution" : 1,
"maxBrightness" : 12
},
{
"imagecredits" : {"Short":"vnp","infoUrl": "csillagtura.ro"},
"imageUrl" : "vnp_pok_legy.png",
"worldCoords" : [[[83.4833, 34.5164], [82.5667, 33.4592], [81.2708, 34.2175], [82.1792, 35.2867]]],
"textureCoords" : [[[0,0], [1,0], [1,1], [0,1]]],
"minResolution" : 1,
"maxBrightness" : 12
},

{
"imagecredits" : {"Short":"vnp","infoUrl": "csillagtura.ro"},
"imageUrl" : "vnp_caldwell_20.png",
"worldCoords" : [[[317.0375, 41.3628], [308.4833, 42.3358], [309.0833, 46.5872], [318.2667, 45.5408]]],
"textureCoords" : [[[0,0], [1,0], [1,1], [0,1]]],
"minResolution" : 10,
"maxBrightness" : 7
},

NGC 7000 North America Nebula, C 20

facebooktwittergoogle_plusredditpinterestlinkedinmail