<p>If I understand correctly, you are trying to create a realistic looking view of the stars rendered (in the game) on a dome surrounding the game play area.  So you don't need to fly through the stars or interact with them in a 3D environment, is that right?</p>
<p>If so, it isn't the star size you want to reproduce - it is the brightness.  We can't see the width of a star from Earth and until very recently no telescope could, either.  It's the brightness of stars which makes them seem &quot;bigger&quot; or &quot;smaller&quot; than other stars.</p>
<p>The good news is this makes the calculations much easier for your game.  You want to represent the <a href="https://en.wikipedia.org/wiki/Apparent_magnitude" rel="nofollow noreferrer">apparent magnitude</a> as seen from Earth.</p>
<p>Planetarium programs, such as <a href="https://stellarium.org/" rel="nofollow noreferrer">Stellarium</a> or <a href="https://theskylive.com/planetarium" rel="nofollow noreferrer">The Sky</a>, achieve nice results with a combination of making the star dot circle radius larger/smaller as well as brighter/dimmer.  The planetarium programs which look the best also change the brightness level of the pixels across the radius of the star circle (the radial profile) which is called the <a href="https://www.gnu.org/software/gnuastro/manual/html_node/PSF.html" rel="nofollow noreferrer">point spread function</a> in astronomy.</p>
<p>The easiest way to get a realistic star is with a simple <a href="https://www.spreadsheetweb.com/bell-curve-in-excel/" rel="nofollow noreferrer">bell curve</a> shape (radial profile).  Make the width (in pixels) and height (brightness of pixels) of your bell curve variables and play around with them until you get the look you are happy with for your brightest star... those are the trickiest ones to render in a realistic way.  The faint stars are much easier.</p>
<p>When you have found how big the radius can be (and still look nice), assign it to Sirius' (the brightest star in our night sky) apparent magnitude  of ~ -1.5 and go down from there.  In a very dark location, our eyes can see stars down to a magnitude of 5 or 6.  Positive magnitudes are fainter; a magnitude 0 star is 100x brighter than a magnitude 5 star.</p>
<p>In a nutshell, you want to find the best bell curve width (diameter in pixels of your drawn star dot) and height (brightness of pixels at the center of your drawn star dot) to represent a star with an apparent magnitude of -1.5 (Sirius) and the best bell curve width and height to represent stars around magnitude 5 or 6.  You can, of course, include even dimmer stars but then the difference between the bright stars and faint stars becomes less obvious.  You'll have to find a balance you think looks nice.  The more stars you draw, the less of a difference there is between the brightest and faintest. If you increase the diameter in pixels of the bright ones to compensate, at some point they begin to look very fake.</p>
<p>Since you already have the YBC, you already have the stars positions and magnitudes (the YBC magnitude is the apparent magnitude and is listed as &quot;V Mag&quot;).  Hope this helps, good luck with your game!</p>
<p>Edit: I was looking at the YBC earlier and had that stuck in my head, but the HYG should also have an entry for &quot;V Mag&quot;.</p>

CC BY-SA 4.0
2020-07-22T16:21:24.997Z
And anyone who has taken a picture of the moon only to be incredibly disappointed at the result has seen exactly what this answer is talking about.
eps
CC BY-SA 4.0
2020-07-22T21:28:07.723Z
It's working fine! (Almost) The only problem is that some stars are so small they are less than one pixel on the screen and they twinkle, is there a way to avoid this?
Tornado 77
CC BY-SA 4.0
2020-07-22T21:58:10.060Z
Yeah, that's the tricky part for sure.  I don't know what your "V mag" magnitude range is - what's the Vmag of your faintest stars?  I'm glad you got it working, I hope to see it in your game one day!
AstroShannon
CC BY-SA 4.0
2020-07-22T22:19:31.750Z
12, but there were too many stars, so I added a part to my script which destroys the star if it has a V mag higher than 6.5.
Tornado 77
CC BY-SA 4.0
2020-07-21T19:04:30.757Z
2020-07-21T19:29:52.607Z
2020-07-21T19:29:52.607Z
AstroShannon
<p>I'm trying to create a dynamic starfield for game using the HYG database. Because there are no data about the apparent size of the stars from earth, I will need to get it myself. I found a formula which calculate the radius by the temperature and the luminosity of the star. It's working, but the problem is that because a lot of stars are very far, I normalize the distance of the stars so they are all at the same distance in the game engine(they form a dome around the scene). I'm looking for a way to set the size of the stars in the sky, even if normalized, using the radius of the stars, and the real distance from earth. I tried: Distance / radius, but the size of the stars make no sense, betelgeuse is 10 times larger than bellatrix, but they should be almost equivalent.</p>

CC BY-SA 4.0
2020-07-21T18:34:54.690Z
If you set stars' sizes related to their real sizes without adjusting for distance (thus using apparent magnitude), you will not recognize the sky and it is no apparent diameter in any kind (or something similar to the absolute magnitude). Thus apparent magnitude is what you usually want and which corresponds to the impression people have with naked eye or looking through telescopes. You might want to expand your question with a description of what you actually want to achieve
planetmaker
CC BY-SA 4.0
2020-07-21T19:04:31.423Z
I cannot understand what it is you are trying to achieve?
ProfRob
<star><cosmology><mathematics>
Calculate object apparent diameter by distance and radius
Tornado 77
# Calculate object apparent diameter by distance and radius

(Asked by: username_0 on 2020-07-21)

I'm trying to create a dynamic starfield for game using the HYG database. Because there are no data about the apparent size of the stars from earth, I will need to get it myself. I found a formula which calculate the radius by the temperature and the luminosity of the star. It's working, but the problem is that because a lot of stars are very far, I normalize the distance of the stars so they are all at the same distance in the game engine(they form a dome around the scene). I'm looking for a way to set the size of the stars in the sky, even if normalized, using the radius of the stars, and the real distance from earth. I tried: Distance / radius, but the size of the stars make no sense, betelgeuse is 10 times larger than bellatrix, but they should be almost equivalent.

**Tags:** star, cosmology, mathematics
> **Comments:**
> **username_1**: If you set stars' sizes related to their real sizes without adjusting for distance (thus using apparent magnitude), you will not recognize the sky and it is no apparent diameter in any kind (or something similar to the absolute magnitude). Thus apparent magnitude is what you usually want and which corresponds to the impression people have with naked eye or looking through telescopes. You might want to expand your question with a description of what you actually want to achieve  
> **username_2**: I cannot understand what it is you are trying to achieve?  

---

## 1 answers

### Answer by username_3 on 2020-07-21. Score: 4 | Accepted answer

If I understand correctly, you are trying to create a realistic looking view of the stars rendered (in the game) on a dome surrounding the game play area. So you don't need to fly through the stars or interact with them in a 3D environment, is that right?

If so, it isn't the star size you want to reproduce - it is the brightness. We can't see the width of a star from Earth and until very recently no telescope could, either. It's the brightness of stars which makes them seem "bigger" or "smaller" than other stars.

The good news is this makes the calculations much easier for your game. You want to represent the [apparent magnitude](https://en.wikipedia.org/wiki/Apparent_magnitude) as seen from Earth.

Planetarium programs, such as [Stellarium](https://stellarium.org/) or [The Sky](https://theskylive.com/planetarium), achieve nice results with a combination of making the star dot circle radius larger/smaller as well as brighter/dimmer. The planetarium programs which look the best also change the brightness level of the pixels across the radius of the star circle (the radial profile) which is called the [point spread function](https://www.gnu.org/software/gnuastro/manual/html_node/PSF.html) in astronomy.

The easiest way to get a realistic star is with a simple [bell curve](https://www.spreadsheetweb.com/bell-curve-in-excel/) shape (radial profile). Make the width (in pixels) and height (brightness of pixels) of your bell curve variables and play around with them until you get the look you are happy with for your brightest star... those are the trickiest ones to render in a realistic way. The faint stars are much easier.

When you have found how big the radius can be (and still look nice), assign it to Sirius' (the brightest star in our night sky) apparent magnitude of ~ -1.5 and go down from there. In a very dark location, our eyes can see stars down to a magnitude of 5 or 6. Positive magnitudes are fainter; a magnitude 0 star is 100x brighter than a magnitude 5 star.

In a nutshell, you want to find the best bell curve width (diameter in pixels of your drawn star dot) and height (brightness of pixels at the center of your drawn star dot) to represent a star with an apparent magnitude of -1.5 (Sirius) and the best bell curve width and height to represent stars around magnitude 5 or 6. You can, of course, include even dimmer stars but then the difference between the bright stars and faint stars becomes less obvious. You'll have to find a balance you think looks nice. The more stars you draw, the less of a difference there is between the brightest and faintest. If you increase the diameter in pixels of the bright ones to compensate, at some point they begin to look very fake.

Since you already have the YBC, you already have the stars positions and magnitudes (the YBC magnitude is the apparent magnitude and is listed as "V Mag"). Hope this helps, good luck with your game!

Edit: I was looking at the YBC earlier and had that stuck in my head, but the HYG should also have an entry for "V Mag".

> **Comments:**
> **username_4**: And anyone who has taken a picture of the moon only to be incredibly disappointed at the result has seen exactly what this answer is talking about.  
> **username_0**: It's working fine! (Almost) The only problem is that some stars are so small they are less than one pixel on the screen and they twinkle, is there a way to avoid this?  
> **username_3**: Yeah, that's the tricky part for sure.  I don't know what your "V mag" magnitude range is - what's the Vmag of your faintest stars?  I'm glad you got it working, I hope to see it in your game one day!  
> **username_0**: 12, but there were too many stars, so I added a part to my script which destroys the star if it has a V mag higher than 6.5.  

---

