Introduction
Space: the final frontier. … To boldly go where no one has gone before. Those legendary words originally spoken by William Shatner as Captain James T. Kirk in Star Trek kindle a flame for many to this day. They truly embody our adventurous spirit.
Sometimes I get this feeling when building a lifelike virtual world, but I guess this would be a nerd’s final frontier. The thing is I love the outdoors, too. We can have both!
Space: the final frontier. … To boldly go where no one has gone before. Those legendary words originally spoken by William Shatner as Captain James T. Kirk in Star Trek kindle a flame for many to this day. They truly embody our adventurous spirit.
Sometimes I get this feeling when building a lifelike virtual world, but I guess this would be a nerd’s final frontier. The thing is I love the outdoors, too. We can have both!
Stargazing in Canada
https://www.asc-csa.gc.ca/eng/blog/2018/06/29/13-amazing-stargazing-locations-in-canada.asp
https://www.asc-csa.gc.ca/eng/blog/2018/06/29/13-amazing-stargazing-locations-in-canada.asp
Horizontal Coordinates
When we look up at the stars, how do we describe their position in the sky? As you might imagine, we use an angle up from the horizon and the direction you are facing. These are known as horizontal coordinates. The angle up from the horizon is known as the altitude (or elevation) and the angle around the horizon is known as the azimuth, in degrees relative to Earth’s true north.
When we look up at the stars, how do we describe their position in the sky? As you might imagine, we use an angle up from the horizon and the direction you are facing. These are known as horizontal coordinates. The angle up from the horizon is known as the altitude (or elevation) and the angle around the horizon is known as the azimuth, in degrees relative to Earth’s true north.
The angle straight up from the Observer’s position is known as the zenith. And the angle straight down is known as the nadir.
Horizontal coordinates are very useful for determining the rise and set times of an object in the sky. When an object's altitude is 0°, it is on the horizon. If at that moment its altitude is increasing, it is rising, but if its altitude is decreasing, it is setting. However, all objects on the celestial sphere are subject to diurnal motion, which always appears to be westward. --https://en.wikipedia.org/wiki/Horizontal_coordinate_system.
Horizontal coordinates are relative to the Observer’s location on Earth. But how do we communicate a celestial object’s position independently of the location on Earth? This is where the celestial sphere comes in.
Celestial Sphere
The fundamental construct for understanding where stars are located in the sky is called the celestial sphere. This is an imaginary sphere with Earth at its center and the North Celestial Pole and South Celestial Pole coincident with Earth’s poles as shown below.
Horizontal coordinates are very useful for determining the rise and set times of an object in the sky. When an object's altitude is 0°, it is on the horizon. If at that moment its altitude is increasing, it is rising, but if its altitude is decreasing, it is setting. However, all objects on the celestial sphere are subject to diurnal motion, which always appears to be westward. --https://en.wikipedia.org/wiki/Horizontal_coordinate_system.
Horizontal coordinates are relative to the Observer’s location on Earth. But how do we communicate a celestial object’s position independently of the location on Earth? This is where the celestial sphere comes in.
Celestial Sphere
The fundamental construct for understanding where stars are located in the sky is called the celestial sphere. This is an imaginary sphere with Earth at its center and the North Celestial Pole and South Celestial Pole coincident with Earth’s poles as shown below.
Coordinates in the celestial sphere are similar to coordinates for Earth. We describe latitudes on the celestial sphere as the declination (DEC) and longitudes as the right ascension (RA). For declinations, the celestial equator is 0°, and the poles are +90° and -90° just like latitudes on Earth. For right ascension, instead of a longitude angle in degrees, we describe the value in hours, minutes and seconds of time. Where 15° is 1 hour, which is the basis for time zones btw.
The zero point for RA is one of the points where the ecliptic circle intersects the celestial equator circle. It's defined to be the point where the Sun crosses into the northern hemisphere beginning spring: the vernal equinox, also known as the first point of Aries, often identified by the symbol of the ram. --https://science.nasa.gov/learn/basics-of-space-flight/chapter2-2/.
Together, the RA and DEC form a pair of equatorial coordinates.
The zero point for RA is one of the points where the ecliptic circle intersects the celestial equator circle. It's defined to be the point where the Sun crosses into the northern hemisphere beginning spring: the vernal equinox, also known as the first point of Aries, often identified by the symbol of the ram. --https://science.nasa.gov/learn/basics-of-space-flight/chapter2-2/.
Together, the RA and DEC form a pair of equatorial coordinates.
To better understand equatorial coordinates, here is a simple example showing the coordinates of a star in the sky.
To convert between [celestial] equatorial coordinates and Earth’s geographic coordinates, we need to determine the longitude of Earth below the vernal equinox. To do this, we must orient the celestial sphere to the Observer’s current day and time. (Remember the Earth is rotating within the celestial sphere.)
First, we calculate the RA of the Observer’s current day and time at Earth’s prime meridian, 0°, known as Greenwich mean sidereal time (GMST) using the approach described at https://aa.usno.navy.mil/faq/GAST. This involves understanding Julian dates, universal time and epochs, which I am going to omit here in an effort to not overload you with too much information.
Once we have GMST, we can calculate the Observer’s geographic longitude (or the star’s geographic longitude as depicted below) like so:
Geo Longitude = RA – GMST
First, we calculate the RA of the Observer’s current day and time at Earth’s prime meridian, 0°, known as Greenwich mean sidereal time (GMST) using the approach described at https://aa.usno.navy.mil/faq/GAST. This involves understanding Julian dates, universal time and epochs, which I am going to omit here in an effort to not overload you with too much information.
Once we have GMST, we can calculate the Observer’s geographic longitude (or the star’s geographic longitude as depicted below) like so:
Geo Longitude = RA – GMST
Hour angle and its relation to right ascension and sidereal time
https://en.wikipedia.org/wiki/Equatorial_coordinate_system
https://en.wikipedia.org/wiki/Equatorial_coordinate_system
The latitude is then simply the declination angle; however this is the geocentric latitude, not the geodetic latitude as I touched on in my Earth Coordinate Systems blog post. To convert the geocentric latitude to a geodetic latitude, we look at well-known iterative formulae such as the one described at https://www.mathworks.com/help/aeroblks/geocentrictogeodeticlatitude.html.
Ecliptic Coordinates
The celestial sphere allows us to position objects in our sky but sometimes we want to know where objects are located within our Solar System. This is where the ecliptic coordinate system comes in.
Ecliptic Coordinates
The celestial sphere allows us to position objects in our sky but sometimes we want to know where objects are located within our Solar System. This is where the ecliptic coordinate system comes in.
In the figure above, the Sun is at the center of the ecliptic coordinate system and, in this case, coordinates are referred to as heliocentric. However, we often like to know where the object is relative to Earth. In this case, imagine the same x-y-z axes shifted to the center of the Earth. These are then known as geocentric ecliptic coordinates.
In both cases, the ecliptic latitude and longitude are interpreted the same. Latitude is an angle up from the ecliptic plane and longitude is an angle east from the vernal equinox. But we do need one more parameter to locate the object in the Solar System space and that is distance. We don’t use distance for stars because we consider them infinitely far away in this case. In the figure below, the ecliptic latitude is denoted as B (Greek b for heliocentric and β for geocentric). And the ecliptic longitude is denoted as L (Greek l for heliocentric and λ for geocentric). The distance for heliocentric coordinates is denoted by D (Greek Δ), but we use often use ‘r’ for geocentric distances. (The ‘r’ refers to how many Earth radii an object is away.)
In both cases, the ecliptic latitude and longitude are interpreted the same. Latitude is an angle up from the ecliptic plane and longitude is an angle east from the vernal equinox. But we do need one more parameter to locate the object in the Solar System space and that is distance. We don’t use distance for stars because we consider them infinitely far away in this case. In the figure below, the ecliptic latitude is denoted as B (Greek b for heliocentric and β for geocentric). And the ecliptic longitude is denoted as L (Greek l for heliocentric and λ for geocentric). The distance for heliocentric coordinates is denoted by D (Greek Δ), but we use often use ‘r’ for geocentric distances. (The ‘r’ refers to how many Earth radii an object is away.)
Heliocentric Ecliptic Coordinates
https://commons.wikimedia.org/wiki/File:Heliocentric_ecliptic_coordinate_systems.svg
https://commons.wikimedia.org/wiki/File:Heliocentric_ecliptic_coordinate_systems.svg
Galactic Coordinates
Beyond our own star system, we can locate objects including stars, nebulae, etc. in our Milky Way galaxy using the galactic coordinate system. The galactic plane coincides with our galaxy’s disc as shown below. Our Sun is at the origin, the longitudinal axis runs through to the center of the galaxy, and the latitudinal axis runs parallel to the galactic disc. Similar to the other celestial frames, the galactic latitude is then the angle up from the disc and the galactic longitude is the angle eastward along the galactic equator.
Beyond our own star system, we can locate objects including stars, nebulae, etc. in our Milky Way galaxy using the galactic coordinate system. The galactic plane coincides with our galaxy’s disc as shown below. Our Sun is at the origin, the longitudinal axis runs through to the center of the galaxy, and the latitudinal axis runs parallel to the galactic disc. Similar to the other celestial frames, the galactic latitude is then the angle up from the disc and the galactic longitude is the angle eastward along the galactic equator.
I’m including a short description of the galactic coordinate system here mainly for the sake of completeness. The one practical application is to create a Milky Way skybox for our planet.
Most of us would’ve seen the NASA image of our galaxy below, or something similar. But how do we make this into a skybox?
Most of us would’ve seen the NASA image of our galaxy below, or something similar. But how do we make this into a skybox?
The first thing we need to know are the image’s coordinates. Well, it was intentionally processed to fit our galactic coordinate system. The image is centered on galactic longitude 0°, with longitude increasing to the left. The image below depicts the layout of the grid. Now imagine this grid (in rectangular form) overlaid on top of the Milky Way image above and, voilà, you’ve got it oriented.
Next we need to take the galactic image and fit it around our planet. To do this, we need to convert the galactic coordinates to equatorial coordinates, which we can do by using the formulae provided on Wikipedia and shown below.
From here, you need to create a cubemap of the image so it can be used as a skybox. Refer to the link in my Atmosphere/Sky Rendering blog post for details.
If you’re a keener and want to learn even more about galaxies, check out https://galaxiesbook.org/ by Professor Bovy at the University of Toronto. Looks like a fabulous resource to get your galactic geek on.
Supergalactic Coordinates
But wait, there’s more! Galaxies that is. Most of us have probably heard of the Andromeda galaxy but few of us would know where it is located relative to our own galaxy. This is where the supergalactic coordinate system comes in. Supergalactic coordinates have the cluster of galaxies that we are in at their center (origin) and then latitudes and longitudes defined relative to the supergalactic plane as shown below.
If you’re a keener and want to learn even more about galaxies, check out https://galaxiesbook.org/ by Professor Bovy at the University of Toronto. Looks like a fabulous resource to get your galactic geek on.
Supergalactic Coordinates
But wait, there’s more! Galaxies that is. Most of us have probably heard of the Andromeda galaxy but few of us would know where it is located relative to our own galaxy. This is where the supergalactic coordinate system comes in. Supergalactic coordinates have the cluster of galaxies that we are in at their center (origin) and then latitudes and longitudes defined relative to the supergalactic plane as shown below.
Again, I include this coordinate system for the sake of completeness. I’m not sure when this would be used in a lifelike virtual world except maybe for locating other celestial objects beyond our galaxy as part of some virtual astronomy class or training exercise.
Implementing Celestial Coordinate Systems
Most of you reading this probably aren’t astronomy aficionados or galactic geeks and just want to get down to the nuts and bolts of it. Especially if you’re a software developer who just likes to make things “go.”
One of the best ways to do this is by buying the classic “Practical Astronomy with your Calculator” book. The latest version of the book (cover shown below) comes with a spreadsheet with examples of all the calculations Duffet-Smith and Zwart describe in the book. It truly is a very practical introduction to astronomy and celestial coordinates. Highly recommend. One of the lesser known but extremely valuable uses of the book is to verify your celestial calculations that you implement in your code are correct. We don’t often say it, but unit tests ftw here.
Implementing Celestial Coordinate Systems
Most of you reading this probably aren’t astronomy aficionados or galactic geeks and just want to get down to the nuts and bolts of it. Especially if you’re a software developer who just likes to make things “go.”
One of the best ways to do this is by buying the classic “Practical Astronomy with your Calculator” book. The latest version of the book (cover shown below) comes with a spreadsheet with examples of all the calculations Duffet-Smith and Zwart describe in the book. It truly is a very practical introduction to astronomy and celestial coordinates. Highly recommend. One of the lesser known but extremely valuable uses of the book is to verify your celestial calculations that you implement in your code are correct. We don’t often say it, but unit tests ftw here.
Practical Astronomy with your Calculator or Spreadsheet
https://www.amazon.ca/Practical-Astronomy-your-Calculator-Spreadsheet-dp-0521146542/dp/0521146542/
https://www.amazon.ca/Practical-Astronomy-your-Calculator-Spreadsheet-dp-0521146542/dp/0521146542/
Accurate Celestial Calculations
I feel I should mention a more comprehensive and accurate method to calculate the positions of celestial objects and that is the software developed by scientists at the International Astronomical Union's (IAU) Standards of Fundamental Astronomy (SOFA) group.
I feel I should mention a more comprehensive and accurate method to calculate the positions of celestial objects and that is the software developed by scientists at the International Astronomical Union's (IAU) Standards of Fundamental Astronomy (SOFA) group.
This group of international scientists and software developers has created a software library in Fortran 77 (really?) and ANSI C. It contains a complete set of functions to calculate all sorts of numbers about the cosmos, accounting for the subtleties of celestial movements like nutation, precession, etc. That’s the good news. The bad news is it’s not easily understood. If you have time and want to integrate a complete and accurate module of astronomical functions in your software, then point your browser ship to the link above and set sail my friend.
Sol
Now that you are armed with battle-ready celestial coordinate conversions, we need to apply this to the primary light source on our planet.
NOAA’s Global Monitoring Lab website has a good page on solar calculations; straightforward with references to details including their basis of calculations, the seminal work by Jean Meeus, “Astronomical Algorithms,” which can be found at https://www.agopax.it/Libri_astronomia/pdf/Astronomical%20Algorithms.pdf.
If you want to try something a little simpler, go ahead and have a look at the Position of the Sun Wikipedia page.
Sol
Now that you are armed with battle-ready celestial coordinate conversions, we need to apply this to the primary light source on our planet.
NOAA’s Global Monitoring Lab website has a good page on solar calculations; straightforward with references to details including their basis of calculations, the seminal work by Jean Meeus, “Astronomical Algorithms,” which can be found at https://www.agopax.it/Libri_astronomia/pdf/Astronomical%20Algorithms.pdf.
If you want to try something a little simpler, go ahead and have a look at the Position of the Sun Wikipedia page.
Finding the position of the Sun --Wikipedia
Somewhat obviously, simpler also means less accurate. This is still a useful exercise to go through the simple calculations to learn the basics through hands-on application of the formulae. For example, to calculate the position of the Sun, you’ll need to account for/understand things including:
Up until now, I’ve rocketed past details like these with barely a mention. I intentionally filtered these out to try and lay down some ground-level understanding for you. It gets distracting real quick. There are tons of resources on the web so you will have no trouble going down the rabbit holes of your choosing.
One website that I quite like as a quick reference, as well as a good tool to verify the results of your Sun position calculations, is suncalc.org.
- Julian dates
- Mean longitude of the Sun
- Mean anomaly of the Sun
- Obliquity of the ecliptic
- Atmospheric refraction
Up until now, I’ve rocketed past details like these with barely a mention. I intentionally filtered these out to try and lay down some ground-level understanding for you. It gets distracting real quick. There are tons of resources on the web so you will have no trouble going down the rabbit holes of your choosing.
One website that I quite like as a quick reference, as well as a good tool to verify the results of your Sun position calculations, is suncalc.org.
Luna
The next biggest source of light for our planet is our only natural satellite, the moon, aka Luna. We again look to Meeus’ “Astronomical Algorithms”, Chapter 47 in this case, to compute the position of Luna, which happens to have even more subtle effects on its position than Sol.
The basic approach for calculating the Moon’s position is the same as that for the Sun:
This will give you the Moon’s position as well as a distance away from Earth’s center.
The developer of suncalc.org also has a site for the moon at www.mooncalc.org.
Stars
Scientists and physicists have been studying the stars for centuries. In modern times, we have several star catalogs that are commonly used today:
There are more repositories of star data, but these are a few of the major ones. Refer to https://www.projectrho.com/public_html/starmaps/catalogues.php for a more complete intro to the various star catalogues and their purposes, limitations, etc.
For Bending Time, I used the HYG catalog as the data was good and contained enough information to reasonably render a nice-looking night sky. However, I never actually got around to the rendering part; I left the Milky Way skybox in place and that was it. Financing for rendering a beautiful and accurate night sky is tricky because the business case is dubious. As is the case with many other aspects of a lifelike virtual world, learning and training is where the eventual money is.
If we take a closer look at the HYG data, we can see the positions of the stars in the sky are encoded in equatorial coordinates, that is in right ascension (RA) and declination (DEC).
The next biggest source of light for our planet is our only natural satellite, the moon, aka Luna. We again look to Meeus’ “Astronomical Algorithms”, Chapter 47 in this case, to compute the position of Luna, which happens to have even more subtle effects on its position than Sol.
The basic approach for calculating the Moon’s position is the same as that for the Sun:
- Calculate the Moon’s ecliptic coordinates,
- Convert the ecliptic coordinates to equatorial coordinates (same method/formula used for the Sun),
- Convert to horizontal coordinates (or whatever coordinate system that you want, e.g., geodetic/ECEF).
This will give you the Moon’s position as well as a distance away from Earth’s center.
The developer of suncalc.org also has a site for the moon at www.mooncalc.org.
Stars
Scientists and physicists have been studying the stars for centuries. In modern times, we have several star catalogs that are commonly used today:
- Gliese Catalogue of Nearby Stars
- Yale Bright Star Catalog
- Hipparcos and Tychos Catalogues
- HYG Catalog
- Gaia Catalogue
There are more repositories of star data, but these are a few of the major ones. Refer to https://www.projectrho.com/public_html/starmaps/catalogues.php for a more complete intro to the various star catalogues and their purposes, limitations, etc.
For Bending Time, I used the HYG catalog as the data was good and contained enough information to reasonably render a nice-looking night sky. However, I never actually got around to the rendering part; I left the Milky Way skybox in place and that was it. Financing for rendering a beautiful and accurate night sky is tricky because the business case is dubious. As is the case with many other aspects of a lifelike virtual world, learning and training is where the eventual money is.
If we take a closer look at the HYG data, we can see the positions of the stars in the sky are encoded in equatorial coordinates, that is in right ascension (RA) and declination (DEC).
I described earlier in this blog post how to convert from RA-DEC to geodetic coordinates: lat, lon and elevation. And in my Earth Coordinate Systems blog post, I described how to convert geodetic coordinates to the Earth-Centered, Earth Fixed (ECEF) XYZ frame. So now you can orient your stars to your XYZ axes in your project.
Constellations
Space has captivated homo sapiens for a very long time. It’s no wonder that we drew shapes using prominent stars as key points.
Today, it can be fun for families and friends to go outside at night and spot constellations in the sky. This might seem like a casual experience, but this type of activity is important to foster the adventurous spirit of our young ones and fill their dreams with possibilities.
Constellations
Space has captivated homo sapiens for a very long time. It’s no wonder that we drew shapes using prominent stars as key points.
Today, it can be fun for families and friends to go outside at night and spot constellations in the sky. This might seem like a casual experience, but this type of activity is important to foster the adventurous spirit of our young ones and fill their dreams with possibilities.
Somewhat obvious when you think about it, but constellations have been interpreted differently in history depending on the region of the world. Today, the International Astronomical Union (IAU) maintains a list of the 88 ratified constellations, with each one including the following information:
- Name
- Pronunciation of the name
- Abbreviation
- English Name
- Genitive
- Pronunciation of the genitive
- Chart for screen view (GIF)
- Chart for printing (PDF in A4 format)
- Boundary coordinates (TXT)
The open-source Stellarium planetarium software does a very nice job of displaying the night sky in a clean interface. In addition to the display of the stars, they include pictorial representations of the constellations in different international cultures. A great project that truly caters to the global community.
Free and open source planetarium for your computer - Stellarium
stellarium.org/
stellarium.org/
This concludes the science portion of this blog post. Let's move on to rendering all these celestial objects.
Rendering the Sun
Once you have the position of the Sun in your world coordinates (e.g., ECEF), you need to render it from the Observer’s perspective.
In many 3D games, the Sun is rendered as a disc in the sky either overtop of the skybox like a decal, or rendered behind the skybox but shining through. Then effects like brightness, halo, and lens flare to name a few are added to increase the realism.
Rendering the Sun
Once you have the position of the Sun in your world coordinates (e.g., ECEF), you need to render it from the Observer’s perspective.
In many 3D games, the Sun is rendered as a disc in the sky either overtop of the skybox like a decal, or rendered behind the skybox but shining through. Then effects like brightness, halo, and lens flare to name a few are added to increase the realism.
Example Rendering of the Sun in the Sky
https://help.graphisoft.com/AC/19/INT/AC19Help/Appendix_Settings/Appendix_Settings-137.htm
https://help.graphisoft.com/AC/19/INT/AC19Help/Appendix_Settings/Appendix_Settings-137.htm
For a lifelike virtual world, for greater fidelity and to support more use cases, a 3D model of the sun might be a better approach. Images of the Sun can be found at NASA’s Solar Dynamics Observatory website: https://sdo.gsfc.nasa.gov/ including a 4k texture that can be used to wrap around a Sun sphere.
Full map of the surface of the Sun
https://svs.gsfc.nasa.gov/30362/
https://svs.gsfc.nasa.gov/30362/
As for the geometry, the Sun has a radius of approximately 700,000 km. In Bending Time, all the celestial objects are tessellated at runtime using the latitude/longitude grid as opposed to the spherical polyhedron approach.
It’s relatively straightforward to render a sphere based on the wireframe above. Choose your latitudinal and longitudinal resolutions (2-3 degrees yields reasonable geometry), calculate the vertices, calculate the UVs and then form all the triangles.
Note with this approach you do need to take special care at the poles as you may have seen in some 3D globes. This is discussed in the 3D Engine Design for Virtual Globes book.
Now you’ve got a 3D Sun model placed at the correct location in the sky, you need to scale the 3D object appropriately so the disc appears the correct size. I haven’t done this part but I imagine it’s not overly difficult based on the Sun being 93 million miles away and we know its size. Trivial for you now that you’ve mastered celestial coordinate conversion!
Rendering the Moon
Rendering the Moon is very much like rendering the Sun, though there is a slight twist when it comes to the waxing and waning crescent shapes that we see.
Note with this approach you do need to take special care at the poles as you may have seen in some 3D globes. This is discussed in the 3D Engine Design for Virtual Globes book.
Now you’ve got a 3D Sun model placed at the correct location in the sky, you need to scale the 3D object appropriately so the disc appears the correct size. I haven’t done this part but I imagine it’s not overly difficult based on the Sun being 93 million miles away and we know its size. Trivial for you now that you’ve mastered celestial coordinate conversion!
Rendering the Moon
Rendering the Moon is very much like rendering the Sun, though there is a slight twist when it comes to the waxing and waning crescent shapes that we see.
With radius 1737.4 km and the texture above, we can render the Moon the same way we rendered the Sun. And we know how far away the Moon is from Meeus’ algorithm so we can scale it accordingly, too. Further, NASA provides elevation data of the Moon in addition to the imagery above so we can have a bumpy Moon surface if we want. This will get us a nice spherical Moon but we also need to worry about when we only see a portion of the Moon’s illuminated surface. Great explanatory page on this at https://science.nasa.gov/moon/moon-phases/ btw.
In both Meeus’ “Astronomical Algorithms” and Duffet-Smith’s and Zwart’s “Practical Astronomy with your Calculator or Spreadsheet,” they provide formula for calculating the phase of the Moon, specifically the portion of the Moon that is visible known as the bright limb. The results of the calculation are a percentage where 0% is a new Moon and 100% is a full Moon, as well as a position angle as the bright limb will appear slightly rotated depending on where you are located on Earth and the phase the Moon is in.
I found a somewhat recent thesis researched and written by Alexander Kuzminykh at the Hanover University of Applied Sciences and Arts dedicated to this topic so I will point you there for what appears to be a nice, modern, Physically-Based Rendering (PBR) approach to rendering the Moon including its phases.
In both Meeus’ “Astronomical Algorithms” and Duffet-Smith’s and Zwart’s “Practical Astronomy with your Calculator or Spreadsheet,” they provide formula for calculating the phase of the Moon, specifically the portion of the Moon that is visible known as the bright limb. The results of the calculation are a percentage where 0% is a new Moon and 100% is a full Moon, as well as a position angle as the bright limb will appear slightly rotated depending on where you are located on Earth and the phase the Moon is in.
I found a somewhat recent thesis researched and written by Alexander Kuzminykh at the Hanover University of Applied Sciences and Arts dedicated to this topic so I will point you there for what appears to be a nice, modern, Physically-Based Rendering (PBR) approach to rendering the Moon including its phases.
Physically Based Real-Time Rendering of the Moon
https://serwiss.bib.hs-hannover.de/frontdoor/deliver/index/docId/2105/file/Bachelorarbeit_Alexander_Kuzminykh_20210818.pdf
https://serwiss.bib.hs-hannover.de/frontdoor/deliver/index/docId/2105/file/Bachelorarbeit_Alexander_Kuzminykh_20210818.pdf
Rendering the Stars
Last but not least we need to render the stars. One of my favourite software applications for viewing space (in general, not just from Earth’s surface) is Celestia. It has a clean user interface, complete catalog of celestial objects and nice rendering of the stars, and planets!
Last but not least we need to render the stars. One of my favourite software applications for viewing space (in general, not just from Earth’s surface) is Celestia. It has a clean user interface, complete catalog of celestial objects and nice rendering of the stars, and planets!
Like Stellarium and Celestia, a lifelike virtual world will soon want to do away with the Milky Way skybox and move to rendering stars one at a time. We have the data and we can now position the stars at their correct locations in the sky, what’s remaining is the brightness, colour and other effects like glint and twinkle.
Going back to the HYG star catalog example, we can see that in addition to a star’s position, the visual magnitude, the spectral type and color index are provided.
Going back to the HYG star catalog example, we can see that in addition to a star’s position, the visual magnitude, the spectral type and color index are provided.
HYG parameters including Magnitude, Absolute Magnitude, Spectrum and Color Index
https://www.astronexus.com/hyg
https://www.astronexus.com/hyg
We use the visual magnitude to determine the size of the star when rendering. This includes some level of glint as shown in the screenshot from the SIGGRAPH 2001 paper “A Physically-Based Night Sky Model” by Jensen, Durand, Stark, Premože, Dorsey and Shirley of MIT. The spectrum and color index are then used to determine what colour to render the star.
A Physically-Based Night Sky Model
https://graphics.stanford.edu/~henrik/papers/nightsky/nightsky.pdf
https://graphics.stanford.edu/~henrik/papers/nightsky/nightsky.pdf
As far as twinkle goes, I have never heard of anyone rendering this at runtime. I do recall the reason for twinkling is due to our atmosphere. The folks at EarthSky have a great graphic depicting the reason at https://earthsky.org/space/why-dont-planets-twinkle-as-stars-do/.
If we look at other, more complete star catalogs like the European Space Agency’s Gaia star catalog (https://gea.esac.esa.int/archive/), which contains information about 2 billion stars in our galaxy, data management obviously becomes an issue.
For Bending Time, the client is intended to be very lightweight with all the data residing in the cloud. This architectural concept applies to star data as well. My idea here draws from the approach taken for map data… tile it! In the case of stars, the “horizontal” axis of the tiling grid would be our sky, whether it’s the celestial sphere or the galactic grid. Then for resolution, or depth into space as it were, we could use the star’s brightness. The brighter the star, the sooner it shows up to an Observer. Conversely, the dimmer the star (let’s say not visible to the human eye), the “later” it shows up, like in a virtual telescope scenario for example. The devil is in the details, but the general concept remains the same: load a chunk of star data from a portion of the sky the Observer is interested in.
Conclusion
Well, that was a lot of information in a short amount of time. Congratulations if you made it this far.
I hope you gained a better understanding of life beyond our atmosphere and can now appreciate all that goes into rendering the cosmos from our pale blue dot.
Ad astra!
--Sean
References
Coordinate Systems:
Sun:
Moon:
Stars:
Constellations:
Rendering
If we look at other, more complete star catalogs like the European Space Agency’s Gaia star catalog (https://gea.esac.esa.int/archive/), which contains information about 2 billion stars in our galaxy, data management obviously becomes an issue.
For Bending Time, the client is intended to be very lightweight with all the data residing in the cloud. This architectural concept applies to star data as well. My idea here draws from the approach taken for map data… tile it! In the case of stars, the “horizontal” axis of the tiling grid would be our sky, whether it’s the celestial sphere or the galactic grid. Then for resolution, or depth into space as it were, we could use the star’s brightness. The brighter the star, the sooner it shows up to an Observer. Conversely, the dimmer the star (let’s say not visible to the human eye), the “later” it shows up, like in a virtual telescope scenario for example. The devil is in the details, but the general concept remains the same: load a chunk of star data from a portion of the sky the Observer is interested in.
Conclusion
Well, that was a lot of information in a short amount of time. Congratulations if you made it this far.
I hope you gained a better understanding of life beyond our atmosphere and can now appreciate all that goes into rendering the cosmos from our pale blue dot.
Ad astra!
--Sean
References
Coordinate Systems:
- https://en.wikipedia.org/wiki/Epoch_(astronomy)
- https://aa.usno.navy.mil/data/JulianDate
- https://aa.usno.navy.mil/faq/GAST
- https://en.wikipedia.org/wiki/Horizontal_coordinate_system
- NASA Ref. Systems: https://science.nasa.gov/learn/basics-of-space-flight/chapter2-2/
- https://lco.global/spacebook/sky/equatorial-coordinate-system
- https://en.wikipedia.org/wiki/Ecliptic_coordinate_system
- https://en.wikipedia.org/wiki/Galactic_coordinate_system
- Star Map: https://svs.gsfc.nasa.gov/4851/
- https://cse.ssl.berkeley.edu/chips_epo/coordinates2.html
- https://en.wikipedia.org/wiki/Supergalactic_coordinate_system
- https://galaxiesbook.org/
- https://www.amazon.ca/Practical-Astronomy-your-Calculator-Spreadsheet-dp-0521146542/dp/0521146542/
- Meeus: https://www.agopax.it/Libri_astronomia/pdf/Astronomical%20Algorithms.pdf
- SOFA: https://www.iausofa.org/
Sun:
- https://sdo.gsfc.nasa.gov/
- https://www.suncalc.org/
- Simple position: https://en.wikipedia.org/wiki/Position_of_the_Sun
- Sun position: Ch 25 in Meeus’ “Astronomical Algorithms” above
Moon:
- https://www.mooncalc.org
- https://science.nasa.gov/moon/moon-phases/
- Moon position: Ch 47 in Meeus’ “Astronomical Algorithms” above
Stars:
- https://www.asc-csa.gc.ca/eng/blog/2018/06/29/13-amazing-stargazing-locations-in-canada.asp
- https://www.projectrho.com/public_html/starmaps/catalogues.php
- Gliese catalog: https://vmcoolwiki.ipac.caltech.edu/index.php/Gliese_Catalog_Explorations
- Hipparcos and Tycho catalogs: https://www.cosmos.esa.int/web/hipparcos/catalogues
- HYG catalog: https://www.astronexus.com/hyg
- Gaia catalog: https://gea.esac.esa.int/archive/
- https://earthsky.org/space/why-dont-planets-twinkle-as-stars-do/
Constellations:
- https://www.astronomy.com/observing/learn-the-constellations/
- https://interestingengineering.com/science/what-are-constellations
- https://spaceplace.nasa.gov/constellations/en/
- https://www.iau.org/public/themes/constellations/
Rendering
- Sphere tessellation: https://en.wikipedia.org/wiki/Spherical_geometry
- Ellipsoid tessellation: https://virtualglobebook.com/
- Sun texture: https://svs.gsfc.nasa.gov/30362/
- Moon textures and surface maps: https://svs.gsfc.nasa.gov/4720
- Night Sky: https://graphics.stanford.edu/~henrik/papers/nightsky/nightsky.pdf
- Moon: https://serwiss.bib.hs-hannover.de/frontdoor/deliver/index/docId/2105/file/Bachelorarbeit_Alexander_Kuzminykh_20210818.pdf
- Stars: https://en.wikipedia.org/wiki/Color_index