The Vector3 struct uses 32-bit floating-point values. On a solar-system scale, this does not have sufficient precision to accurately position objects such as the far outer planets.
A single-precision (32-bit) floating-point value stores 7 decimal digits of precision. Neptune, for example, has an approximate distance from the sun of 4.5x109km. Expressed with 7 significant figures, this has an error of approximately 500km (one half of the value of the last significant place). For Pluto (although no longer classified by the IAU as a planet), at a distance of approximately 5.9x109km, 500km is approximately one quarter of its diameter! Clearly single-precision floating point numbers are not sufficient to store these positions to the required level of accuracy. More...
The International Astronomical Union (IAU) defines an "official" set of boundaries for the 88 constellations. I've now added these.
What I initially saw as a bug turned out to result from the fact that Serpens is actually divided into two boundaries (all other constellations have a single boundary). More...
I've started looking into adding some deep sky objects such as star clusters and galaxies, and have been thinking about the following:
- Loading the data.
- Sprite markers for the position, size and type of deep sky object.
- Rendering a text label at the appropriate position and scale.
More...
One of the things I needed to start thinking about sooner or later was supporting High Dynamic Range (HDR) render targets, initially for the following reasons:
- I wanted to use a realistic bloom effect for the sun, without affecting other rendered planetary bodies.
- Atmospheric scattering algorithms lead to a wide range of luminance values.
- Background stars span a wide range of luminance values.
The use of HDR in combination with Tone Mapping to normalise luminance values into a standard render target would allow me to deal with each of these issues. This post will focus on the just the first issue of rendering the sun. More...
In Part 1 I showed some screenshots of a planet rendered using multiple effects. I'll discuss each of these in turn, and begin with a composite image to show how each effect contributes to the overall image. More...
In order to render my planetary bodies, I had to consider the following effects:
- Texture
- Lighting
- Relief
- Atmospheres
- Clouds
- Shadows
I'll discuss each of these in later posts, but for now here are some screenshots of the first attempt at rendering a planetary body using these effects. More...
In order to render a realistic star background, I could either use an image texture (either mapped onto a sphere or a cube), or a set of dynamic points. I opted for the latter so that I could more easily support changing my field-of-view (i.e. "zooming-in") without losing detail on my background.
Numerous star catalogues are available in the public domain. I opted for the Hipparcos Catalog, which lists the positions of approximately 100,000 stars. I converted the catalog to XML and then used the Content Pipeline in XNA Game Studio 3.1 to compress the XML to an XNB file. More...
To make things much easier, I wanted to render a grid to help with orientation. In planetary terms this would be a latitude/longitude grid, however the celestial equivalent is declination/right ascension respectively.
This was simply a matter of drawing line primitives on the surface of a sphere centered around the camera viewpoint. I chose not to converge all my lines of right ascension at the "poles", as shown below. The only drawback to this was that I had to draw multiple lines, simce it's possible to use just one if the lines converge. More...
Errm, where do I start in building a Virtual Solar System?
How about the orbits of the planets? At the start of the 17th Century, Kepler coined his laws of planetary motion. His first law defined the orbit of a planet as an ellipse with the sun at a focus, and the position on an ellipse can be defined by six unique pieces of data:
- Semi-Major Axis (a)
- Eccentricity (e)
- Inclination (i)
- Argument of Perifocus (ω)
- Longitude of Ascending Node (Ω)
- True Anomaly (θ)
These "Orbital Elements" for each body are available on the NASA JPL Horizons system. More...
I finally decided that I should try to get my head around the XNA Framework. Why, do you ask? Well, I found myself tinkering on another WPF project, requiring a reasonable amount of 3D, spending a considerable amount of time performance tuning the application. I started to wonder "if I spent the time I would otherwise spend performance tuning this app on learning how to implement the same application using XNA, could I end up getting to the same level of performance using XNA in the same overall time?"
So I thought I'd blow the cobwebs off this blog and use it as a journal as I try to find my path into the scary world of Games Programming.
I've had in my mind for some time the desire to learn more about the dynamics of the solar system. Maybe I spent too much time playing Elite. I really struggle with names, so for the time-being until I think of a better one, I'll refer to this project as "Virtual Universe".