Creating a bespoke landscape for Stellarium

I use Stellarium on several PCs and laptops to help me plan what I’m going to attempt to observe and for finding objects in the sky when I can’t find them from other pictures or star maps. It’s a great program and I heartily recommend it. It allows the user to select a number of landscapes to render the stars against and, if you can work out how, it also lets you create your own. I found a few sets of instructions on how to do so using Windows, but I’m a UNIX/Linux person so needed a way that would work for me (though as I’m just using hugin and the gimp, this may well work on Windows, too). Here’s what I did.

First take a sequence of shots with a camera from the viewpoint you’ll be using to create a panorama. Ideally choose a day on which the sky is a uniform colour because we’ll want to get rid of it later. If the sky is the same colour as anything else in the image then things will get a bit more awkward later. You need a full 360° with plenty of overlap in each shot — a third is good. I started with north at one edge of the first photograph, because I know exactly which direction that is, but it’s not a major problem wherever you start. Try to keep the horizon in roughly the same place in each photo; it probably helps with lining things up later to keep it in the middle of the shot. You don’t need a particularly good camera. I used an Ixus 40 in manual mode so I could force the same exposure settings for each photograph, although I suspect that it may help to leave auto white balance on. I also took the images in a portrait orientation rather than landscape because I wanted as much of the ground in the shot as possible. My pictures were taken without a tripod or other rest. I suspect it may help to use one, but quite a few things can be fixed later on. I usually have my scope in a field, so I took an extra shot of the grass to use to fill in any missing ground, but if you’re in a garden or on a patio, a few shots from around your feet might be useful just to fill in any gaps later on. This gave me 17 panorama shots of around 2200×1700 pixels to work with. We’ll need them smaller later on, but for the moment transfer them to the PC and keep them in the original format and resolution because the software will be pulling useful information out of them.

The next stage was to stitch all of the photographs together into a panorama. For this I used the “hugin” panorama creator which is available as a package for Ubuntu (my current desktop OS of choice). I loaded the panorama images in from the “Assistant” tab and then skipped straight to the “Control Points” tab which is where you run through the photographs creating control points (no surprises there) that allow hugin to join all the photographs together. If you’re not that familiar with hugin that’s no problem. Neither am I. And despite that it even managed to get the images the correct way up. Select the first image from the drop-down on the left and the second image from the one on the right and pick out a few points (I try to get five as far apart as possible) that appear in both images. Make sure the “auto fine tune” and “auto estimate” options are selected at the bottom right of the window. Click on the first in one image and adjust the position of the cross to get it on an exact spot you can identify, then click on the second image and move the cross to exactly the same place. If you get the cross in roughly the right place, hugin can often locate the exact position for you. Once you’re happy, click “Add” and move on to the next point. After the first point is in place, hugin will usually suggest where it thinks subsequent ones will be, which makes life far easier. When you’re happy with these two images, click on the right arrow between the two drop-downs of image names to move on to the next photograph in the set and repeat the process until they’re all done. Do create control points to link the last image back to the first one.

Once you’ve selected all your control points, move to the “Optimiser” tab and click “Optimise Now!”. At this point you can see roughly what you’ve got by clicking on the “Fast Preview Panorama” icon. If you find the horizon is very wavy then you can go to the “Move/Drag” tab in the preview and use the “Straighten” icon to try to sort that out. You can also display the control points and see how well they fit to see if perhaps adding more would help.

Next choose the “Exposure” tab, chose the “Low Dynamic Range” preset and click “Optimise Now!” on this page, accepting the default number of points per image. This may take a few seconds to run depending on the number of images. Apply the results.

Finally for hugin, go to the “Stitcher” tab, chose an equirectangular projection and click the “Calculate Field Of View” and “Calculate Optimal Size” buttons, and then “Stitch Now!” and choose a filename for the panorama image. This may take a few minutes to create.

Once the image has been created, load it into gimp. We want the final image to be 2048×1024 (Stellarium apparently requires the image dimensions to be a power of two, in a width:height ratio of 2:1 and as the supplied Mars landscape is 2048×1024 I took my lead from that), so the first thing to do is to scale the current image to be 2048 pixels wide. We’ll deal with the height in a moment. Use the Image->Scale Image menu to set the horizontal size to 2048 pixels and leave the sizes linked so the image is scaled vertically to match.

Now select Image->Canvas Size, break the link between width and height leaving width at 2048 and set the height to 1024. Also click on “Centre” and select “Resize All Layers”, followed by “Resize”. You should now have an image with the horizon centred somewhere around 500 pixels high. If it’s way out then it may be necessary to move it by selecting most of the image, cutting it and pasting it back in appropriately.

Next use the “select area by colour” tool to select an area of the sky, and cut it from the image using “ctrl-X”. Do this until you’ve got rid of as much sky as you want. If you find your sky colour is the same as parts of the image then you may need to tweak their colour a little, or use an alternative method for selecting the areas you want to remove such as selecting areas freehand. The “select by colour” method does make it really simple to remove sky visible through other objects such as trees though.

Finally, you’ll probably find you have a gap where your panorama doesn’t come down to the bottom of the image. I used my grass shots, resized by the same factor as the panorama and pasted them into this image, but you might be able to use the clone tool or paste in a whole sequence of images to fill that area.

Once you’re done, save the image as a PNG. Create a new directory called $HOME/.stellarium/landscapes/my_landscape and copy the PNG file to it. In that directory you also need to create a file called landscape.ini similar to this:

[landscape]
name = My Landscape Name
author = My Name
description = My description
type = spherical
maptex = landscape.png
angle_rotatez = 90

[location]
planet = Earth
latitude = +00d00'00"
longitude = -00d00'00"W
altitude = 125

Choose the altitude that’s correct for you, and obviously set the correct name for your landscape file in the maptex field. Now you should be able to start stellarium up and find your landscape listed with the others. Select it and save your settings. You’ll probably find first time around that your panorama isn’t aligned correctly with the compass. You can change the angle_rotatez setting from 0 to 359 to shift the image around to the right place. The latitude and longitude don’t need to be correct unless you want to use the “use associated planet and position” under the landscape tab when you load the new landscape into Stellarium.

This entry was posted in Astronomy. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *