<p>The <a href="https://en.wikipedia.org/wiki/Apparent_magnitude" rel="nofollow noreferrer">apparent magnitude</a> <em>m</em>=<code>Vmag</code> could be what's missing.
Stars of apparent magnitude <em>m</em>=0 should appear 100 times as bright as <em>m</em>=5 stars.
If you are simulating a naked-eye view, you can omit stars of <em>m</em>>6.</p>

<p>When you place stars at nonuniform distances, you'll need to compute <a href="https://en.wikipedia.org/wiki/Absolute_magnitude" rel="nofollow noreferrer">absolute magnitude</a> <em>M</em> from apparent magnitude <em>m</em> and distance.
If <em>p</em>=<code>Plx</code> is parallax in milliarcseconds,</p>

<p><span class="math-container">$$ M \approx m + 5 \log_{10}{p} - 10 $$</span></p>

<p>If all stars are modeled in the same (emissive?) material, the object representing a star of absolute magnitude <em>M</em>=0 should have 100 times the surface area, and 10 times the radius, as an <em>M</em>=5 star.</p>

<p><span class="math-container">$$ r(M) = 10^{1-M/5} r(5) $$</span></p>

<p>To check your work, planetarium sites such as <a href="https://theskylive.com/planetarium" rel="nofollow noreferrer">TheSkyLive</a> or <a href="https://stellarium-web.org/" rel="nofollow noreferrer">Stellarium Web</a> would be less compute-intensive than uploading images to astrometry.net.</p>

CC BY-SA 4.0
2020-05-30T11:02:19.757Z
Is there any sort of mathematical formula that can be used to calculate the radius of these star objects, given their apparent magnitude and parallax/distance from Earth (calculated from the parallax values of each star)?
SidS
CC BY-SA 4.0
2020-05-30T18:24:42.593Z
@SidS Updated with formulas.
Mike G
CC BY-SA 4.0
2020-05-31T13:26:37.523Z
I've implemented the formulas, however I don't think I've done it correctly as the stars are massive, please could you check it for me at this URL: https://pastebin.com/HYazJLq2 . Also, the maximum radius must be 5, how do I accomplish this.
SidS
CC BY-SA 4.0
2020-05-31T16:20:20.843Z
I have completely updated the script to follow suit with your answer. The script is accessible from the same URL as above. I have opened a new question regarding this at this URL: https://astronomy.stackexchange.com/questions/36406/simulating-star-sizes-to-scale-given-the-magnitude-and-parallax-angle
SidS
CC BY-SA 4.0
2020-05-29T16:44:16.340Z
2020-05-30T18:24:18.210Z
2020-05-30T18:24:18.210Z
Mike G
<p>I am creating a planetarium program using Unity3D and C# to plot out stars from the Hipparcos catalogue. Using the Plx, _RA.icrs and _DE.icrs columns of the dataset, I have managed to work the distance in parsecs and work out a cartesian set of coordinates.</p>

<p>Simulation Class...</p>

<pre><code>public class Simulation : MonoBehaviour
{
    public IEnumerator loadStars()
    {
        starsLoaded = 0;
        var stopWatch = new Stopwatch();
        stopWatch.Start();
        // Use the last frame duration as a guide how long one frame should take
        var targetMilliseconds = Time.deltaTime * 100f;
        for (int i = 0; i &lt; totalStars; i++)
        {
            Double.TryParse(datasetTable[i, 3], out double test);
            if (!(datasetTable[i, 12] == null) &amp;&amp; !(datasetTable[i, 13] == null) &amp;&amp; !(datasetTable[i, 6] == null))
            {
                GameObject thisStar = Instantiate(starPrefab, transform.position, transform.rotation) as GameObject;
                thisStar.transform.parent = starHolder.transform;
                Int32.TryParse(datasetTable[i, 0], out (thisStar.GetComponent&lt;Star&gt;().ID));
                Double.TryParse(datasetTable[i, 12], out (thisStar.GetComponent&lt;Star&gt;().RA));
                Double.TryParse(datasetTable[i, 13], out (thisStar.GetComponent&lt;Star&gt;().DE));
                Double.TryParse(datasetTable[i, 3], out (thisStar.GetComponent&lt;Star&gt;().Vmag));
                Double.TryParse(datasetTable[i, 6], out (thisStar.GetComponent&lt;Star&gt;().Plx));
                Double.TryParse(datasetTable[i, 10], out (thisStar.GetComponent&lt;Star&gt;().CI));
            }
            if (stopWatch.ElapsedMilliseconds &gt; targetMilliseconds)
            {
                yield return null;
                stopWatch.Restart();
            }
            starsLoaded++;
        }
    }
}
</code></pre>

<p>Star class:</p>

<pre><code>public class Star : MonoBehaviour
{
    /// &lt;summary&gt;
    /// Identifier (HIP number). "HIP" is appended to the ID, for Hipparcos
    /// &lt;/summary&gt;
    [SerializeField] public int ID; // { get; set; }
    /// &lt;summary&gt;
    /// Right Ascension (J2000) in degrees. 
    /// &lt;/summary&gt;
    [SerializeField] public double RA; //{ get; set; }
    /// &lt;summary&gt;
    /// Declination (J2000) in degrees. 
    /// &lt;/summary&gt;
    [SerializeField] public double DE; //{ get; set; }
    /// &lt;summary&gt;
    /// Magnitude in Johnson V
    /// &lt;/summary&gt;
    [SerializeField] public double Vmag; //{ get; set; }
    /// &lt;summary&gt;
    /// Trigonometric parallax, measured in milli-seconds of arc
    /// &lt;/summary&gt;
    [SerializeField] public double Plx; //{ get; set; }
    /// &lt;summary&gt;
    /// Colour index in Johnson B-V colour
    /// &lt;/summary&gt;
    [SerializeField] public double CI; //{ get; set; }
    /// &lt;summary&gt;
    /// Distance of the star from the centre of Earth measured in kilometres
    /// &lt;/summary&gt; 
    [SerializeField] public double distanceFromEarth;
    /// &lt;summary&gt;
    /// Cartesian (X,Y,Z) positioning of the star
    /// &lt;/summary&gt;
    [SerializeField] Vector3 cartesianPositioning;


    // Start is called before the first frame update
    void Start()
    {
        positionStar();
    }

    private void distanceFromEarthCalc()
    {
        // Convert Plx from milliarcseconds to arcseconds (seconds of arc)
        double PlxSOA = Plx / 1000;
        // Calculate distance from equation d=1/p
        // distance d is measured in parsecs and the parallax angle p is measured in arcseconds.
        double dPC = 1 / PlxSOA;
        /// Convert parsecs to kilomentres
        /// Conversion can bbe found here:
        /// https://en.wikipedia.org/wiki/Parsec
        /// 
        /// QUICK NOTE: converting to km causes issues with unity - values are too high
        ///             maybe work with parsecs instead?
        ///             
        //distanceFromEarth = (dPC * (96939420213600000 / math.PI_DBL)) / 1000;
        //distanceFromEarth = distanceFromEarth / 10000; // metres to kilometres
        distanceFromEarth = dPC * 10; // multiplied by 10 to move stars away from camera
    }


    private void cartesianPositioningCalc()
    {
        distanceFromEarthCalc();

        double RA_rad = RA * (math.PI_DBL / 180);
        double DE_rad = DE * (math.PI_DBL / 180);

        cartesianPositioning.x = (float)(distanceFromEarth * (math.cos(DE_rad)) * (math.cos(RA_rad)));
        cartesianPositioning.y = (float)(distanceFromEarth * (math.cos(DE_rad)) * (math.sin(RA_rad)));
        cartesianPositioning.z = (float)(distanceFromEarth * (math.sin(DE_rad)));
    }

    private void positionStar()
    {
        cartesianPositioningCalc();
        gameObject.transform.position = cartesianPositioning;
        gameObject.transform.localScale = new Vector3(2, 2, 2);
    }
}
</code></pre>

<p>View from the camera:
<a href="https://i.sstatic.net/cZRPj.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cZRPj.jpg" alt="View from the Unity camera"></a></p>

