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.

  • $\begingroup$ 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 $\endgroup$ Jul 21, 2020 at 18:34
  • $\begingroup$ I cannot understand what it is you are trying to achieve? $\endgroup$
    – ProfRob
    Jul 21, 2020 at 19:04

1 Answer 1


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 as seen from Earth.

Planetarium programs, such as Stellarium or The Sky, 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 in astronomy.

The easiest way to get a realistic star is with a simple bell curve 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".

  • 1
    $\begingroup$ 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. $\endgroup$
    – eps
    Jul 22, 2020 at 16:21
  • $\begingroup$ 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? $\endgroup$
    – Tornado 77
    Jul 22, 2020 at 21:28
  • $\begingroup$ 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! $\endgroup$ Jul 22, 2020 at 21:58
  • $\begingroup$ 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. $\endgroup$
    – Tornado 77
    Jul 22, 2020 at 22:19

Not the answer you're looking for? Browse other questions tagged .