<p>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 <strong>equi-rectangular projection</strong> (also known as the plate carrée), because it has the simplest formula relating pixels and coordinates:</p>

<p>$$x = w \times \frac\lambda{360} + \frac w2$$</p>

<p>$$y = -h \times \frac\phi{180} + \frac h2$$</p>

<p>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</p>

<p>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.</p>

<p>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 <strong>origin is at the top left</strong> instead of the center of the screen.</p>

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

<p>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.</p>

<p>There are many, many other <a href="https://en.wikipedia.org/wiki/Map_projection" rel="nofollow noreferrer">map projections</a> possible, but equi-rectangular is the simplest.</p>

<p><strong>However</strong>, 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 <strong>don't have to</strong> 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.</p>

CC BY-SA 3.0
2015-06-30T16:33:28.557Z
superb answer. really nice
natarajan physicist
CC BY-SA 3.0
2015-07-12T05:57:23.660Z
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: https://code.google.com/p/stardroid/.
VansFannel
CC BY-SA 3.0
2015-07-12T15:58:48.270Z
I have also found this question: http://physics.stackexchange.com/questions/25774/creating-a-star-map
VansFannel
CC BY-SA 3.0
2015-06-29T04:18:08.683Z
2017-02-18T22:33:55.267Z
2017-02-18T22:33:55.267Z
DrZ214
<p>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?</p>

<p>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).</p>

<p>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?</p>

CC BY-SA 3.0
2015-06-28T20:43:45.103Z
Your question makes little sense as it stands. The visible sky is of course a *hemi*sphere. How you represent that depends on what you are representing it on and with.
ProfRob
CC BY-SA 4.0
2018-09-28T15:09:57.247Z
@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
<fundamental-astronomy><coordinate><software><declination>
Which is the shape of the sky?
VansFannel
# Which is the shape of the sky?

(Asked by: username_0 on 2015-06-28)

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?

**Tags:** fundamental-astronomy, coordinate, software, declination

> **Comments:**
> **username_1**: Your question makes little sense as it stands. The visible sky is of course a *hemi*sphere. How you represent that depends on what you are representing it on and with.  
> **username_2**: @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′.  

---

## 1 answers

### Answer by username_3 on 2015-06-29. Score: 5 | Accepted answer

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](https://en.wikipedia.org/wiki/Map_projection) 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.

> **Comments:**
> **username_4**: superb answer. really nice  
> **username_0**: 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: https://code.google.com/p/stardroid/.  
> **username_0**: I have also found this question: http://physics.stackexchange.com/questions/25774/creating-a-star-map  

---

