Email: nexusmail at this Web site address
Registration is entirely optional; it's no longer required for posting comments. If you wish to create an account, you may do so
through the login page.
The Astronomy Nexusscience, art, and advice |
|
AboutEmail: nexusmail at this Web site address Registration is entirely optional; it's no longer required for posting comments. If you wish to create an account, you may do so POV-Ray 3.0 For Technical IllustrationStellar CartographyObserving GuidesPersonal ExperiencesOther interests |
Example 2: Building a 3D Universe
Submitted by David on Wed, 2006-04-12 21:58.
Introduction and disclaimerBecause of raytracing's ability to handle three dimensional images, a raytracing program is a good place to try making star charts. I used POV-Ray extensively to create various 3D star charts, showing star motions over time or the appearance of constellations from faraway places, in the 3D Universe section of this site. Disclaimer 1: All my star charts have been done with version 3.1 of POV-Ray. Other 3.* versions will work fine. I'm not certain about 2.*. Disclaimer 2: This page is aimed primarily at people who have had some experience with POV-Ray, or who have at least tinkered with it a bit. It's not an in-depth tutorial. Advantages of using POV-RayOne of the nice things about using a 3D rendering package is that it will automatically do most of the calculations for you. Specifically, using POV-Ray to make your star maps will free you from the following chores:
Generic Star Map PrinciplesStar maps are actually an extremely simple thing to render with POV-Ray. All that you need to make a convincing star map is a collection of Thus, the guts of a POV-Ray star object will look something like this:
The only things you'll need to fill in are (a) the location of the center of the sphere (denoted a,b,c here) and the sphere's radius, denoted r. Everything else in this code fragment can be used verbatim. Setting the sphere positionsPOV-Ray uses xyz coordinates to place objects, so with one major caution you can simply use the Cartesian coordinates calculated by the appropriate methods. The major caution: POV-Ray uses a left-handed coordinate system, whereas the Cartesian coordinates described elsewhere in this site are right-handed. To handle this, simply switch the y and z coordinates on your star objects. In other words if you calculate for a star:
in POV-Ray you'd write:
The left-handed coordinate system will also cause some trouble when working with rotations. More on this later. Setting the sphere sizesA Simple ModelAdvance warning -- this gets a bit techie in spots... Suppose you're looking at a sphere of diameter d at a distance r. Its diameter appears to span a certain angle, which we'll call a. If you back away from the sphere, to a distance 2r, the sphere (provided it's small enough for small-angle trig approximations to hold) now appears to span an angle a/2. Since the angular area of the sphere is proportional to a2, there is a simple inverse-square relationship between apparent sphere size and distance. For luminous sources, like stars, there is also an exact
With this simple model, apparent magnitudes -- the brightness of the star as seen from any given vantage point -- are automatically correct no matter where you move your viewpoint in the POV-Ray scene. The apparent size of a sphere automatically varies in an inverse-square manner with distance, just as a true star's apparent brightness does. Thus, to set the size of a sphere, you will use a formula that looks something like the following:
where L is the star's true luminosity and L0 is some reference value for that luminosity -- for example, L0 might be the luminosity of the Sun, so L would then be in multiples of solar luminosity. Since it's the sphere's radius, not area, that the POV-Ray If you're pulling data straight from a star catalog, you're
where L0 and MV0 are the reference values (i.e. star with luminosity L0 has absolute magnitude MV0). This means we can rewrite the sphere radius formula as:
To simplify things, we can choose the reference magnitude,
Problems with the simple modelThis simple model is good in many respects, but it has one big flaw: it is very difficult to get realistic star images over a wide range of magnitudes. In particular, stars that are very bright as seen from Earth, such as Sirius, tend to look like big disks, whereas dim stars tend to fade out altogether. A simple fixOne solution to this is to "compress" the symbol range according to the apparent magnitude of the stars. This results in a formula for sphere size that looks like the following:
where B is the apparent brightness of a star, B0 some reference brightness, and n is a number between 0 and -1. The value n effectively decreases the sphere size for stars with large B, and increases it for stars of small B. The brightness ratio can be determined from apparent magnitudes much as the luminosity ratio could be determined from absolute magnitudes:
Thus you could set a reference magnitude roughly in the middle of the naked-eye range, such as +3, and a value of n around -0.5 or so, to uniformly shrink the largest stars and enlarge the smallest ones. Problems with the simple fixAlthough this approach makes the starfield more aesthetically pleasing, it totally destroys the nice scaling with distance you get with the simple model. Specifically, it couples the star's size to its apparent magnitude as seen from the Earth or some other fixed point as well as its absolute magnitude. Thus this method is not a good one to use if your star map involves starting at one place and then moving to another place very distant (so that star brightnesses change dramatically). In particular,
On the other hand, it's fine if you're making a single map for stars whose apparent magnitudes are well known. Thus, for star maps calculated for a remote location (e.g., those in 3D Universe), there is a way to use this fix effectively. Specifically, you must calculate each star's apparent magnitude from the remote location, rather than that from Earth, and then incorporate that information into the POV-Ray sphere size formula. If you're using a computer program to generate POV-Ray star objects, this is not particularly involved; if you're doing it by hand, it's a pain. Labeling the chartYou may wish to label the stars; you can do that with One fairly simple way to do this is to create a
You can reverse the rotation and the scaling if you want -- just be sure that the text object is 1 unit from the origin before you scale or rotate. This is fairly complex and you will probably want to have a computer program prepare the text object declarations for you. Rendering issuesStar Object ManagementI prefer to POV-Ray Rendering OptionsThere is one, and only one, thing you really must remember: always, always, always turn anti-aliasing ON, and preferably to an extremely aggressive level. Setting the anti-aliasing threshold all the way down to 0 is often a very good idea. If you do not anti-alias very aggressively, you will intermittently lose faint stars -- irritating in stills, and absolutely devastating in animations. Everything else is pretty much up to you. |