# Which is the shape of the sky?

I'm a software developer and I'm developing a planetarium and the first thing that I don't know is: What is the shape of the sky?

First, I though that it is a semi-sphere, but searching on Internet I have found a lot of youtube tutorials, and all of them draw a semi-sphere but flatten (you can search skydome on Google and find a lot of tutorials).

My question is, how can I represent sky on a virtual 3D world? How much do I need to flat a sphere to get a real sky representation?

• Your question makes little sense as it stands. The visible sky is of course a hemisphere. How you represent that depends on what you are representing it on and with. – ProfRob Jun 28 '15 at 20:43
• @Rob Jeffries: if you observe from, say, an airplane at ⁓11 km (36,000 ft) above m.s.l., then the visible sky is noticeably larger than a hemisphere. You may see the sky, not terrain down to −3°20′ of elevation – and note that Ī̲ neglect atmospheric refraction which would extend visibility of remote objects further down for some 40′. – Incnis Mrsi Sep 28 '18 at 15:09

For computer software, the easiest way to take a sphere (and/or hemisphere) and flatten it into a flat shape (usually a rectangle) is the equi-rectangular projection (also known as the plate carrée), because it has the simplest formula relating pixels and coordinates:

$$x = w \times \frac\lambda{360} + \frac w2$$

$$y = -h \times \frac\phi{180} + \frac h2$$

where $x$ and $y$ is the pixel point, $w$ and $h$ are the width and height (in pixels) of your map's rectangle, $\lambda$ is the longitude in degrees and $\phi$ is the latitude in degrees

This all assumes that your map puts the 0 longitude, 0 latitude point in the center. In other words, the prime meridian runs down the map's middle vertically and the equator runs down the map's middle horizontally. It also assumes that north and east are positive, while west and south are negative.

Notice that you don't even have to take the sine or cosine of anything. That's why the equi-rectangular projection is so simple. It basically just takes longitude and latitude and makes them $x$/$y$ coordinate with only an offset. The offset comes because, usually in computer programming, the origin is at the top left instead of the center of the screen.

Notice also that I negated the latitude in the $y$ formula, because most computer systems in 2D coordinates have the positive $\bf y$ direction pointing down. This is opposite of a standard graph in math, where positive $y$ goes up.

In your case, longitude and latitude will actually be right ascension and declination respectively. They are basically stellar coordinates for the celestial sphere as opposed to ground coordinates for the geode.

There are many, many other map projections possible, but equi-rectangular is the simplest.

However, your question is a little vague because you mentioned a "virtual 3D world", yet also asked how much you need to flatten it. If you already have a 3D model of a sphere in your computer graphics, you don't have to flatten it at all. You just draw the 3D model (sphere) with a texture on it. If you want to represent it as a map, then of course you have to flatten it, and equi-rectangular projection is the simplest way.

• superb answer. really nice – natarajan physicist Jun 30 '15 at 16:33
• In a nutshell, I want to make a virtual planetarium to show to the user what he can see at his location (like stardroid does). How can I show the stars depending on user location? I have found that I can use a semisphere but checking stardroid code I use it uses a SkyBox. You can check the code here: code.google.com/p/stardroid. – VansFannel Jul 12 '15 at 5:57
• I have also found this question: physics.stackexchange.com/questions/25774/creating-a-star-map – VansFannel Jul 12 '15 at 15:58