<p>"Accurate star size" is a problem. Obviously you do not have the resolution on your screen for accurate angular resolution of stars (they would require an absurdly fine resolution), and the dynamic range of brightness is also too low -- stars range over many orders of magnitude in brightness, far more than a screen can show. Deeply annoying. What one might want to do is to make each star have a brightness and screen size that is proportional to their actual brightness in the sky to give the same feeling as the sky would give. This is still very tough, since screens have different <a href="https://en.wikipedia.org/wiki/Gamma_correction" rel="nofollow noreferrer">gamma correction</a>. To top it off, the human eye actually has a pretty logarithmic response to light (this is why magnitudes and gamma correction make sense).</p>

<p>Here is a rough idea. A star with AbsMag of <span class="math-container">$M$</span> has an actual luminosity of <span class="math-container">$$L = L_\odot 10^{0.4(M_\odot - M)}$$</span> where <span class="math-container">$L_\odot$</span> is the luminosity of the sun and <span class="math-container">$M_\odot$</span> is the absolute magnitude of the sun. Things get easy if we just count luminosity in terms of <span class="math-container">$L_\odot$</span>, making the sun one unit of luminosity.</p>

<p>A spot of radius <span class="math-container">$r$</span> on the screen with luminance <span class="math-container">$l$</span> radiates power as <span class="math-container">$P=\pi r^2 l$</span>. That luminance is due to the gamma-corrected luma value <span class="math-container">$V$</span> the computer displays: <span class="math-container">$l = K V^\gamma$</span>. </p>

<p>Assuming the radius changes with luminosity too as <span class="math-container">$r(L)$</span>, I would try <span class="math-container">$r(L)=r_0 L^a$</span> where <span class="math-container">$a\approx 0.6$</span> (but this is guesswork) and the sun has radius <span class="math-container">$r_0$</span> pixels.</p>

<p>So trying to put this together, we get the pixel brightness as <span class="math-container">$$V = V_0 (L/ r(L)^2)^{1/\gamma} = V'_0 L^{(1-2a)/\gamma}$$</span> where <span class="math-container">$V_0$</span> and <span class="math-container">$V'_0$</span> are the pixel brightnesses used for the sun in this model. Basically this squashes the actual luminosity with <span class="math-container">$a$</span> (representing using bigger spots for brighter stars, not requiring as intense pixels) and <span class="math-container">$\gamma$</span> (to correct for the screen and the eye). What values to use will largely be trial and error unless you want to try to use screen photometry equipment.</p>

<p>So the full formula converting from absolute magnitude to pixel value would be: <span class="math-container">$$V = V_0 10^{0.4(4.83 - M)(1-2a)/\gamma}.$$</span> </p>

CC BY-SA 4.0
2019-08-26T09:49:29.377Z
A comment on my answer: it is often a matter of taste what one likes to see, so making the parameters a and gamma controllable by the keyboard (like in Celestia) is a good idea.
Anders Sandberg
CC BY-SA 4.0
2019-08-26T17:51:54.833Z
I'll try and see where that gets me to..
Rando Hinn
CC BY-SA 4.0
2019-08-25T21:53:23.483Z
2019-08-25T21:53:23.483Z
Anders Sandberg
<p>I am using the AMNH's <a href="https://www.amnh.org/research/hayden-planetarium/digital-universe" rel="nofollow noreferrer">Digital Universe</a> stars.speck file to render stars in 3D space. The speck contains parsec-scale coortinates, where our Sun is at 0,0,0. It also lists the AbsMag values - i.e the luminosity from 10 parsecs away. I want to now scale my star textures in openGL, so the resulting star sizes are accurate. How could I convert the AbsMag inverse logarithmic scale to a scale value of 0-infinity, where 0.0 means the star goes away, and 1.0 is no change? Obviously can't make the Sun stay at 1, as that would make it huge.</p>

<absolute-magnitude>
Rendering stars in 3D space - AbsMag to OpenGL scale values
Rando Hinn
# Rendering stars in 3D space - AbsMag to OpenGL scale values

(Asked by: username_0 on 2019-08-25)

I am using the AMNH's [Digital Universe](https://www.amnh.org/research/hayden-planetarium/digital-universe) stars.speck file to render stars in 3D space. The speck contains parsec-scale coortinates, where our Sun is at 0,0,0. It also lists the AbsMag values - i.e the luminosity from 10 parsecs away. I want to now scale my star textures in openGL, so the resulting star sizes are accurate. How could I convert the AbsMag inverse logarithmic scale to a scale value of 0-infinity, where 0.0 means the star goes away, and 1.0 is no change? Obviously can't make the Sun stay at 1, as that would make it huge.

**Tags:** absolute-magnitude


---

## 1 answers

### Answer by username_1 on 2019-08-25. Score: 3 | Accepted answer

"Accurate star size" is a problem. Obviously you do not have the resolution on your screen for accurate angular resolution of stars (they would require an absurdly fine resolution), and the dynamic range of brightness is also too low -- stars range over many orders of magnitude in brightness, far more than a screen can show. Deeply annoying. What one might want to do is to make each star have a brightness and screen size that is proportional to their actual brightness in the sky to give the same feeling as the sky would give. This is still very tough, since screens have different [gamma correction](https://en.wikipedia.org/wiki/Gamma_correction). To top it off, the human eye actually has a pretty logarithmic response to light (this is why magnitudes and gamma correction make sense).

Here is a rough idea. A star with AbsMag of $M$ has an actual luminosity of $$L = L\_\odot 10^{0.4(M\_\odot - M)}$$ where $L\_\odot$ is the luminosity of the sun and $M\_\odot$ is the absolute magnitude of the sun. Things get easy if we just count luminosity in terms of $L\_\odot$, making the sun one unit of luminosity.

A spot of radius $r$ on the screen with luminance $l$ radiates power as $P=\pi r^2 l$. That luminance is due to the gamma-corrected luma value $V$ the computer displays: $l = K V^\gamma$.

Assuming the radius changes with luminosity too as $r(L)$, I would try $r(L)=r\_0 L^a$ where $a\approx 0.6$ (but this is guesswork) and the sun has radius $r\_0$ pixels.

So trying to put this together, we get the pixel brightness as $$V = V\_0 (L/ r(L)^2)^{1/\gamma} = V'\_0 L^{(1-2a)/\gamma}$$ where $V\_0$ and $V'\_0$ are the pixel brightnesses used for the sun in this model. Basically this squashes the actual luminosity with $a$ (representing using bigger spots for brighter stars, not requiring as intense pixels) and $\gamma$ (to correct for the screen and the eye). What values to use will largely be trial and error unless you want to try to use screen photometry equipment.

So the full formula converting from absolute magnitude to pixel value would be: $$V = V\_0 10^{0.4(4.83 - M)(1-2a)/\gamma}.$$

> **Comments:**
> **username_1**: A comment on my answer: it is often a matter of taste what one likes to see, so making the parameters a and gamma controllable by the keyboard (like in Celestia) is a good idea.  
> **username_0**: I'll try and see where that gets me to..  

---

