Creating a Personalised Landscape for Stellarium

From Stellarium Wiki
Revision as of 19:01, 11 February 2011 by Alexwolf (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Although this procedure is based on the Microsoft Windows System the basics will apply to any platform that can run the programs mentioned or similar programs on the preferred system.

The first thing needed for a personalised landscape to superimpose on the horizon display is a 360° panorama with a transparent background. To make this you will need the following:

  • A digital camera on a tripod or stable platform
  • A program to convert the pictures into a 360° panorama
  • A program to remove the background and convert the panorama into about 8 square pictures in PNG format for insertion into Stellarium as the sides and if possible a similar square picture of the base you are standing on to form the ground. This last requirement is only really possible if this area is relatively featureless as the problem of knitting a complex base is well nigh impossible.
  • Patience. (Maybe a soundproof room so that the swearing wont be heard when you press the wrong key and lose an hours work)

The Camera

Digital cameras are easy and cheaply available these days so whatever you have should do. One mega-pixel resolution is quite sufficient.

The camera needs to be mounted on a tripod so that reasonably orientated pictures can be taken. Select a time of day that is quite bright with a neutral cloudy sky so there will be no shadows and a sky of the same overall texture. This will make it easier to remove later. The pictures were all saved in the JPG format which was used as the common format for all processes up to the removal of the background.

With a camera that takes 4:3 ratio pictures I found 14 evenly spaced pictures gave the best 360° panorama in the program I used to produce it.

Processing into a Panorama

This is the most complicated part of the process of generating the panorama. I used two separate programs to do this. Firstly I used Microsoft Paint which is part of the Windows operating system, to cleanup and resize the pictures to 800x600 size and so make them easier to handle in the panorama program.

If you have prominent foreground items like posts wires etc. that occur in adjacent pictures the panorama program will have difficulty in discerning them because of the 3D effect and may give double images. I overcame this by painting out the offending item by cut and paste between the two pictures. Quite easy with a little practice using the zoom in facility and I found the MSpaint program the easiest to do this in.

When I had my 14 processed pictures I inserted them into the panorama program. I used a program called the Panorama Factory. Version 1.6 is a freebee that works well and can be downloaded from the internet - a Google search will find it. I used version 3.4 that is better and cost about $40 off the Internet. This program has many options and can be configured to suit most cameras and can make a seamless 360° panorama in barrel form that will take a highly trained eye to find where the joins occur.

The resulting panorama was then loaded into Paint and trimmed to a suitable size. Mine ended up 4606 x 461 pixels. I stretched the 4606 to 4610 pixels, almost no distortion, that would allow cutting into 10 461x461 pictures at a later date. If the height of the panorama had been greater I could have made fewer pictures and so shown more of the foreground.


Removing the background to make it transparent

This is the most complex part of the process and requires a program that can produce transparency to parts of your picture, commonly called an alpha channel. Two programs I know of will do this. The very expensive and sophisticated Adobe Photoshop and a freebee called The Gimp.

I used Photoshop to produce the alpha channel because selection of the area for transparency was more positive with the complex skyline I had and I had learnt a little more on how to drive it before I found an executable form of The Gimp. For the rest I used a combination of both programs. I will describe the alpha channel process in detail for Photoshop. A lot of this would be suitable for The Gimp as they are very similar programs but I have only tried the bare essential in The Gimp to prove to myself that it could be done.

1. Load the panorama picture into Photoshop

2. Create an alpha channel using the channel pop up window. This channel was then selected as the only channel visible and it was all black at this stage. It needs to be all white. To edit this took me some time to discover how. What I did was click on Edit in Quick mask mode and then Edit in standard mode. This procedure was the only way I found I could edit. Click on the magic wand and click it on the channel picture. It will put a mask around the whole picture. Next I selected the brush tool and toggled the foreground to white and painted the whole channel white (using a very large brush size 445 pixels).

3. Next I turned the alpha channel off and selected the other channels to get the original picture. I got rid of the full mask that I had forgotten to remove by selecting Step backwards from the edit menu. I first tried the magnetic loop tool to select the sections for a mask but it was too fiddly for me. I then used the magic wand tool to select the sky sections bit by bit (zoom in on the image to see what you are doing) this would have been easy if the sky had been cloudless because colour match does this selection. I cut each selection out. It took about an hour to remove all the sky (because it was cloudy) and leave just the skyline image as a suitable mask. Clicking the magic wand in the sky area when all the sky has been removed will show an outline mask of the removed sky. Zoom in and carefully check the whole area to make sure there is no sky left. Leave this mask there.

4. Re-select the alpha channel and turn the other channels off. The alpha channel will be visible and the mask should be showing. Re-select Edit in Quick mask mode and then Edit in standard mode to edit. Select the brush tool and toggle to the black foreground. Fill in the masked area with a large brush size. The colour (black) will only go into the masked area. It wont spill over so the job is quite easy.

5. When this is done you will have created your alpha layer. Check the size of the image and if it is greater than 5000 pixels wide reduce its size by a fixed percentage till it is under this limit. The limit was necessary for one of the programs I used but may not be always necessary. However any greater resolution will be wasted and the file size will be excessive. Save the whole image in the compressed tiff form or PNG form. The only formats that preserve the alpha channel.

6. This image is the horizon picture. Give it a name .tif or .png, whichever format you save it in.

After making the panorama.tif I noticed that the trees still had areas of the original sky embedded that were not blanked by the alpha layer. I found that I could add these sections piece by piece to the alpha layer with the magic wand and paint them out. This took some time, as there were a large number to be removed. However the result was worth the effort, as it allows the sky display to be seen through the trees. Especially at high zooms ins.

Another little trick I discovered was that the panorama could be saved as a JPEG file (no alpha channel) and the alpha channel also saved as a separate JPEG file. This can save space for transmission. And allow manipulation of the original file in another program as long as the skyline is unchanged. At a later date the two files can be re-combined in Photoshop to re-form the TIFF file with alpha channel.

Using this trick I did a little patching and painting on the original picture in Paint on the original JPEG form. When completed I loaded it into Photoshop and added the blank alpha channel to it. I was then able to paste the previously created alpha layer into the new picture. It worked perfectly.

7. The panorama now needs to be broken up into suitable square images for insertion into a landscape. It took me some time to get the hang of this but the process I found best was in The Gimp. It was the easiest to cut the main panorama into sections as it has a mask scale in the tool bar.

8. Load the panorama file with alpha channel into The Gimp. Then using the mask tool cut out the squares of the predetermined size starting from the left hand side of the picture. I don't think it is necessary to make them exact squares but I did not experiment with this aspect. The position of the cut will be shown on the lower tool bar. Accuracy is improved if you use the maximum zoom that will fit on the page.

9. Create a new picture from the file menu then select and adjust the size to your predetermined size then select transparent for the background. Because of the alpha channel the transparent section will be automatically clipped of much of the transparent part of the picture. Paste the cutting into the new picture. If it is smaller than your predetermined size it will go to the centre leaving some of the transparent background at the bottom of the picture. Save the file in the PNG format. Moving the picture to the bottom of the window is much easier in Photoshop although quite possible in The Gimp.

10. I repeated steps 8 and 9 till I had all sections of the panorama saved.

11. Next I re-loaded Photoshop and opened the first of the saved pictures. Then from the menu selected the picture with the mask tool and then selected move. Next clicking on the picture will cut it out. The cutting can now be dragged to the bottom of the frame. It will not go any further so there is no trouble aligning. This bottom stop did not work on The Gimp and so it was harder to cut and place the picture section. It is most important to align the pictures to the bottom.

12. Save the picture with the name you intend to call your landscape as xxxxxx1.png.

13. Repeat steps 11 and 12 for the rest of the pictures till you have all the elements for your landscape.

14. Make a new directory for the landscape. This should be a sub-directory of either the <user directory>/landscapes or <installation>/landscapes directory. The name of the directory should be unique to your landscape, and is the landscape ID. The convention is to use a single descriptive word in lowercase text, for example gueriens. Place your pictures your new directory.

15. In your new landscape directory, create a new file called landscape.ini file (I used wordpad). Add a line for the [landscape] section. It's probably easiest to copy the landscape.ini file for the Gueriens landscape and edit it. Edit the name Guereins in every instance to the name you have given your landscape. Don't forget to make the number of tex entries agree with the number of your pictures. If you haven't made a groundtex picture use one of the existing ones from the file or make a square blank picture of your own idea. Because I took my pictures from the roof of the house I used an edited picture of the roof of my house from Google Earth. It was pretty cruddy low resolution but served the purpose.

16. Next you need to orientate your picture North with true North. This is done roughly by making the arrangement of side1 to siden suit your site as close as possible. Now you need to edit the value of decor_angle_rotatez to move your landscape in azimuth. Edit decor_alt_angle to move you landscape in altitude to align your visible horizon angle. Edit ground_angle_rotatez to align your ground with the rest of the landscape. Leave the other entries they are suitable as is.

After re-starting Stellarium, your landscape will appear in the landscape tab of the configuration window, and can be selected as required.

Personal tools
in this wiki
other languages