<p>3D view of the scene (the camera's orientation is shown by the arrows):
<a href="https://i.sstatic.net/s6AeA.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/s6AeA.jpg" alt="3D view of the scene"></a></p>

<p>With the image from the camera, I tried uploading it to <a href="http://nova.astrometry.net/" rel="nofollow noreferrer">http://nova.astrometry.net/</a> but was unable to find stars/constellations.</p>

<p>So I thought about normalising the vectors of the stars.</p>

<p>With the Simulation class unchanged, I changed the distanceFromEarth variable in the Star class to 900 to normalise the vectors (each star will not have the same distance from the centre)</p>

<p>View from the camera:
<a href="https://i.sstatic.net/ubxKL.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ubxKL.jpg" alt="View from the camera"></a></p>

<p>3D view of the scene (the camera's orientation is shown by the arrows):
<a href="https://i.sstatic.net/SFC7o.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/SFC7o.jpg" alt="3D view of the scene"></a></p>

<p>Even after the normalisation, uploading the image of the view from the camera to the image processing website resulted in no stars/constellations being detected.</p>

<p>What am I doing wrong, why aren't stars and constellation detected?</p>

CC BY-SA 4.0
2020-05-29T15:45:01.907Z
Try disregarding distance and set that to the same big one for each star. Scale visible size inversely to magnitude and / or limit to stars brighter than 5 mag. See weather all that combined gives you some results
planetmaker
CC BY-SA 4.0
2020-06-01T18:06:22.443Z
Quite helpful actually, this will come in handy when I start to create dynamic and unique models for each star
SidS
<star><coordinate><constellations>
Unable to detect stars and constellations in simulation of stars from the Hipparcos catalogue
SidS
# Unable to detect stars and constellations in simulation of stars from the Hipparcos catalogue

(Asked by: username_0 on 2020-05-29)

I am creating a planetarium program using Unity3D and C# to plot out stars from the Hipparcos catalogue. Using the Plx, \_RA.icrs and \_DE.icrs columns of the dataset, I have managed to work the distance in parsecs and work out a cartesian set of coordinates.

Simulation Class...

```
public class Simulation : MonoBehaviour
{
    public IEnumerator loadStars()
    {
        starsLoaded = 0;
        var stopWatch = new Stopwatch();
        stopWatch.Start();
        // Use the last frame duration as a guide how long one frame should take
        var targetMilliseconds = Time.deltaTime * 100f;
        for (int i = 0; i < totalStars; i++)
        {
            Double.TryParse(datasetTable[i, 3], out double test);
            if (!(datasetTable[i, 12] == null) && !(datasetTable[i, 13] == null) && !(datasetTable[i, 6] == null))
            {
                GameObject thisStar = Instantiate(starPrefab, transform.position, transform.rotation) as GameObject;
                thisStar.transform.parent = starHolder.transform;
                Int32.TryParse(datasetTable[i, 0], out (thisStar.GetComponent<Star>().ID));
                Double.TryParse(datasetTable[i, 12], out (thisStar.GetComponent<Star>().RA));
                Double.TryParse(datasetTable[i, 13], out (thisStar.GetComponent<Star>().DE));
                Double.TryParse(datasetTable[i, 3], out (thisStar.GetComponent<Star>().Vmag));
                Double.TryParse(datasetTable[i, 6], out (thisStar.GetComponent<Star>().Plx));
                Double.TryParse(datasetTable[i, 10], out (thisStar.GetComponent<Star>().CI));
            }
            if (stopWatch.ElapsedMilliseconds > targetMilliseconds)
            {
                yield return null;
                stopWatch.Restart();
            }
            starsLoaded++;
        }
    }
}

```

Star class:

```
public class Star : MonoBehaviour
{
    /// <summary>
    /// Identifier (HIP number). "HIP" is appended to the ID, for Hipparcos
    /// </summary>
    [SerializeField] public int ID; // { get; set; }
    /// <summary>
    /// Right Ascension (J2000) in degrees. 
    /// </summary>
    [SerializeField] public double RA; //{ get; set; }
    /// <summary>
    /// Declination (J2000) in degrees. 
    /// </summary>
    [SerializeField] public double DE; //{ get; set; }
    /// <summary>
    /// Magnitude in Johnson V
    /// </summary>
    [SerializeField] public double Vmag; //{ get; set; }
    /// <summary>
    /// Trigonometric parallax, measured in milli-seconds of arc
    /// </summary>
    [SerializeField] public double Plx; //{ get; set; }
    /// <summary>
    /// Colour index in Johnson B-V colour
    /// </summary>
    [SerializeField] public double CI; //{ get; set; }
    /// <summary>
    /// Distance of the star from the centre of Earth measured in kilometres
    /// </summary> 
    [SerializeField] public double distanceFromEarth;
    /// <summary>
    /// Cartesian (X,Y,Z) positioning of the star
    /// </summary>
    [SerializeField] Vector3 cartesianPositioning;

    // Start is called before the first frame update
    void Start()
    {
        positionStar();
    }

    private void distanceFromEarthCalc()
    {
        // Convert Plx from milliarcseconds to arcseconds (seconds of arc)
        double PlxSOA = Plx / 1000;
        // Calculate distance from equation d=1/p
        // distance d is measured in parsecs and the parallax angle p is measured in arcseconds.
        double dPC = 1 / PlxSOA;
        /// Convert parsecs to kilomentres
        /// Conversion can bbe found here:
        /// https://en.wikipedia.org/wiki/Parsec
        /// 
        /// QUICK NOTE: converting to km causes issues with unity - values are too high
        ///             maybe work with parsecs instead?
        ///             
        //distanceFromEarth = (dPC * (96939420213600000 / math.PI_DBL)) / 1000;
        //distanceFromEarth = distanceFromEarth / 10000; // metres to kilometres
        distanceFromEarth = dPC * 10; // multiplied by 10 to move stars away from camera
    }

    private void cartesianPositioningCalc()
    {
        distanceFromEarthCalc();

        double RA_rad = RA * (math.PI_DBL / 180);
        double DE_rad = DE * (math.PI_DBL / 180);

        cartesianPositioning.x = (float)(distanceFromEarth * (math.cos(DE_rad)) * (math.cos(RA_rad)));
        cartesianPositioning.y = (float)(distanceFromEarth * (math.cos(DE_rad)) * (math.sin(RA_rad)));
        cartesianPositioning.z = (float)(distanceFromEarth * (math.sin(DE_rad)));
    }

    private void positionStar()
    {
        cartesianPositioningCalc();
        gameObject.transform.position = cartesianPositioning;
        gameObject.transform.localScale = new Vector3(2, 2, 2);
    }
}

```

View from the camera:
[![View from the Unity camera](https://i.sstatic.net/cZRPj.jpg)](https://i.sstatic.net/cZRPj.jpg)

3D view of the scene (the camera's orientation is shown by the arrows):
[![3D view of the scene](https://i.sstatic.net/s6AeA.jpg)](https://i.sstatic.net/s6AeA.jpg)

With the image from the camera, I tried uploading it to <http://nova.astrometry.net/> but was unable to find stars/constellations.

So I thought about normalising the vectors of the stars.

With the Simulation class unchanged, I changed the distanceFromEarth variable in the Star class to 900 to normalise the vectors (each star will not have the same distance from the centre)

View from the camera:
[![View from the camera](https://i.sstatic.net/ubxKL.jpg)](https://i.sstatic.net/ubxKL.jpg)

3D view of the scene (the camera's orientation is shown by the arrows):
[![3D view of the scene](https://i.sstatic.net/SFC7o.jpg)](https://i.sstatic.net/SFC7o.jpg)

Even after the normalisation, uploading the image of the view from the camera to the image processing website resulted in no stars/constellations being detected.

What am I doing wrong, why aren't stars and constellation detected?

**Tags:** star, coordinate, constellations

> **Comments:**
> **username_1**: Try disregarding distance and set that to the same big one for each star. Scale visible size inversely to magnitude and / or limit to stars brighter than 5 mag. See weather all that combined gives you some results  
> **username_0**: Quite helpful actually, this will come in handy when I start to create dynamic and unique models for each star  

---

## 1 answers

### Answer by username_2 on 2020-05-29. Score: 2

The [apparent magnitude](https://en.wikipedia.org/wiki/Apparent_magnitude) *m*=`Vmag` could be what's missing.
Stars of apparent magnitude *m*=0 should appear 100 times as bright as *m*=5 stars.
If you are simulating a naked-eye view, you can omit stars of *m*>6.

When you place stars at nonuniform distances, you'll need to compute [absolute magnitude](https://en.wikipedia.org/wiki/Absolute_magnitude) *M* from apparent magnitude *m* and distance.
If *p*=`Plx` is parallax in milliarcseconds,

$$ M \approx m + 5 \log\_{10}{p} - 10 $$

If all stars are modeled in the same (emissive?) material, the object representing a star of absolute magnitude *M*=0 should have 100 times the surface area, and 10 times the radius, as an *M*=5 star.

$$ r(M) = 10^{1-M/5} r(5) $$

To check your work, planetarium sites such as [TheSkyLive](https://theskylive.com/planetarium) or [Stellarium Web](https://stellarium-web.org/) would be less compute-intensive than uploading images to astrometry.net.

> **Comments:**
> **username_0**: Is there any sort of mathematical formula that can be used to calculate the radius of these star objects, given their apparent magnitude and parallax/distance from Earth (calculated from the parallax values of each star)?  
> **username_2**: @username_0 Updated with formulas.  
> **username_0**: I've implemented the formulas, however I don't think I've done it correctly as the stars are massive, please could you check it for me at this URL: https://pastebin.com/HYazJLq2 . Also, the maximum radius must be 5, how do I accomplish this.  
> **username_0**: I have completely updated the script to follow suit with your answer. The script is accessible from the same URL as above. I have opened a new question regarding this at this URL: https://astronomy.stackexchange.com/questions/36406/simulating-star-sizes-to-scale-given-the-magnitude-and-parallax-angle  

---

